-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
friendship ended with no-storage, no-trust is new best friend
- Loading branch information
Showing
9 changed files
with
390 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Lyra | ||
|
||
Simple no-storage password sharing with expiring links. No fancy - everything is kept as minimal as possible, as we aim to add a layer of security to secret sharing done by clients who would not bother to use complete suites. | ||
Simple zero-trust password sharing with expiring and self-destructing links. No fancy - everything is kept as minimal as possible, as we aim to add a layer of security to secret sharing done by clients who would not bother to use complete suites. | ||
|
||
**NB**: The server has to be trusted, as it could log links and holds the secret. Please self-host this for internal use. | ||
Encrypted values are stored by the server, while all encryption happens client-side. Secrets never leave the client machine, until they decide to share the link. | ||
|
||
[![Lyra](https://lyra.tetrabit.coop/banner.jpg)](https://lyra.tetrabit.coop) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { createClient } from '@supabase/supabase-js' | ||
import { SUPABASE_URL, SUPABASE_KEY } from '$env/static/private' | ||
|
||
export const sb = createClient(SUPABASE_URL, SUPABASE_KEY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { error, json } from '@sveltejs/kit' | ||
import { sb } from '$lib/server/supabase' | ||
|
||
export const load = async ({ params, fetch }) => { | ||
if (params.uuid) { | ||
|
||
const deleteEncryptedPassword = async () => { | ||
const { error } = await sb.from('encrypted_passwords').delete().eq('id', params.uuid) | ||
if (error) error(500, error.message || 'Something went wrong when trying to delete the encrypted password') | ||
} | ||
|
||
// get the encrypted password from the database | ||
const { data, error: err } = await sb | ||
.from('encrypted_passwords') | ||
.select('ciphertext, created_at') | ||
.eq('id', params.uuid) | ||
.maybeSingle() | ||
|
||
if (err) error(500, err.message || 'Something went wrong when trying to retrieve the encrypted password') | ||
if (!data) error(404, 'The encrypted password does not exist') | ||
|
||
console.log(data) | ||
|
||
const { ciphertext, created_at } = data | ||
|
||
await deleteEncryptedPassword() | ||
|
||
// check if it's older than 1 week | ||
if (Date.now() - new Date(created_at).getTime() > 604800000) return { expired: true } | ||
|
||
return { ciphertext } | ||
} | ||
} | ||
|
||
export const actions = { | ||
default: async ({ request }) => { | ||
const data = await request.formData() | ||
const { ciphertext } = Object.fromEntries(data) | ||
|
||
// insert the encrypted password into the database | ||
const { data: res, error: err } = await sb | ||
.from('encrypted_passwords') | ||
.insert({ ciphertext }) | ||
.select('id') | ||
.single() | ||
|
||
if (err) error(500, err.message || 'Something went wrong when trying to save the encrypted password') | ||
|
||
return { id: res.id } | ||
} | ||
} |
Oops, something went wrong.