Add NostrContext to manage connection to Nostr relay

This commit is contained in:
Alex Gleason
2024-03-06 20:03:18 -06:00
parent fc0de1bc49
commit b9a0c1f0f6
4 changed files with 77 additions and 38 deletions

View File

@ -1,5 +1,6 @@
import { NSchema as n, NostrSigner, NSecSigner } from '@soapbox/nspec';
import { getPublicKey, nip19 } from 'nostr-tools';
import { z } from 'zod';
import { lockStorageKey } from 'soapbox/utils/storage';
@ -34,7 +35,7 @@ export class NKeyStorage implements ReadonlyMap<string, NostrSigner> {
}
}
#dataSchema() {
#dataSchema(): z.ZodType<`nsec1${string}`[]> {
return n.json().pipe(n.bech32('nsec').array());
}