From e2608b3fe00d4575c08846af4f7a192e4f1100ed Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 26 Oct 2023 14:24:43 -0700 Subject: reveal seed phrase --- src/lib/nostr.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/lib/nostr.js') diff --git a/src/lib/nostr.js b/src/lib/nostr.js index 987b89d0..28dbe50f 100644 --- a/src/lib/nostr.js +++ b/src/lib/nostr.js @@ -58,7 +58,7 @@ function typedArrayToBuffer(array) { return array.buffer.slice(array.byteOffset, array.byteLength + array.byteOffset); } -let getPrivateKey = async (user) => { +export let getMnemonic = async (user) => { let { cipher, username, salt } = user; let password = get(pw); @@ -85,8 +85,11 @@ let getPrivateKey = async (user) => { ) ); - mnemonic = entropyToMnemonic(entropy, wordlist); - return privateKeyFromSeedWords(mnemonic); + return entropyToMnemonic(entropy, wordlist); +}; + +let getPrivateKey = async (user) => { + return privateKeyFromSeedWords(await getMnemonic(user)); }; export let sign = async ({ event, user }) => { -- cgit v1.2.3 From 60735521a3549089f639fdefb921030c23a4d74b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 28 Nov 2023 15:43:30 -0800 Subject: nostr key reveal --- src/lib/nostr.js | 6 ++- src/locales/en.json | 7 +++ .../[username]/settings/[...tab]/_security.svelte | 53 ++++++++++++++++++++-- 3 files changed, 61 insertions(+), 5 deletions(-) (limited to 'src/lib/nostr.js') diff --git a/src/lib/nostr.js b/src/lib/nostr.js index 28dbe50f..c2634c83 100644 --- a/src/lib/nostr.js +++ b/src/lib/nostr.js @@ -3,7 +3,7 @@ import { Buffer } from 'buffer'; import { fail, wait, post, stretch } from '$lib/utils'; import { decrypted, password as pw, passwordPrompt, pin, loginRedirect } from '$lib/store'; import { goto, invalidate } from '$app/navigation'; -import { getPublicKey, signEvent, getEventHash, nip04, nip06 } from 'nostr-tools'; +import { getPublicKey, signEvent, getEventHash, nip04, nip06, nip19 } from 'nostr-tools'; import { mnemonicToEntropy, entropyToMnemonic } from '@scure/bip39'; import wordlist from '$lib/english'; import { bech32m } from '@scure/base'; @@ -92,6 +92,10 @@ let getPrivateKey = async (user) => { return privateKeyFromSeedWords(await getMnemonic(user)); }; +export let getNsec = async (user) => { + return nip19.nsecEncode(await getPrivateKey(user)); +}; + export let sign = async ({ event, user }) => { event.id = getEventHash(event); event.sig = signEvent(event, await getPrivateKey(user)); diff --git a/src/locales/en.json b/src/locales/en.json index 2e7b2079..608668a9 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -197,6 +197,13 @@ "placeholder": "Paste a bitcoin address, lightning invoice or coinos username" }, "settings": { + "seedPhrase": "Seed phrase", + "nostrKeys": "Nostr key", + "nostrDescription": "Your nostr key is used to sign and decrypt messages, keep it safe or someone may be able to impersonate you.", + "seedDescription": "This 12 word seed phrase is used to derive your nostr private key and your self-custodial wallet keys which determine your auto-withdrawal addresses. Back it up and don't let anyone see it.", + "emailDescription": "For password resets and notifications", + "hideNsec": "Hide nostr secret key", + "revealNsec": "Reveal nostr secret key", "hideSeed": "Hide seed phrase", "revealSeed": "Reveal seed phrase", "saveSettings": "Save Settings", diff --git a/src/routes/(app)/[username]/settings/[...tab]/_security.svelte b/src/routes/(app)/[username]/settings/[...tab]/_security.svelte index 170df744..113f7d7e 100644 --- a/src/routes/(app)/[username]/settings/[...tab]/_security.svelte +++ b/src/routes/(app)/[username]/settings/[...tab]/_security.svelte @@ -1,5 +1,5 @@
-
- - - +
+ + + - + -

{$t('404.404')}

-

{$t('404.pageNotFound')}

-
+

{$t("404.404")}

+

{$t("404.pageNotFound")}

+
diff --git a/src/components/About.svelte b/src/components/About.svelte index 1dbd8038..6e0cdcb5 100644 --- a/src/components/About.svelte +++ b/src/components/About.svelte @@ -1,7 +1,7 @@
-
-

- {$t('about.team.header')} -

-
- {#each team as member} -
-
-
- +
+

+ {$t("about.team.header")} +

+
+ {#each team as member} +
+
+
+ -
- {$t(`about.team.${member.name}.name`)} - {$t(`about.team.${member.name}.position`)} -
+
+ {$t(`about.team.${member.name}.name`)} + {$t(`about.team.${member.name}.position`)} +
-
- {#each member.socials as social} - - {/each} -
-
-
- {$t(`about.team.${member.name}.bio`)} -
-
-
- {/each} -
-
+
+ {#each member.socials as social} + + {/each} +
+
+
+ {$t(`about.team.${member.name}.bio`)} +
+
+
+ {/each} +
+
{#if locations?.length} -
-

{$t('about.locations.header')}

-

- {@html $t('about.locations.description')} -

- -
+
+

+ {$t("about.locations.header")} +

+

+ {@html $t("about.locations.description")} +

+ +
{/if} diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 53b31de4..2f088eec 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -1,149 +1,159 @@ {#if !$loading} -
- +
+ +
+
{/if} diff --git a/src/components/Avatar.svelte b/src/components/Avatar.svelte index b258a0e8..3955a42f 100644 --- a/src/components/Avatar.svelte +++ b/src/components/Avatar.svelte @@ -1,29 +1,31 @@ -
- {user.username} -
+
+ {user.username} +
diff --git a/src/components/Balance.svelte b/src/components/Balance.svelte index 0e4f2ec2..92714f98 100644 --- a/src/components/Balance.svelte +++ b/src/components/Balance.svelte @@ -1,34 +1,34 @@ {#if show && user.haspin && $pin?.length !== 6} - (show = false)} /> + (show = false)} /> {/if}
- {#if user.haspin && !$pin} - - {:else} -
- {#if isNaN($animatedRate)} -
—
- {:else} - {f((user.balance * $animatedRate) / sats, user.currency)} - {/if} -
+ {#if user.haspin && !$pin} + + {:else} +
+ {#if isNaN($animatedRate)} +
—
+ {:else} + {f((user.balance * $animatedRate) / sats, user.currency)} + {/if} +
-
- ⚡️{s(user.balance)} -
- {/if} +
+ ⚡️{s(user.balance)} +
+ {/if}
diff --git a/src/components/Calendar.svelte b/src/components/Calendar.svelte index 7504f48e..b07c136c 100644 --- a/src/components/Calendar.svelte +++ b/src/components/Calendar.svelte @@ -1,14 +1,14 @@ - + diff --git a/src/components/Card.svelte b/src/components/Card.svelte index 44ab635f..864465c0 100644 --- a/src/components/Card.svelte +++ b/src/components/Card.svelte @@ -1,14 +1,14 @@ - + diff --git a/src/components/Check.svelte b/src/components/Check.svelte index 4c9f504b..222c4dea 100644 --- a/src/components/Check.svelte +++ b/src/components/Check.svelte @@ -1,11 +1,11 @@ diff --git a/src/components/Code.svelte b/src/components/Code.svelte index ffca98a4..6c1048cf 100644 --- a/src/components/Code.svelte +++ b/src/components/Code.svelte @@ -1,27 +1,31 @@ -
-
-
{samples[sample]}
-
- +
+
+
{samples[sample]}
+
+
diff --git a/src/components/Event.svelte b/src/components/Event.svelte index 68f44589..2312f44e 100644 --- a/src/components/Event.svelte +++ b/src/components/Event.svelte @@ -1,84 +1,87 @@ -
- -
-
- -
- -
-
+
+ +
+
+ +
+ +
+
-
-
-
- {user.display_name || ''} - @{user.username} -
-
 {distance(seen)}
-
-
- {content} -
+
+
+
+ {user.display_name || ""} + @{user.username} +
+
 {distance(seen)}
+
+
+ {content} +
-
-
- -
444
-
-
- -
1072
-
-
- -
26
-
-
- -
4
-
-
-
+
+
+ +
444
+
+
+ +
1072
+
+
+ +
26
+
+
+ +
4
+
+
+
diff --git a/src/components/FaqCard.svelte b/src/components/FaqCard.svelte index 918e03d6..ae1ad077 100644 --- a/src/components/FaqCard.svelte +++ b/src/components/FaqCard.svelte @@ -1,15 +1,15 @@
-

{$t('faq.' + questionID + '.question')}

-

- {$t('faq.' + questionID + '.answer')} -

+

{$t("faq." + questionID + ".question")}

+

+ {$t("faq." + questionID + ".answer")} +

diff --git a/src/components/Feed.svelte b/src/components/Feed.svelte index 7de087a7..0c9c96d1 100644 --- a/src/components/Feed.svelte +++ b/src/components/Feed.svelte @@ -1,72 +1,84 @@ {#if user} -
-
- -
- -
+
+
+ +
+ +
{/if} {#if browser} - {#if sorted.length} - - - - - - {:else} -
-
{$t('user.noNotes')}
-
- {/if} + {#if sorted.length} + + + + + + {:else} +
+
{$t("user.noNotes")}
+
+ {/if} {/if} diff --git a/src/components/Footer.svelte b/src/components/Footer.svelte index eda26526..c1ac79cf 100644 --- a/src/components/Footer.svelte +++ b/src/components/Footer.svelte @@ -1,65 +1,74 @@ -