diff options
| author | Adam Soltys <[email protected]> | 2023-11-28 15:43:30 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-11-28 15:43:30 -0800 |
| commit | 60735521a3549089f639fdefb921030c23a4d74b (patch) | |
| tree | 753032f11e0faed78902dcdc77cd17f3b4b617a7 /src/routes/(app) | |
| parent | eee8f9327d2eb5926d9017792e2b45d96e74e417 (diff) | |
| download | coinos-ui-60735521a3549089f639fdefb921030c23a4d74b.tar.gz coinos-ui-60735521a3549089f639fdefb921030c23a4d74b.zip | |
nostr key reveal
Diffstat (limited to 'src/routes/(app)')
| -rw-r--r-- | src/routes/(app)/[username]/settings/[...tab]/_security.svelte | 53 |
1 files changed, 49 insertions, 4 deletions
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 @@ <script> - import { getMnemonic } from '$lib/nostr'; + import { getMnemonic, getNsec } from '$lib/nostr'; import { tick } from 'svelte'; import { t } from '$lib/translations'; import { Pin, Icon, Qr } from '$comp'; @@ -14,21 +14,36 @@ disabling2fa, locked, mnemonic, + nsec, old, otp, password, pin, revealPassword, revealSeed, + revealNsec, token = '', setting2fa, settingPin, verify; + let toggleNsec = async () => { + try { + nsec = await getNsec(user); + revealNsec = !revealNsec; + } catch (e) { + console.log(e); + } + }; + let togglePassword = () => (revealPassword = !revealPassword); let toggleSeed = async () => { - mnemonic = await getMnemonic(user); - revealSeed = !revealSeed; + try { + mnemonic = await getMnemonic(user); + revealSeed = !revealSeed; + } catch (e) { + console.log(e); + } }; $: verifying = pin?.length > 5; @@ -223,7 +238,13 @@ </select> </div> -<div class="space-y-5"> +<div> + <label for="seedphrase" class="font-bold">{$t('user.settings.seedPhrase')}</label> + + <p class="text-secondary mb-1"> + {$t('user.settings.seedDescription')} + </p> + <button type="button" class="primary" on:click={toggleSeed}> <Icon icon="warning" style="mr-1 w-6 my-auto" /> {revealSeed ? $t('user.settings.hideSeed') : $t('user.settings.revealSeed')} @@ -240,3 +261,27 @@ </button> {/if} </div> + +<div> + <label for="seedphrase" class="font-bold">{$t('user.settings.nostrKeys')}</label> + + <p class="text-secondary mb-1"> + {$t('user.settings.nostrDescription')} + </p> + + <button type="button" class="primary" on:click={toggleNsec}> + <Icon icon="warning" style="mr-1 w-6 my-auto" /> + {revealNsec ? $t('user.settings.hideNsec') : $t('user.settings.revealNsec')} + </button> + + {#if revealNsec} + <div class="text-lg break-all"> + {nsec} + </div> + + <button type="button" class="primary" on:click={() => copy(nsec)}> + <Icon icon="copy" style="mr-1 w-6 my-auto" /> + Copy + </button> + {/if} +</div> |
