diff --git a/CHANGELOG.md b/CHANGELOG.md index 283716a7..ac6ef983 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Add reply to long-press menu * Fix @-mentions +* Replace nsec.app signup with njump.me # 0.2.5 diff --git a/src/app/components/SignUp.svelte b/src/app/components/SignUp.svelte index 83bc0e57..8c339c8c 100644 --- a/src/app/components/SignUp.svelte +++ b/src/app/components/SignUp.svelte @@ -1,107 +1,50 @@ @@ -136,29 +79,12 @@ on other nostr applications, you can create a nostr key yourself, or export your key from {PLATFORM_NAME} later.

- {:else} - -
- - @{signerDomain} -
-
- + Or {/if} - Or - + - Get started on Nosta.me - + Get started on njump +
Already have an account? diff --git a/src/lib/util.ts b/src/lib/util.ts index c4b9d03a..8c9f1bcd 100644 --- a/src/lib/util.ts +++ b/src/lib/util.ts @@ -1,3 +1,6 @@ +import {hexToBytes, bytesToHex} from "@noble/hashes/utils" +import * as nip19 from "nostr-tools/nip19" + export const displayList = (xs: T[], conj = "and", n = 6, locale = "en-US") => { const stringItems = xs.map(String) @@ -11,3 +14,13 @@ export const displayList = (xs: T[], conj = "and", n = 6, locale = "en-US") = return new Intl.ListFormat(locale, {style: "long", type: "conjunction"}).format(stringItems) } + +export const nsecEncode = (secret: string) => nip19.nsecEncode(hexToBytes(secret)) + +export const nsecDecode = (nsec: string) => { + const {type, data} = nip19.decode(nsec) + + if (type !== "nsec") throw new Error(`Invalid nsec: ${nsec}`) + + return bytesToHex(data) +} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index cb2b8a5f..508a46a7 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,10 +1,11 @@