diff --git a/UI/deno.lock b/UI/deno.lock index f7e2b61..32641c6 100644 --- a/UI/deno.lock +++ b/UI/deno.lock @@ -19,7 +19,7 @@ "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/ende.ts": "00807d3602a65d5a6881c8fbb01d6886bf7a6640a2cc5c7c1bf00dd00b320ae7", "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/key.ts": "1830bb6eded80c71aeae6a94ce921dbf09fcdf4820a3b846f8e8d9e23ce17119", "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/nip19.ts": "880aa40c85bb770703b5e85d72f29fed96f21777dc17906017c385873aedfd44", - "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/nostr.ts": "6d4b0bde3978bdc3d6cdc802a6f51e2391cb7257cac3aa80a6e70212b11b18a1", + "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/nostr.ts": "aeac23272327a1a0c576aaa66a040497474ec0d325fa27bbb112b2b36110abb3", "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/relay.ts": "93c5c6fe196dc9cae7c0e82ee8057a5350f77e69ae7d395fdb141a25b2664739", "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/scure.js": "fbc4be16918272bd167fff1184a7f5bbd1a676bad2a73130bb530d78df893a99", "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/vendor/esm.sh/v106/@noble/secp256k1@1.7.1/es2022/secp256k1.js": "69e32f6c686cc651ff2e6d4d22ed6e9b6f86b38311b405b47b2abdf3cb98eb4d", diff --git a/deno.lock b/deno.lock index 659cfb9..32641c6 100644 --- a/deno.lock +++ b/deno.lock @@ -19,8 +19,7 @@ "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/ende.ts": "00807d3602a65d5a6881c8fbb01d6886bf7a6640a2cc5c7c1bf00dd00b320ae7", "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/key.ts": "1830bb6eded80c71aeae6a94ce921dbf09fcdf4820a3b846f8e8d9e23ce17119", "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/nip19.ts": "880aa40c85bb770703b5e85d72f29fed96f21777dc17906017c385873aedfd44", - "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/nostr.ts": "6d4b0bde3978bdc3d6cdc802a6f51e2391cb7257cac3aa80a6e70212b11b18a1", - "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/relay-list.test.ts": "93c319f991c03c4a62d080960c83fc17542c0f593344ca37c9e56cad7428de2a", + "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/nostr.ts": "aeac23272327a1a0c576aaa66a040497474ec0d325fa27bbb112b2b36110abb3", "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/relay.ts": "93c5c6fe196dc9cae7c0e82ee8057a5350f77e69ae7d395fdb141a25b2664739", "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/scure.js": "fbc4be16918272bd167fff1184a7f5bbd1a676bad2a73130bb530d78df893a99", "https://raw.githubusercontent.com/BlowaterNostr/nostr.ts/main/vendor/esm.sh/v106/@noble/secp256k1@1.7.1/es2022/secp256k1.js": "69e32f6c686cc651ff2e6d4d22ed6e9b6f86b38311b405b47b2abdf3cb98eb4d", diff --git a/makefile b/makefile index a8dfd0c..2d85941 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,5 @@ file = * coverage_dir = cov_profile -run: - deno run --allow-net test.ts - test: clear-coverage deno test --config=deno.json --coverage=$(coverage_dir) --allow-net --allow-read --allow-env --trace-ops *.test.ts **/*.test.ts diff --git a/nostr.ts b/nostr.ts index 853a5eb..d536393 100644 --- a/nostr.ts +++ b/nostr.ts @@ -30,8 +30,8 @@ type Tags = { root?: [nostr.EventID, RelayURL, "root"]; } & nostr.Tags; -type Event = nostr.NostrEvent; -type UnsignedEvent = nostr.UnsignedNostrEvent; +type Event = nostr.NostrEvent; +type UnsignedEvent = nostr.UnsignedNostrEvent; export function getTags(event: Event): Tags { const tags: Tags = { @@ -216,7 +216,7 @@ export function compare(a: ParsedTag_Nostr_Event, b: ParsedTag_Nostr_Event) { return a.created_at - b.created_at; } -export type ParsedTag_Nostr_Event = nostr.NostrEvent & { +export type ParsedTag_Nostr_Event = nostr.NostrEvent & { readonly parsedTags: Tags; }; export function computeThreads(events: ParsedTag_Nostr_Event[]) { @@ -276,61 +276,15 @@ export function computeThreads(events: ParsedTag_Nostr_Event[]) { return Array.from(resMap.values()); } -export interface Signed_CustomAppData_Typed_Event { - readonly id: nostr.EventID; - readonly sig: string; - readonly pubkey: string; - readonly kind: nostr.NostrKind.CustomAppData; - readonly created_at: number; - readonly tags: Tag[]; - readonly content: CustomAppData; -} - -export interface Unsigned_CustomAppData_Typed_Event { - readonly pubkey: string; - readonly kind: nostr.NostrKind.CustomAppData; - readonly created_at: number; - readonly content: CustomAppData; -} - -export type Decrypted_Nostr_Event = { - readonly id: nostr.EventID; - readonly sig: string; - readonly pubkey: string; - readonly kind: nostr.NostrKind.CustomAppData; - readonly created_at: number; - readonly tags: Tag[]; - readonly parsedTags: Tags; - readonly content: string; +export type Decrypted_Nostr_Event = ParsedTag_Nostr_Event & { readonly decryptedContent: string; }; -export type Decryptable_Nostr_Event = { - readonly id: nostr.EventID; - readonly sig: string; - readonly pubkey: string; - readonly kind: nostr.NostrKind.CustomAppData; - readonly created_at: number; - readonly tags: Tag[]; - readonly content: string; -}; +export type Decryptable_Nostr_Event = nostr.NostrEvent; -export type PlainText_Nostr_Event = { - readonly id: nostr.EventID; - readonly sig: string; - readonly pubkey: string; - readonly kind: - | NostrKind.DIRECT_MESSAGE - | NostrKind.CONTACTS - | NostrKind.DELETE - | NostrKind.META_DATA - | NostrKind.TEXT_NOTE - | NostrKind.RECOMMED_SERVER; - readonly created_at: number; - readonly tags: Tag[]; - readonly parsedTags: Tags; - readonly content: string; -}; +export type PlainText_Nostr_Event = ParsedTag_Nostr_Event< + Exclude +>; export type CustomAppData = PinContact | UnpinContact | UserLogin; export type PinContact = {