Upgrade nspec, parse nsec the easier way

This commit is contained in:
Alex Gleason 2024-02-18 18:00:37 -06:00
parent 15ae362a8e
commit f2bfa6e2f6
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
3 changed files with 6 additions and 10 deletions

View file

@ -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",

View file

@ -34,11 +34,7 @@ export class NKeyStorage implements ReadonlyMap<string, NostrSigner> {
}
#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() {

View file

@ -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"