diff options
| author | Adam Soltys <[email protected]> | 2024-09-16 06:11:45 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-17 09:19:27 -0700 |
| commit | 081538cc6a6c49c8b2eb34d682c880e40876d99b (patch) | |
| tree | b9818bea3cb2ff4d6116df9476215fca90aa12b3 /src/routes/(app)/account/setup | |
| parent | 8e990dae9fb39af9deb05a544fad688dcda8e2e8 (diff) | |
| download | coinos-ui-081538cc6a6c49c8b2eb34d682c880e40876d99b.tar.gz coinos-ui-081538cc6a6c49c8b2eb34d682c880e40876d99b.zip | |
account setup
Diffstat (limited to 'src/routes/(app)/account/setup')
| -rw-r--r-- | src/routes/(app)/account/setup/+page.svelte | 41 | ||||
| -rw-r--r-- | src/routes/(app)/account/setup/step2/+page.svelte | 68 |
2 files changed, 22 insertions, 87 deletions
diff --git a/src/routes/(app)/account/setup/+page.svelte b/src/routes/(app)/account/setup/+page.svelte index f19c4c96..8304c5ed 100644 --- a/src/routes/(app)/account/setup/+page.svelte +++ b/src/routes/(app)/account/setup/+page.svelte @@ -6,26 +6,29 @@ <h1 class="text-center text-3xl font-semibold">Choose account type</h1> <div class="container w-full mx-auto text-lg px-4 max-w-xl space-y-5"> - <a href="/account/cash"> - <div class="shadow p-8 rounded-xl flex gap-4"> - <img src="/images/cash.png" class="w-20" /> - <div> - <div class="text-xl">Cash</div> - <div class="text-secondary"> - Your balance is held with a custodian. Payments are faster and - cheaper. + <a href="/account/cash" class="block"> + <div class="shadow p-8 rounded-xl flex gap-4 hover:bg-primary"> + <img src="/images/cash.png" class="w-20" /> + <div> + <div class="text-xl">Cash</div> + <div class="text-secondary"> + Your balance is held with a custodian. Payments are fast and + free. + </div> + </div> </div> + </a> + <a href="/account/savings" class="block"> + <div class="shadow p-8 rounded-xl flex gap-4 hover:bg-primary"> + <img src="/images/keys.png" class="w-20" /> + <div> + <div class="text-xl">Savings</div> + <div class="text-secondary"> + You hold the keys to the account and are responsible for + safeguarding them. + </div> + </div> </div> - </div> - <div class="shadow p-8 rounded-xl flex gap-4"> - <img src="/images/keys.png" class="w-20" /> - <div> - <div class="text-xl">Savings</div> - <div class="text-secondary"> - You hold the keys to the account and are responsible for safeguarding - them. - </div> - </div> - </div> + </a> </div> </div> diff --git a/src/routes/(app)/account/setup/step2/+page.svelte b/src/routes/(app)/account/setup/step2/+page.svelte deleted file mode 100644 index 221e545e..00000000 --- a/src/routes/(app)/account/setup/step2/+page.svelte +++ /dev/null @@ -1,68 +0,0 @@ -<script lang="ts"> - import { t } from "$lib/translations"; - import { mnemonic } from "$lib/store"; - import Icon from "$comp/Icon.svelte"; - import { encrypt } from "nostr-tools/nip49"; - import { - mnemonicToSeed, - mnemonicToEntropy, - entropyToMnemonic, - } from "@scure/bip39"; - import { wordlist } from "@scure/bip39/wordlists/english"; - import { focus, versions, fail, post } from "$lib/utils"; - import { goto } from "$app/navigation"; - import { HDKey } from "@scure/bip32"; - - export let data; - - let { user } = data; - - let password; - - let submit = async () => { - let seed = await encrypt(mnemonicToEntropy($mnemonic, wordlist), password); - let master = HDKey.fromMasterSeed( - await mnemonicToSeed($mnemonic), - versions - ); - let child = master.derive("m/84'/0'/0'"); - let pubkey = child.publicExtendedKey; - let fingerprint = child.fingerprint.toString(16).padStart(8, "0"); - - let receiving = child.deriveChild(0); - try { - await post("/api/accounts", { fingerprint, pubkey, seed }); - goto(`/${user.username}`); - } catch (e) { - console.log(e); - fail("Something went wrong"); - } - - $mnemonic = ""; - }; -</script> - -<div class="space-y-5"> - <div> - <h1 class="text-center text-3xl font-semibold">Account setup</h1> - <h2 class="text-center text-2xl text-secondary">Step 2</h2> - </div> - - <form - on:submit|preventDefault={submit} - class="container w-full mx-auto text-lg px-4 max-w-xl space-y-5" - > - <p class="text-secondary mb-1"> - Add an additional password to your seed phrase. It should be different - than your login password. We can't reset it if you lose it. - </p> - - <input use:focus type="text" placeholder="Password" bind:value={password} /> - - <button - class="bg-black text-white w-full px-5 py-6 text-xl rounded-2xl font-bold" - > - Submit - </button> - </form> -</div> |
