diff --git a/package.json b/package.json index 5f46b4ec7..ffa1bd2dd 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "mini-css-extract-plugin": "^2.6.0", "nostr-machina": "^0.1.0", "nostr-tools": "^2.3.0", - "nspec": "^0.1.0", + "nspec": "^0.2.0", "path-browserify": "^1.0.1", "postcss": "^8.4.29", "process": "^0.11.10", diff --git a/src/features/nostr/NKeyStorage.ts b/src/features/nostr/NKeyStorage.ts index e26794736..6100a8613 100644 --- a/src/features/nostr/NKeyStorage.ts +++ b/src/features/nostr/NKeyStorage.ts @@ -34,11 +34,7 @@ export class NKeyStorage implements ReadonlyMap { } #dataSchema() { - return n.json().pipe(z.set(this.#nsecSchema())); - } - - #nsecSchema() { - return n.bech32().refine((v): v is `nsec1${string}` => v.startsWith('nsec1'), { message: 'Invalid secret key' }); + return n.json().pipe(z.set(n.bech32('nsec'))); } #syncStorage() { diff --git a/yarn.lock b/yarn.lock index e010e9afe..a85703988 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6642,10 +6642,10 @@ npm-run-path@^5.1.0: dependencies: path-key "^4.0.0" -nspec@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/nspec/-/nspec-0.1.0.tgz#abde817cf34cb042d7315a70cf515037e489401b" - integrity sha512-HPVyFFVR2x49K7HJzEjlvvBR7x5t79G6bh7/SQvfm25hXVFq9xvYBQ6i3nluwJkizcBxm+fvErM5yqJEnM/1tA== +nspec@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/nspec/-/nspec-0.2.0.tgz#b59d8573ab60095e42f4b9773479fa7fbc78b756" + integrity sha512-bJjrt0u6/2rihfriSRR93woKIW0735WF0R1fFxJT40UfeK06Ky6dMWNKa/1LXtQg6lonxDlRYJ4LO/AuIBiFDw== dependencies: "@scure/base" "^1.1.5" "@scure/bip32" "^1.3.3"