@qntx/nostr 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/abort-Ba8tDrOI.mjs +38 -0
- package/dist/abort-Ba8tDrOI.mjs.map +1 -0
- package/dist/{builder-BphJa-Y-.d.mts → builder-BWn55Paf.d.mts} +20 -14
- package/dist/{builder-q0VsvnYE.mjs → builder-CyrGKRVP.mjs} +32 -16
- package/dist/builder-CyrGKRVP.mjs.map +1 -0
- package/dist/{client-Bd8B1mYm.mjs → client-5DhgYV7P.mjs} +372 -195
- package/dist/client-5DhgYV7P.mjs.map +1 -0
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +1 -1
- package/dist/core.d.mts +8 -8
- package/dist/core.mjs +8 -9
- package/dist/error-BW7re1UN.d.mts +9 -0
- package/dist/error-B__OMBRY.mjs +14 -0
- package/dist/error-B__OMBRY.mjs.map +1 -0
- package/dist/{error-WEFS-R-4.d.mts → error-CR8Urc84.d.mts} +20 -8
- package/dist/{error-CwBxle6N.mjs → error-DrEIM7FO.mjs} +5 -3
- package/dist/error-DrEIM7FO.mjs.map +1 -0
- package/dist/{event-CzoQEFMF.mjs → event-D8Nfoh4K.mjs} +40 -32
- package/dist/event-D8Nfoh4K.mjs.map +1 -0
- package/dist/{event-B5D2jxt_.d.mts → event-fU3Y01PR.d.mts} +23 -20
- package/dist/{filter-BxwjEkZp.mjs → filter-BQl3GlHt.mjs} +42 -35
- package/dist/filter-BQl3GlHt.mjs.map +1 -0
- package/dist/filter-C0IMByE3.d.mts +37 -0
- package/dist/{gossip-C5RVB1UB.d.mts → gossip-BRQwIM_q.d.mts} +25 -23
- package/dist/{gossip-3xkRRCm_.mjs → gossip-oloDMWEj.mjs} +52 -34
- package/dist/gossip-oloDMWEj.mjs.map +1 -0
- package/dist/gossip.d.mts +1 -1
- package/dist/gossip.mjs +1 -1
- package/dist/{http-6vevbBlu.d.mts → http-C4HwIu4B.d.mts} +7 -7
- package/dist/{http-D2rhokZo.mjs → http-CuazNRIP.mjs} +10 -6
- package/dist/http-CuazNRIP.mjs.map +1 -0
- package/dist/index-B-CGNDPS.d.mts +207 -0
- package/dist/index-BIhSADwK.d.mts +339 -0
- package/dist/{index-BYMnhRIC.d.mts → index-Ba7bJ7DD.d.mts} +68 -50
- package/dist/{index-DaRyjo7O.d.mts → index-Boe8FshM.d.mts} +13 -7
- package/dist/index-D-TK_KJG.d.mts +84 -0
- package/dist/index-D1bqFHKB.d.mts +188 -0
- package/dist/index.d.mts +22 -20
- package/dist/index.mjs +19 -18
- package/dist/{key-Dn-aX4x4.mjs → key-Bbtys6o7.mjs} +22 -14
- package/dist/key-Bbtys6o7.mjs.map +1 -0
- package/dist/{key-BiGxGLhg.d.mts → key-BlsYhN1V.d.mts} +9 -6
- package/dist/{kind-BLl4cLOc.mjs → kind-Cxwhhkx8.mjs} +2 -1
- package/dist/kind-Cxwhhkx8.mjs.map +1 -0
- package/dist/{loaders-BNQszDAn.mjs → loaders-o6YXB_Ri.mjs} +329 -305
- package/dist/loaders-o6YXB_Ri.mjs.map +1 -0
- package/dist/loaders.d.mts +3 -3
- package/dist/loaders.mjs +2 -2
- package/dist/memory-C2EVx0_O.mjs +46 -0
- package/dist/memory-C2EVx0_O.mjs.map +1 -0
- package/dist/{memory-BCmhZPek.mjs → memory-index-Do1mz0WF.mjs} +212 -82
- package/dist/memory-index-Do1mz0WF.mjs.map +1 -0
- package/dist/{message-C_Uj-Y-c.mjs → message-DcY6Fi9o.mjs} +38 -24
- package/dist/message-DcY6Fi9o.mjs.map +1 -0
- package/dist/{message-DJC-Jz6T.d.mts → message-iGPIqnn0.d.mts} +15 -8
- package/dist/{nip17-BWq-Kfq5.d.mts → nip17-DNEkz8rM.d.mts} +18 -17
- package/dist/{nip19-D7905oIv.d.mts → nip19-BevCJZsp.d.mts} +23 -3
- package/dist/{nip46-C_DoxiS_.d.mts → nip46-DDV4dC56.d.mts} +13 -12
- package/dist/{nip59-DljW_sYh.d.mts → nip59-zQgdLcEr.d.mts} +28 -25
- package/dist/{nip65-Di5hZRuV.d.mts → nip65-DBfh2smt.d.mts} +8 -3
- package/dist/{nip77-ByxlgoQO.d.mts → nip77-DH4RhS5r.d.mts} +9 -8
- package/dist/nips/blossom.d.mts +37 -37
- package/dist/nips/blossom.mjs +67 -52
- package/dist/nips/blossom.mjs.map +1 -1
- package/dist/nips/nip04.d.mts +2 -3
- package/dist/nips/nip04.mjs +6 -10
- package/dist/nips/nip04.mjs.map +1 -1
- package/dist/nips/nip05.d.mts +37 -43
- package/dist/nips/nip05.mjs +57 -57
- package/dist/nips/nip05.mjs.map +1 -1
- package/dist/nips/nip10.d.mts +18 -19
- package/dist/nips/nip10.mjs +76 -61
- package/dist/nips/nip10.mjs.map +1 -1
- package/dist/nips/nip11.d.mts +9 -8
- package/dist/nips/nip11.mjs +14 -11
- package/dist/nips/nip11.mjs.map +1 -1
- package/dist/nips/nip13.d.mts +9 -9
- package/dist/nips/nip13.mjs +15 -17
- package/dist/nips/nip13.mjs.map +1 -1
- package/dist/nips/nip17.d.mts +1 -1
- package/dist/nips/nip17.mjs +17 -12
- package/dist/nips/nip17.mjs.map +1 -1
- package/dist/nips/nip19.d.mts +1 -1
- package/dist/nips/nip19.mjs +52 -29
- package/dist/nips/nip19.mjs.map +1 -1
- package/dist/nips/nip21.d.mts +5 -6
- package/dist/nips/nip21.mjs +8 -7
- package/dist/nips/nip21.mjs.map +1 -1
- package/dist/nips/nip27.d.mts +7 -8
- package/dist/nips/nip27.mjs +26 -25
- package/dist/nips/nip27.mjs.map +1 -1
- package/dist/nips/nip42.d.mts +5 -6
- package/dist/nips/nip42.mjs +3 -3
- package/dist/nips/nip42.mjs.map +1 -1
- package/dist/nips/nip44.d.mts +24 -7
- package/dist/nips/nip44.mjs +25 -15
- package/dist/nips/nip44.mjs.map +1 -1
- package/dist/nips/nip46.d.mts +1 -1
- package/dist/nips/nip46.mjs +52 -49
- package/dist/nips/nip46.mjs.map +1 -1
- package/dist/nips/nip49.d.mts +8 -7
- package/dist/nips/nip49.mjs +16 -12
- package/dist/nips/nip49.mjs.map +1 -1
- package/dist/nips/nip51.d.mts +25 -27
- package/dist/nips/nip51.mjs +47 -36
- package/dist/nips/nip51.mjs.map +1 -1
- package/dist/nips/nip57.d.mts +12 -13
- package/dist/nips/nip57.mjs +35 -38
- package/dist/nips/nip57.mjs.map +1 -1
- package/dist/nips/nip59.d.mts +1 -1
- package/dist/nips/nip59.mjs +14 -18
- package/dist/nips/nip59.mjs.map +1 -1
- package/dist/nips/nip65.d.mts +1 -1
- package/dist/nips/nip65.mjs +11 -8
- package/dist/nips/nip65.mjs.map +1 -1
- package/dist/nips/nip77.d.mts +1 -1
- package/dist/nips/nip77.mjs +56 -34
- package/dist/nips/nip77.mjs.map +1 -1
- package/dist/nips/nip96.d.mts +21 -12
- package/dist/nips/nip96.mjs +59 -36
- package/dist/nips/nip96.mjs.map +1 -1
- package/dist/nips/nip98.d.mts +12 -12
- package/dist/nips/nip98.mjs +18 -19
- package/dist/nips/nip98.mjs.map +1 -1
- package/dist/pool-B7p_reAm.d.mts +333 -0
- package/dist/{pool-C_j1OmBB.mjs → pool-C2xOcsun.mjs} +792 -568
- package/dist/pool-C2xOcsun.mjs.map +1 -0
- package/dist/reactive-DDlThDSZ.mjs +324 -0
- package/dist/reactive-DDlThDSZ.mjs.map +1 -0
- package/dist/reactive-DFpqtIf_.d.mts +66 -0
- package/dist/relay.d.mts +5 -4
- package/dist/relay.mjs +2 -2
- package/dist/report-CHld4uWj.mjs +32 -0
- package/dist/report-CHld4uWj.mjs.map +1 -0
- package/dist/{signer-CZ6K6FUc.mjs → signer-CKR9EHce.mjs} +107 -72
- package/dist/signer-CKR9EHce.mjs.map +1 -0
- package/dist/signer.d.mts +3 -3
- package/dist/signer.mjs +3 -2
- package/dist/storage-xXxLGCVb.mjs +1376 -0
- package/dist/storage-xXxLGCVb.mjs.map +1 -0
- package/dist/storage.d.mts +4 -4
- package/dist/storage.mjs +5 -4
- package/dist/store.d.mts +2 -0
- package/dist/store.mjs +2 -0
- package/dist/testing.d.mts +135 -0
- package/dist/testing.mjs +963 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/types-2pCUprRU.d.mts +47 -0
- package/dist/types-CRQEk0Oi.d.mts +19 -0
- package/dist/util-LfQirgDk.mjs +113 -0
- package/dist/util-LfQirgDk.mjs.map +1 -0
- package/dist/wasm.d.mts +4 -4
- package/dist/wasm.mjs +54 -55
- package/dist/wasm.mjs.map +1 -1
- package/dist/websocket-CmeqvAkp.d.mts +27 -0
- package/package.json +93 -39
- package/dist/builder-q0VsvnYE.mjs.map +0 -1
- package/dist/client-Bd8B1mYm.mjs.map +0 -1
- package/dist/error-B49rbDzT.d.mts +0 -7
- package/dist/error-CwBxle6N.mjs.map +0 -1
- package/dist/error-DZEs5OuZ.mjs +0 -24
- package/dist/error-DZEs5OuZ.mjs.map +0 -1
- package/dist/event-CzoQEFMF.mjs.map +0 -1
- package/dist/filter-BxwjEkZp.mjs.map +0 -1
- package/dist/filter-DUEKP3q1.d.mts +0 -40
- package/dist/gossip-3xkRRCm_.mjs.map +0 -1
- package/dist/http-D2rhokZo.mjs.map +0 -1
- package/dist/index-C0C4e-Gn.d.mts +0 -55
- package/dist/index-DgOugrpF.d.mts +0 -275
- package/dist/index-EwL6fHLo.d.mts +0 -267
- package/dist/index-k2YhCgsh.d.mts +0 -57
- package/dist/key-Dn-aX4x4.mjs.map +0 -1
- package/dist/kind-BLl4cLOc.mjs.map +0 -1
- package/dist/loaders-BNQszDAn.mjs.map +0 -1
- package/dist/memory-BCmhZPek.mjs.map +0 -1
- package/dist/message-C_Uj-Y-c.mjs.map +0 -1
- package/dist/pool-C_j1OmBB.mjs.map +0 -1
- package/dist/pool-DhRi7l-b.d.mts +0 -297
- package/dist/signer-CZ6K6FUc.mjs.map +0 -1
- package/dist/storage-DOy0iLRE.mjs +0 -870
- package/dist/storage-DOy0iLRE.mjs.map +0 -1
- package/dist/types-BzyADqnw.d.mts +0 -19
- package/dist/types-Dn24TPFs.d.mts +0 -43
- package/dist/util-6tfLQ9JF.mjs +0 -73
- package/dist/util-6tfLQ9JF.mjs.map +0 -1
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { n as EventTemplate, r as UnsignedEvent, t as Event } from "./event-
|
|
2
|
-
import { r as SecretKey, t as Keys } from "./key-
|
|
3
|
-
import { t as Filter } from "./filter-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { n as EventTemplate, r as UnsignedEvent, t as Event } from "./event-fU3Y01PR.mjs";
|
|
2
|
+
import { r as SecretKey, t as Keys } from "./key-BlsYhN1V.mjs";
|
|
3
|
+
import { t as Filter } from "./filter-C0IMByE3.mjs";
|
|
4
|
+
import { a as NostrError } from "./error-CR8Urc84.mjs";
|
|
5
|
+
import { t as NostrSigner } from "./types-CRQEk0Oi.mjs";
|
|
6
|
+
import { n as BunkerPointer, r as ClientMetadata } from "./nip46-DDV4dC56.mjs";
|
|
7
|
+
//#region src/signer/error.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Thrown by a lazy NIP-42 AUTH sign function when no signer is configured at challenge time.
|
|
10
|
+
* {@link import("../relay/relay.ts").Relay} catches it and ignores the challenge: no AUTH frame is
|
|
11
|
+
* sent and the connection stays open.
|
|
12
|
+
*/
|
|
13
|
+
declare class NoSignerError extends NostrError {
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
6
17
|
//#region src/signer/keys.d.ts
|
|
7
18
|
/** Local secret-key signer with NIP-04 (legacy) and NIP-44 support. */
|
|
8
19
|
declare class KeysSigner implements NostrSigner {
|
|
@@ -20,18 +31,19 @@ declare class KeysSigner implements NostrSigner {
|
|
|
20
31
|
//#region src/signer/nip07.d.ts
|
|
21
32
|
/**
|
|
22
33
|
* Minimal NIP-07 provider surface (browser extension `window.nostr`).
|
|
34
|
+
*
|
|
23
35
|
* @see https://github.com/nostr-protocol/nips/blob/master/07.md
|
|
24
36
|
*/
|
|
25
37
|
type WindowNostr = {
|
|
26
|
-
getPublicKey()
|
|
27
|
-
signEvent(event: EventTemplate)
|
|
38
|
+
getPublicKey: () => Promise<string>;
|
|
39
|
+
signEvent: (event: EventTemplate) => Promise<Event>;
|
|
28
40
|
nip04?: {
|
|
29
|
-
encrypt(pubkey: string, plaintext: string)
|
|
30
|
-
decrypt(pubkey: string, ciphertext: string)
|
|
41
|
+
encrypt: (pubkey: string, plaintext: string) => Promise<string>;
|
|
42
|
+
decrypt: (pubkey: string, ciphertext: string) => Promise<string>;
|
|
31
43
|
};
|
|
32
44
|
nip44?: {
|
|
33
|
-
encrypt(pubkey: string, plaintext: string)
|
|
34
|
-
decrypt(pubkey: string, ciphertext: string)
|
|
45
|
+
encrypt: (pubkey: string, plaintext: string) => Promise<string>;
|
|
46
|
+
decrypt: (pubkey: string, ciphertext: string) => Promise<string>;
|
|
35
47
|
};
|
|
36
48
|
};
|
|
37
49
|
/** Resolve `window.nostr` / `globalThis.nostr` when present. */
|
|
@@ -39,8 +51,8 @@ declare function getWindowNostr(): WindowNostr | undefined;
|
|
|
39
51
|
/** True when a NIP-07 provider is injected in the current environment. */
|
|
40
52
|
declare function isNip07Available(): boolean;
|
|
41
53
|
/**
|
|
42
|
-
* Signer backed by a NIP-07 browser extension (or any injected provider).
|
|
43
|
-
*
|
|
54
|
+
* Signer backed by a NIP-07 browser extension (or any injected provider). Never holds secret keys
|
|
55
|
+
* in-process.
|
|
44
56
|
*/
|
|
45
57
|
declare class Nip07Signer implements NostrSigner {
|
|
46
58
|
#private;
|
|
@@ -56,56 +68,62 @@ declare class Nip07Signer implements NostrSigner {
|
|
|
56
68
|
//#region src/signer/nip46.d.ts
|
|
57
69
|
/** Subscribe options used by NIP-46 transport (structural subset of Pool). */
|
|
58
70
|
type Nip46SubscribeOptions = {
|
|
59
|
-
signal?: AbortSignal;
|
|
60
|
-
onevent?: (event: Event) => void;
|
|
61
|
-
onclose?: (reason: string) => void;
|
|
71
|
+
signal?: AbortSignal | undefined;
|
|
72
|
+
onevent?: ((event: Event) => void) | undefined;
|
|
73
|
+
onclose?: ((reason: string) => void) | undefined;
|
|
62
74
|
};
|
|
63
75
|
/**
|
|
64
|
-
* Structural relay transport for NIP-46 RPC.
|
|
65
|
-
*
|
|
66
|
-
* so `signer` never imports `relay` (ADR-0001).
|
|
76
|
+
* Structural relay transport for NIP-46 RPC. Satisfied by {@link import("../relay/pool.ts").Pool};
|
|
77
|
+
* constructed above the signer layer so `signer` never imports `relay` (ADR-0001).
|
|
67
78
|
*/
|
|
68
79
|
type Nip46Transport = {
|
|
69
|
-
subscribe(relays: string[], filters: Filter[], opts?: Nip46SubscribeOptions)
|
|
80
|
+
subscribe: (relays: string[], filters: Filter[], opts?: Nip46SubscribeOptions) => {
|
|
70
81
|
close: (reason?: string) => void;
|
|
71
82
|
};
|
|
72
|
-
publish(relays: string[], event: Event)
|
|
73
|
-
|
|
83
|
+
publish: (relays: string[], event: Event) => Promise<ReadonlyArray<{
|
|
84
|
+
result?: {
|
|
85
|
+
ok: boolean;
|
|
86
|
+
message: string;
|
|
87
|
+
};
|
|
88
|
+
error?: string;
|
|
89
|
+
}>>;
|
|
90
|
+
close: (urls?: string[]) => void;
|
|
74
91
|
};
|
|
92
|
+
/** Options for {@link Nip46Signer}: transport, timeouts, and relay hints. */
|
|
75
93
|
type Nip46SignerOptions = {
|
|
76
|
-
/**
|
|
77
|
-
* Shared transport. When set, the signer does not close it on {@link Nip46Signer.close}.
|
|
78
|
-
*/
|
|
94
|
+
/** Shared transport. When set, the signer does not close it on {@link Nip46Signer.close}. */
|
|
79
95
|
pool?: Nip46Transport;
|
|
80
96
|
/**
|
|
81
|
-
* Factory for a private transport when `pool` is omitted.
|
|
82
|
-
*
|
|
97
|
+
* Factory for a private transport when `pool` is omitted. Typical: `() => new Pool({
|
|
98
|
+
* websocketImplementation, enableReconnect: true })`.
|
|
83
99
|
*/
|
|
84
100
|
createPool?: () => Nip46Transport;
|
|
85
101
|
/**
|
|
86
|
-
* Relays used when the bunker pointer has none, and merged uniquely onto a
|
|
87
|
-
*
|
|
102
|
+
* Relays used when the bunker pointer has none, and merged uniquely onto a nonempty pointer
|
|
103
|
+
* (pointer first).
|
|
88
104
|
*/
|
|
89
105
|
relays?: string[];
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
*/
|
|
93
|
-
secret?: string | null;
|
|
106
|
+
/** Bunker connection secret when the pointer or bunker:// URL has none. */
|
|
107
|
+
secret?: string | undefined;
|
|
94
108
|
/** Local client key used to encrypt RPC (not the remote user key). */
|
|
95
109
|
clientSecretKey?: SecretKey | Uint8Array | string;
|
|
96
110
|
/** Called when bunker returns `auth_url` for a pending request. */
|
|
97
111
|
onAuthUrl?: (url: string) => void;
|
|
98
112
|
/** Per-request timeout in ms. Default 30s. */
|
|
99
113
|
timeoutMs?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Timeout in ms applied after the bunker replies `auth_url`: the request keeps waiting for the
|
|
116
|
+
* real response until this elapses. Default 300s.
|
|
117
|
+
*/
|
|
118
|
+
authTimeoutMs?: number;
|
|
100
119
|
/** Requested permissions sent with `connect` (`method[:kind]` list). */
|
|
101
120
|
perms?: string[];
|
|
102
121
|
/** Client metadata sent with bunker-initiated `connect`. */
|
|
103
122
|
metadata?: ClientMetadata;
|
|
104
123
|
};
|
|
105
124
|
/**
|
|
106
|
-
* NIP-46 remote signer (bunker / nostrconnect).
|
|
107
|
-
*
|
|
108
|
-
* Network I/O is injected via {@link Nip46Transport} (no relay import).
|
|
125
|
+
* NIP-46 remote signer (bunker / nostrconnect). Implements {@link NostrSigner}; never holds the
|
|
126
|
+
* remote user's secret key. Network I/O is injected via {@link Nip46Transport} (no relay import).
|
|
109
127
|
*/
|
|
110
128
|
declare class Nip46Signer implements NostrSigner {
|
|
111
129
|
#private;
|
|
@@ -113,23 +131,23 @@ declare class Nip46Signer implements NostrSigner {
|
|
|
113
131
|
get bunker(): Readonly<BunkerPointer>;
|
|
114
132
|
get clientPublicKey(): string;
|
|
115
133
|
/**
|
|
116
|
-
* Subscribe to an already-known bunker pointer. Does not send the `connect` RPC
|
|
117
|
-
*
|
|
118
|
-
*
|
|
134
|
+
* Subscribe to an already-known bunker pointer. Does not send the `connect` RPC (reconnect
|
|
135
|
+
* without a new handshake). Requires `clientSecretKey` — reconnect must reuse the original client
|
|
136
|
+
* identity.
|
|
119
137
|
*/
|
|
120
138
|
static fromBunker(pointer: BunkerPointer, opts: Nip46SignerOptions & {
|
|
121
139
|
clientSecretKey: SecretKey | Uint8Array | string;
|
|
122
140
|
}): Nip46Signer;
|
|
123
141
|
/**
|
|
124
|
-
* Connect using a `bunker://` URL or pre-parsed pointer.
|
|
125
|
-
*
|
|
126
|
-
*
|
|
142
|
+
* Connect using a `bunker://` URL or pre-parsed pointer. Invalid strings throw. A NIP-05
|
|
143
|
+
* identifier is not a bunker pointer. When both pointer and `opts.relays` are nonempty, unique
|
|
144
|
+
* `opts.relays` are appended.
|
|
127
145
|
*/
|
|
128
146
|
static connect(input: string | BunkerPointer, opts?: Nip46SignerOptions): Promise<Nip46Signer>;
|
|
129
147
|
/**
|
|
130
|
-
* Wait for a bunker to complete a client-initiated `nostrconnect://` handshake.
|
|
131
|
-
*
|
|
132
|
-
*
|
|
148
|
+
* Wait for a bunker to complete a client-initiated `nostrconnect://` handshake. Requires
|
|
149
|
+
* `clientSecretKey` whose pubkey matches the URI client pubkey (build the URI with
|
|
150
|
+
* {@link createNostrConnectURI} after generating keys).
|
|
133
151
|
*/
|
|
134
152
|
static fromNostrConnectURI(connectionURI: string, opts: Nip46SignerOptions & {
|
|
135
153
|
clientSecretKey: SecretKey | Uint8Array | string;
|
|
@@ -141,10 +159,10 @@ declare class Nip46Signer implements NostrSigner {
|
|
|
141
159
|
perms?: string[];
|
|
142
160
|
}): Promise<void>;
|
|
143
161
|
/**
|
|
144
|
-
* Ask the bunker for its preferred relay list and resubscribe when it changes.
|
|
145
|
-
*
|
|
162
|
+
* Ask the bunker for its preferred relay list and resubscribe when it changes. Spec result is a
|
|
163
|
+
* JSON array of URLs, or `null` when nothing changes.
|
|
146
164
|
*/
|
|
147
|
-
switchRelays(): Promise<string[] |
|
|
165
|
+
switchRelays(): Promise<string[] | undefined>;
|
|
148
166
|
/** Courtesy session teardown. Always closes the local signer afterwards. */
|
|
149
167
|
logout(): Promise<void>;
|
|
150
168
|
ping(): Promise<void>;
|
|
@@ -157,5 +175,5 @@ declare class Nip46Signer implements NostrSigner {
|
|
|
157
175
|
close(): Promise<void>;
|
|
158
176
|
}
|
|
159
177
|
//#endregion
|
|
160
|
-
export { Nip07Signer as a, isNip07Available as c, Nip46Transport as i, KeysSigner as l, Nip46SignerOptions as n, WindowNostr as o, Nip46SubscribeOptions as r, getWindowNostr as s, Nip46Signer as t };
|
|
161
|
-
//# sourceMappingURL=index-
|
|
178
|
+
export { Nip07Signer as a, isNip07Available as c, Nip46Transport as i, KeysSigner as l, Nip46SignerOptions as n, WindowNostr as o, Nip46SubscribeOptions as r, getWindowNostr as s, Nip46Signer as t, NoSignerError as u };
|
|
179
|
+
//# sourceMappingURL=index-Ba7bJ7DD.d.mts.map
|
|
@@ -11,20 +11,22 @@ declare const SECRET_KEY_BYTES = 32;
|
|
|
11
11
|
declare const SUBSCRIPTION_ID_MAX_CHARS = 64;
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/core/util.d.ts
|
|
14
|
-
declare const utf8Encoder: import("node:util").TextEncoder;
|
|
15
|
-
declare const utf8Decoder: import("node:util").TextDecoder;
|
|
16
14
|
/** Lowercase hex encode. */
|
|
17
15
|
declare function bytesToHex(bytes: Uint8Array): string;
|
|
18
16
|
/** Decode lowercase or mixed-case hex to bytes. */
|
|
19
17
|
declare function hexToBytes(hex: string): Uint8Array;
|
|
20
|
-
/** True when value is
|
|
18
|
+
/** True when value is canonical NIP-01 lowercase hex of 32 bytes (64 chars). */
|
|
21
19
|
declare function isHex32(value: string): boolean;
|
|
22
|
-
/** True when value is
|
|
20
|
+
/** True when value is canonical NIP-01 lowercase hex of 64 bytes (128 chars). */
|
|
23
21
|
declare function isHex64(value: string): boolean;
|
|
22
|
+
/** Caller input of any case: lowercases first, then requires canonical hex shape. */
|
|
24
23
|
declare function assertHex32(value: string, label: string): string;
|
|
25
24
|
declare function assertSecretKeyBytes(bytes: Uint8Array): void;
|
|
26
25
|
/**
|
|
27
|
-
* Normalize a relay URL to a stable form
|
|
26
|
+
* Normalize a relay URL to a stable form: `http:`/`https:` are rewritten to `ws:`/`wss:` (a bare
|
|
27
|
+
* host gets `wss://`), any other scheme throws UrlError. The result has a lowercased host, the
|
|
28
|
+
* default port removed, duplicate path slashes collapsed, a sorted query, and no fragment. `URL`
|
|
29
|
+
* serialization keeps a trailing `/` on the root path (`wss://a.example/`).
|
|
28
30
|
*/
|
|
29
31
|
declare function normalizeURL(url: string): string;
|
|
30
32
|
//#endregion
|
|
@@ -37,7 +39,9 @@ declare function isReplaceableKind(kind: number): boolean;
|
|
|
37
39
|
declare function isEphemeralKind(kind: number): boolean;
|
|
38
40
|
/** Addressable (parameterized replaceable): latest per (pubkey, kind, d-tag) wins. */
|
|
39
41
|
declare function isAddressableKind(kind: number): boolean;
|
|
42
|
+
/** NIP-01 kind classes: regular / replaceable / ephemeral / addressable. */
|
|
40
43
|
type KindClassification = "regular" | "replaceable" | "ephemeral" | "addressable" | "unknown";
|
|
44
|
+
/** Classify a kind number into its NIP-01 storage class (`"unknown"` outside all ranges). */
|
|
41
45
|
declare function classifyKind(kind: number): KindClassification;
|
|
42
46
|
/** Kind numbers used by this package. */
|
|
43
47
|
declare const Kind: {
|
|
@@ -70,8 +74,10 @@ declare const Kind: {
|
|
|
70
74
|
readonly EmojiSet: 30030;
|
|
71
75
|
readonly StarterPack: 39089;
|
|
72
76
|
};
|
|
77
|
+
/** Name of a kind constant on {@link Kind}. */
|
|
73
78
|
type KindName = keyof typeof Kind;
|
|
79
|
+
/** Union of the numeric kind values on {@link Kind}. */
|
|
74
80
|
type KnownKind = (typeof Kind)[KindName];
|
|
75
81
|
//#endregion
|
|
76
|
-
export {
|
|
77
|
-
//# sourceMappingURL=index-
|
|
82
|
+
export { EVENT_ID_BYTES as _, classifyKind as a, SIGNATURE_BYTES as b, isRegularKind as c, assertSecretKeyBytes as d, bytesToHex as f, normalizeURL as g, isHex64 as h, KnownKind as i, isReplaceableKind as l, isHex32 as m, KindClassification as n, isAddressableKind as o, hexToBytes as p, KindName as r, isEphemeralKind as s, Kind as t, assertHex32 as u, PUBLIC_KEY_BYTES as v, SUBSCRIPTION_ID_MAX_CHARS as x, SECRET_KEY_BYTES as y };
|
|
83
|
+
//# sourceMappingURL=index-Boe8FshM.d.mts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { t as Event } from "./event-fU3Y01PR.mjs";
|
|
2
|
+
import { t as Filter } from "./filter-C0IMByE3.mjs";
|
|
3
|
+
import { a as NostrError } from "./error-CR8Urc84.mjs";
|
|
4
|
+
import { n as Pool } from "./pool-B7p_reAm.mjs";
|
|
5
|
+
//#region src/relay/error.d.ts
|
|
6
|
+
/** Base class for relay errors; carries the relay URL when known. */
|
|
7
|
+
declare class RelayError extends NostrError {
|
|
8
|
+
name: string;
|
|
9
|
+
readonly url: string | undefined;
|
|
10
|
+
constructor(message: string, url?: string, options?: ErrorOptions);
|
|
11
|
+
}
|
|
12
|
+
/** A relay connection attempt or socket failed. */
|
|
13
|
+
declare class RelayConnectionError extends RelayError {
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
/** A relay answered an EVENT with `ok: false`. */
|
|
17
|
+
declare class RelayPublishError extends RelayError {
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
/** A subscription was closed by the relay (`CLOSED`) or the socket dropped. */
|
|
21
|
+
declare class RelayClosedError extends RelayError {
|
|
22
|
+
name: string;
|
|
23
|
+
}
|
|
24
|
+
/** A relay operation exceeded its deadline. */
|
|
25
|
+
declare class RelayTimeoutError extends RelayError {
|
|
26
|
+
name: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A relay was suspended for delivering more events that fail id/signature verification than its
|
|
30
|
+
* {@link PoolOptions.invalidEventPolicy} allows. Carries `until`, the epoch-ms time when the relay
|
|
31
|
+
* may connect again.
|
|
32
|
+
*/
|
|
33
|
+
declare class RelaySuspendedError extends RelayError {
|
|
34
|
+
name: string;
|
|
35
|
+
/** Epoch milliseconds when the suspension lifts. */
|
|
36
|
+
readonly until: number;
|
|
37
|
+
constructor(url: string, until: number);
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/relay/url.d.ts
|
|
41
|
+
/**
|
|
42
|
+
* True for `ws:` / `http:` URLs that are not `.onion`. Local-network `ws://` is still insecure;
|
|
43
|
+
* allow those via a trusted set.
|
|
44
|
+
*/
|
|
45
|
+
declare function isInsecureRelayUrl(url: string): boolean;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/relay/fan-in.d.ts
|
|
48
|
+
type RoutedJob = {
|
|
49
|
+
urls: ReadonlyArray<string>;
|
|
50
|
+
filters: ReadonlyArray<Filter>;
|
|
51
|
+
id?: string | undefined;
|
|
52
|
+
};
|
|
53
|
+
type FanInOptions = {
|
|
54
|
+
/** First receipt only (deduped across jobs). `relayUrl` is the normalized relay URL. */
|
|
55
|
+
onevent?: ((event: Event, relayUrl: string) => void) | undefined;
|
|
56
|
+
oneose?: (() => void) | undefined;
|
|
57
|
+
onclose?: ((reason: string) => void) | undefined;
|
|
58
|
+
signal?: AbortSignal | undefined;
|
|
59
|
+
/** Armed at fan-in only. Never forwarded to relay.subscribe. */
|
|
60
|
+
eoseTimeoutMs?: number | undefined;
|
|
61
|
+
alreadyHaveEvent?: ((id: string) => boolean) | undefined;
|
|
62
|
+
/** Every receipt from every relay, including skipped duplicates. */
|
|
63
|
+
receivedEvent?: ((id: string, relayUrl: string) => void) | undefined;
|
|
64
|
+
closeOnEose?: boolean | undefined;
|
|
65
|
+
/** Optional. ensureRelay uses Pool.#opts.connectTimeoutMs when omitted. */
|
|
66
|
+
connectTimeoutMs?: number | undefined;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Aggregate EOSE/close across routed jobs. One `seen` set. `pending` counts URL list entries
|
|
70
|
+
* (duplicates included). `pendingEose` counts unique `jobIndex:url` keys.
|
|
71
|
+
*/
|
|
72
|
+
declare function fanIn(pool: Pool, jobs: ReadonlyArray<RoutedJob>, opts?: FanInOptions): {
|
|
73
|
+
close: (reason?: string) => void;
|
|
74
|
+
};
|
|
75
|
+
declare function fetchRouted(pool: Pool, jobs: ReadonlyArray<RoutedJob>, opts?: {
|
|
76
|
+
timeoutMs?: number | undefined;
|
|
77
|
+
signal?: AbortSignal | undefined;
|
|
78
|
+
connectTimeoutMs?: number | undefined;
|
|
79
|
+
/** Every event of every relay batch, including cross-relay duplicates. */
|
|
80
|
+
onevent?: ((event: Event, relayUrl: string) => void) | undefined;
|
|
81
|
+
}): Promise<Event[]>;
|
|
82
|
+
//#endregion
|
|
83
|
+
export { isInsecureRelayUrl as a, RelayError as c, RelayTimeoutError as d, fetchRouted as i, RelayPublishError as l, RoutedJob as n, RelayClosedError as o, fanIn as r, RelayConnectionError as s, FanInOptions as t, RelaySuspendedError as u };
|
|
84
|
+
//# sourceMappingURL=index-D-TK_KJG.d.mts.map
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { t as Event } from "./event-fU3Y01PR.mjs";
|
|
2
|
+
import { t as Filter } from "./filter-C0IMByE3.mjs";
|
|
3
|
+
import { i as PutResult, n as NegentropyItem, r as OutboxBound, t as EventStore } from "./types-2pCUprRU.mjs";
|
|
4
|
+
//#region src/storage/memory-index.d.ts
|
|
5
|
+
type MemoryIndexOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* FIFO cap applied independently to each deletion-state collection: tombstoned event ids, pending
|
|
8
|
+
* e-tag ids, and coordinate tombstones. Default unbounded. Trade-off: once an entry is trimmed, a
|
|
9
|
+
* re-arriving old deleted event or replaceable version can be accepted again.
|
|
10
|
+
*/
|
|
11
|
+
maxTombstones?: number;
|
|
12
|
+
/**
|
|
13
|
+
* FIFO cap on replaceable/addressable winner watermarks recorded by {@link evict}. A watermark
|
|
14
|
+
* keeps only `{ id, created_at }` per address so stale versions stay rejected after the winner's
|
|
15
|
+
* body is evicted, and a re-put of the watermarked id re-inserts it. Default 0 (no watermark
|
|
16
|
+
* retention); callers that evict should pass a bound. Once a watermark is trimmed, an older
|
|
17
|
+
* evicted version can be accepted again — the same trade-off as deletion tombstones.
|
|
18
|
+
*/
|
|
19
|
+
maxWatermarks?: number;
|
|
20
|
+
/** Fires after every physical index insert (accept, replace, deletion event). */
|
|
21
|
+
onInsert?: (event: Event) => void;
|
|
22
|
+
/** Fires after every physical index remove (replace, delete, evict, remove, clear). */
|
|
23
|
+
onRemove?: (event: Event) => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Synchronous in-memory event index with NIP-01 replaceable / addressable / ephemeral handling and
|
|
27
|
+
* NIP-09 deletion (kind 5) application. Shared by {@link MemoryEventStore} (async facade) and
|
|
28
|
+
* `ReactiveEventStore`.
|
|
29
|
+
*/
|
|
30
|
+
declare class MemoryIndex {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(opts?: MemoryIndexOptions);
|
|
33
|
+
put(raw: Event): PutResult;
|
|
34
|
+
/** Sequential `put` in input order. */
|
|
35
|
+
putMany(events: ReadonlyArray<Event>): PutResult[];
|
|
36
|
+
get(id: string): Event | undefined;
|
|
37
|
+
/** Current event at a `kind:pubkey:d` coordinate (replaceable or addressable). */
|
|
38
|
+
getByAddress(address: string): Event | undefined;
|
|
39
|
+
query(filters: ReadonlyArray<Filter>): Event[];
|
|
40
|
+
count(filters: ReadonlyArray<Filter>): number;
|
|
41
|
+
negentropyItems(filter: Filter): NegentropyItem[];
|
|
42
|
+
/** Remove by id and tombstone (like a local NIP-09). Returns removed count. */
|
|
43
|
+
remove(ids: ReadonlyArray<string>): number;
|
|
44
|
+
/**
|
|
45
|
+
* Remove by id without writing a tombstone (LRU eviction). When the evicted event is the current
|
|
46
|
+
* winner of a replaceable/addressable address, a `{ id, created_at }` watermark is recorded so
|
|
47
|
+
* stale versions stay rejected while the body is gone; the watermarks are FIFO-bounded by
|
|
48
|
+
* `maxWatermarks`.
|
|
49
|
+
*/
|
|
50
|
+
evict(ids: ReadonlyArray<string>): number;
|
|
51
|
+
/**
|
|
52
|
+
* True when the id is tombstoned, or the coordinate has a deletion marker that still covers the
|
|
53
|
+
* current event at that address: a replacement published after the marker's `until` clears the
|
|
54
|
+
* deletion. Coordinates are matched on the canonical lowercase pubkey.
|
|
55
|
+
*/
|
|
56
|
+
isDeleted(idOrAddress: string): boolean;
|
|
57
|
+
getOutboxBound(pubkey: string, kind: number): OutboxBound | undefined;
|
|
58
|
+
setOutboxBound(pubkey: string, kind: number, bound: OutboxBound): void;
|
|
59
|
+
clear(): void;
|
|
60
|
+
get size(): number;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/storage/memory.d.ts
|
|
64
|
+
/** In-memory event store: async {@link EventStore} facade over the synchronous {@link MemoryIndex}. */
|
|
65
|
+
declare class MemoryEventStore implements EventStore {
|
|
66
|
+
#private;
|
|
67
|
+
put(raw: Event): Promise<PutResult>;
|
|
68
|
+
/** Sequential `put` in input order. No transaction: a throw leaves earlier events applied. */
|
|
69
|
+
putMany(events: ReadonlyArray<Event>): Promise<PutResult[]>;
|
|
70
|
+
get(id: string): Promise<Event | undefined>;
|
|
71
|
+
query(filters: Filter[]): Promise<Event[]>;
|
|
72
|
+
count(filters: Filter[]): Promise<number>;
|
|
73
|
+
negentropyItems(filter: Filter): Promise<NegentropyItem[]>;
|
|
74
|
+
remove(ids: string[]): Promise<number>;
|
|
75
|
+
getOutboxBound(pubkey: string, kind: number): Promise<OutboxBound | undefined>;
|
|
76
|
+
setOutboxBound(pubkey: string, kind: number, bound: OutboxBound): Promise<void>;
|
|
77
|
+
clear(): Promise<void>;
|
|
78
|
+
get size(): number;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/storage/indexeddb.d.ts
|
|
82
|
+
/** Options for {@link IndexedDbEventStore}. */
|
|
83
|
+
type IndexedDbEventStoreOptions = {
|
|
84
|
+
/** IndexedDB database name. */
|
|
85
|
+
dbName?: string;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Browser IndexedDB event store with the same replaceable / deletion semantics as
|
|
89
|
+
* {@link MemoryEventStore}. Requires a DOM IndexedDB implementation.
|
|
90
|
+
*
|
|
91
|
+
* `open` loads every tombstone and address row into memory. Fine at 10^4 events; tens of MB at 10^5
|
|
92
|
+
* addressables.
|
|
93
|
+
*/
|
|
94
|
+
declare class IndexedDbEventStore implements EventStore {
|
|
95
|
+
#private;
|
|
96
|
+
constructor(opts?: IndexedDbEventStoreOptions);
|
|
97
|
+
static isAvailable(): boolean;
|
|
98
|
+
open(): Promise<void>;
|
|
99
|
+
put(event: Event): Promise<PutResult>;
|
|
100
|
+
/** One readwrite transaction; abort rejects the whole batch with no partial persist. */
|
|
101
|
+
putMany(events: ReadonlyArray<Event>): Promise<PutResult[]>;
|
|
102
|
+
get(id: string): Promise<Event | undefined>;
|
|
103
|
+
query(filters: Filter[]): Promise<Event[]>;
|
|
104
|
+
count(filters: Filter[]): Promise<number>;
|
|
105
|
+
negentropyItems(filter: Filter): Promise<NegentropyItem[]>;
|
|
106
|
+
getOutboxBound(pubkey: string, kind: number): Promise<OutboxBound | undefined>;
|
|
107
|
+
setOutboxBound(pubkey: string, kind: number, bound: OutboxBound): Promise<void>;
|
|
108
|
+
remove(ids: string[]): Promise<number>;
|
|
109
|
+
clear(): Promise<void>;
|
|
110
|
+
close(): void;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/storage/sqlite.d.ts
|
|
114
|
+
/** Value bindable to a SQLite statement parameter. */
|
|
115
|
+
type SqlValue = string | number | null | Uint8Array;
|
|
116
|
+
/**
|
|
117
|
+
* Minimal async SQLite driver surface.
|
|
118
|
+
*
|
|
119
|
+
* `transaction` must serialize `fn` exclusively — no interleaved statements from other callers may
|
|
120
|
+
* run while the callback transaction is active. It commits when `fn` resolves and rolls back when
|
|
121
|
+
* `fn` rejects.
|
|
122
|
+
*
|
|
123
|
+
* The store always issues statements sequentially — a driver never sees a second `exec`/`run`/`all`
|
|
124
|
+
* start before the previous one settles, inside or outside a transaction — so drivers need not
|
|
125
|
+
* support overlapping statements on one connection.
|
|
126
|
+
*
|
|
127
|
+
* `expo-sqlite` maps onto this interface without changes to query code. Note that
|
|
128
|
+
* `withExclusiveTransactionAsync` resolves `void` and statements inside the exclusive transaction
|
|
129
|
+
* must run on the `txn` connection passed to its callback, not on `db` — the result is captured
|
|
130
|
+
* out-of-band:
|
|
131
|
+
*
|
|
132
|
+
* ```ts
|
|
133
|
+
* const toDriver = (db: SQLiteDatabase): SqlDriver => ({
|
|
134
|
+
* exec: (sql) => db.execAsync(sql),
|
|
135
|
+
* run: async (sql, params = []) => ({
|
|
136
|
+
* changes: (await db.runAsync(sql, [...params])).changes,
|
|
137
|
+
* }),
|
|
138
|
+
* all: (sql, params = []) => db.getAllAsync(sql, [...params]),
|
|
139
|
+
* transaction: async (fn) => {
|
|
140
|
+
* let result!: Awaited<ReturnType<typeof fn>>;
|
|
141
|
+
* await db.withExclusiveTransactionAsync(async (txn) => {
|
|
142
|
+
* result = await fn(toDriver(txn));
|
|
143
|
+
* });
|
|
144
|
+
* return result;
|
|
145
|
+
* },
|
|
146
|
+
* });
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
type SqlDriver = {
|
|
150
|
+
/** Execute SQL without parameters (DDL, PRAGMA, multi-statement batches). */
|
|
151
|
+
exec: (sql: string) => Promise<void>;
|
|
152
|
+
/** Run a statement; resolves with the number of changed rows. */
|
|
153
|
+
run: (sql: string, params?: ReadonlyArray<SqlValue>) => Promise<{
|
|
154
|
+
changes: number;
|
|
155
|
+
}>;
|
|
156
|
+
/** Run a query; resolves with all result rows. */
|
|
157
|
+
all: <Row>(sql: string, params?: ReadonlyArray<SqlValue>) => Promise<Row[]>;
|
|
158
|
+
/** Run `fn` inside an exclusive transaction; commit on resolve, roll back on reject. */
|
|
159
|
+
transaction: <T>(fn: (tx: SqlDriver) => Promise<T>) => Promise<T>;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* SQLite-backed {@link EventStore} for React Native (`expo-sqlite`, `op-sqlite`) and desktop
|
|
163
|
+
* runtimes. Same semantics as {@link MemoryEventStore} and {@link IndexedDbEventStore}: identical
|
|
164
|
+
* `decidePut` insertion policy, NIP-09 tombstones, and filter handling, with the database — not
|
|
165
|
+
* in-memory caches — as the source of truth.
|
|
166
|
+
*
|
|
167
|
+
* Construct via {@link SqliteEventStore.open}; writes are serialized and run inside an exclusive
|
|
168
|
+
* driver transaction.
|
|
169
|
+
*/
|
|
170
|
+
declare class SqliteEventStore implements EventStore {
|
|
171
|
+
#private;
|
|
172
|
+
private constructor();
|
|
173
|
+
/** Create the schema on first use and return a ready store. */
|
|
174
|
+
static open(driver: SqlDriver): Promise<SqliteEventStore>;
|
|
175
|
+
put(event: Event): Promise<PutResult>;
|
|
176
|
+
putMany(events: ReadonlyArray<Event>): Promise<PutResult[]>;
|
|
177
|
+
get(id: string): Promise<Event | undefined>;
|
|
178
|
+
query(filters: Filter[]): Promise<Event[]>;
|
|
179
|
+
count(filters: Filter[]): Promise<number>;
|
|
180
|
+
negentropyItems(filter: Filter): Promise<NegentropyItem[]>;
|
|
181
|
+
getOutboxBound(pubkey: string, kind: number): Promise<OutboxBound | undefined>;
|
|
182
|
+
setOutboxBound(pubkey: string, kind: number, bound: OutboxBound): Promise<void>;
|
|
183
|
+
remove(ids: string[]): Promise<number>;
|
|
184
|
+
clear(): Promise<void>;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
export { IndexedDbEventStoreOptions as a, MemoryIndexOptions as c, IndexedDbEventStore as i, SqlValue as n, MemoryEventStore as o, SqliteEventStore as r, MemoryIndex as s, SqlDriver as t };
|
|
188
|
+
//# sourceMappingURL=index-D1bqFHKB.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { a as getPublicKey, c as verifyEvent, i as finalizeEvent, n as PublicKey, o as publicKeyFromHex, r as SecretKey, s as signEvent, t as Keys } from "./key-
|
|
3
|
-
import { n as ProfileMetadata, t as EventBuilder } from "./builder-
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as readRelays, c as writeRelays, i as parseRelayList, n as RelayMarker, o as relayListEventBuilder, r as markerOf, s as relayListToTags, t as RelayListItem } from "./nip65-
|
|
6
|
-
import { i as RoutedFilter, r as PubkeyRoutes, t as Gossip } from "./gossip-
|
|
7
|
-
import { a as assertSubscriptionId, c as encodeRelayMessage, d as parseRelayMessage, i as SubscriptionId, l as mergeCountHll, n as CountResult, o as createSubscriptionId, r as RelayMessage, s as encodeClientMessage, t as ClientMessage, u as parseClientMessage } from "./message-
|
|
8
|
-
import { a as NostrError, i as MessageError, n as EventValidationError, o as UrlError, r as HexError, s as WasmVerifyPoisonedError, t as CryptoError } from "./error-
|
|
9
|
-
import { a as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
1
|
+
import { C as parseEventAddress, S as isTag, T as tagValue, _ as Tag, b as formatEventAddress, d as signedMatchesUnsigned, f as sortEvents, g as EventAddress, h as validateSignedEvent, i as getEventHash, m as validateEvent, n as EventTemplate, o as isReplaceableWinner, p as sortedEvents, r as UnsignedEvent, s as itemCompare, t as Event, u as serializeEvent, v as TagInput, w as tagName, x as getDTag, y as eventAddress } from "./event-fU3Y01PR.mjs";
|
|
2
|
+
import { a as getPublicKey, c as verifyEvent, i as finalizeEvent, n as PublicKey, o as publicKeyFromHex, r as SecretKey, s as signEvent, t as Keys } from "./key-BlsYhN1V.mjs";
|
|
3
|
+
import { n as ProfileMetadata, t as EventBuilder } from "./builder-BWn55Paf.mjs";
|
|
4
|
+
import { a as getFilterLimit, c as mergeFilters, i as filterFingerprint, n as canonicalizeFilter, o as matchFilter, r as canonicalizeFilters, s as matchFilters, t as Filter } from "./filter-C0IMByE3.mjs";
|
|
5
|
+
import { a as readRelays, c as writeRelays, i as parseRelayList, n as RelayMarker, o as relayListEventBuilder, r as markerOf, s as relayListToTags, t as RelayListItem } from "./nip65-DBfh2smt.mjs";
|
|
6
|
+
import { i as RoutedFilter, r as PubkeyRoutes, t as Gossip } from "./gossip-BRQwIM_q.mjs";
|
|
7
|
+
import { a as assertSubscriptionId, c as encodeRelayMessage, d as parseRelayMessage, i as SubscriptionId, l as mergeCountHll, n as CountResult, o as createSubscriptionId, r as RelayMessage, s as encodeClientMessage, t as ClientMessage, u as parseClientMessage } from "./message-iGPIqnn0.mjs";
|
|
8
|
+
import { a as NostrError, i as MessageError, n as EventValidationError, o as UrlError, r as HexError, s as WasmVerifyPoisonedError, t as CryptoError } from "./error-CR8Urc84.mjs";
|
|
9
|
+
import { a as PoolPublishResult, c as Relay, d as RelayStatusName, f as SubscribeOptions, i as PoolOptions, l as RelayOptions, n as Pool, o as PoolSubscribeOptions, r as PoolCountResult, s as PublishResult, t as InvalidEventPolicy, u as RelayStatus } from "./pool-B7p_reAm.mjs";
|
|
10
|
+
import { i as useWebSocketImplementation } from "./websocket-CmeqvAkp.mjs";
|
|
11
|
+
import { i as PutResult, n as NegentropyItem, r as OutboxBound, t as EventStore } from "./types-2pCUprRU.mjs";
|
|
12
|
+
import { n as ReactiveEventStoreOptions, r as Watch, t as ReactiveEventStore } from "./reactive-DFpqtIf_.mjs";
|
|
13
|
+
import { _ as neventEncode, a as NAddr, b as npubEncode, c as NPub, d as Note, f as ProfilePointer, g as naddrEncode, i as EventPointer, l as NSec, m as decodeNostrURI, n as Bech32MaxSize, o as NEvent, p as decode, r as DecodedResult, s as NProfile, t as AddressPointer, u as Nip19Error, v as noteEncode, x as nsecEncode, y as nprofileEncode } from "./nip19-BevCJZsp.mjs";
|
|
14
|
+
import { _ as ReplaceableLoader, a as OutboxFeed, c as groupAuthorsByOutboxRelay, d as bareNostrUser, g as ReplaceableLoadResult, h as LoadStyle, i as OutboxError, l as NostrUser, m as MutedEntity, n as Loaders, o as OutboxFeedOptions, p as ListResult, r as createLoaders, s as createOutboxFeed } from "./index-B-CGNDPS.mjs";
|
|
15
|
+
import { t as NostrSigner } from "./types-CRQEk0Oi.mjs";
|
|
16
|
+
import { t as StorageError } from "./error-BW7re1UN.mjs";
|
|
17
|
+
import { f as SubscribePrivateMessagesOptions, g as SyncSummary, h as SyncOptions, i as ClientOptions, l as ReceivedPrivateMessage, m as SyncDirectionName, n as ClientBuilder, o as FetchPrivateMessagesOptions, p as SyncDirection, r as ClientError, s as PrivateMessageSendResult, t as Client, u as SendPrivateMessageOptions } from "./index-BIhSADwK.mjs";
|
|
18
|
+
import { _ as EVENT_ID_BYTES, a as classifyKind, b as SIGNATURE_BYTES, c as isRegularKind, f as bytesToHex, g as normalizeURL, h as isHex64, i as KnownKind, l as isReplaceableKind, m as isHex32, n as KindClassification, o as isAddressableKind, p as hexToBytes, r as KindName, s as isEphemeralKind, t as Kind, v as PUBLIC_KEY_BYTES, x as SUBSCRIPTION_ID_MAX_CHARS, y as SECRET_KEY_BYTES } from "./index-Boe8FshM.mjs";
|
|
19
|
+
import { a as Nip07Signer, c as isNip07Available, i as Nip46Transport, l as KeysSigner, n as Nip46SignerOptions, o as WindowNostr, r as Nip46SubscribeOptions, s as getWindowNostr, t as Nip46Signer, u as NoSignerError } from "./index-Ba7bJ7DD.mjs";
|
|
18
20
|
import { ReplyTagsOptions, ThreadReferences, buildReplyTags, parseThreadTags, replyTo } from "./nips/nip10.mjs";
|
|
19
21
|
import { isAuthRequired, makeAuthEvent } from "./nips/nip42.mjs";
|
|
20
|
-
import { a as isInsecureRelayUrl, c as RelayError, l as RelayPublishError, o as RelayClosedError, s as RelayConnectionError } from "./index-
|
|
21
|
-
import {
|
|
22
|
-
export { type AddressPointer, Bech32MaxSize, Client, ClientBuilder, ClientError, type ClientMessage, type ClientOptions, type CountResult, CryptoError,
|
|
22
|
+
import { a as isInsecureRelayUrl, c as RelayError, d as RelayTimeoutError, l as RelayPublishError, o as RelayClosedError, s as RelayConnectionError, u as RelaySuspendedError } from "./index-D-TK_KJG.mjs";
|
|
23
|
+
import { a as IndexedDbEventStoreOptions, i as IndexedDbEventStore, n as SqlValue, o as MemoryEventStore, r as SqliteEventStore, t as SqlDriver } from "./index-D1bqFHKB.mjs";
|
|
24
|
+
export { type AddressPointer, Bech32MaxSize, Client, ClientBuilder, ClientError, type ClientMessage, type ClientOptions, type CountResult, CryptoError, type DecodedResult, EVENT_ID_BYTES, type Event, type EventAddress, EventBuilder, type EventPointer, type EventStore, type EventTemplate, EventValidationError, type FetchPrivateMessagesOptions, type Filter, Gossip, HexError, IndexedDbEventStore, type IndexedDbEventStoreOptions, type InvalidEventPolicy, Keys, KeysSigner, Kind, type KindClassification, type KindName, type KnownKind, type ListResult, type LoadStyle, type Loaders, MemoryEventStore, MessageError, type MutedEntity, type NAddr, type NEvent, type NProfile, type NPub, type NSec, type NegentropyItem, Nip07Signer, Nip19Error, Nip46Signer, type Nip46SignerOptions, type Nip46SubscribeOptions, type Nip46Transport, NoSignerError, NostrError, type NostrSigner, type NostrUser, type Note, type OutboxBound, OutboxError, OutboxFeed, type OutboxFeedOptions, PUBLIC_KEY_BYTES, Pool, type PoolCountResult, type PoolOptions, type PoolPublishResult, type PoolSubscribeOptions, type PrivateMessageSendResult, type ProfileMetadata, type ProfilePointer, type PubkeyRoutes, type PublicKey, type PublishResult, type PutResult, ReactiveEventStore, type ReactiveEventStoreOptions, type ReceivedPrivateMessage, Relay, RelayClosedError, RelayConnectionError, RelayError, type RelayListItem, type RelayMarker, type RelayMessage, type RelayOptions, RelayPublishError, RelayStatus, type RelayStatusName, RelaySuspendedError, RelayTimeoutError, type ReplaceableLoadResult, type ReplaceableLoader, type ReplyTagsOptions, type RoutedFilter, SECRET_KEY_BYTES, SIGNATURE_BYTES, SUBSCRIPTION_ID_MAX_CHARS, SecretKey, type SendPrivateMessageOptions, type SqlDriver, type SqlValue, SqliteEventStore, StorageError, type SubscribeOptions, type SubscribePrivateMessagesOptions, type SubscriptionId, SyncDirection, type SyncDirectionName, type SyncOptions, type SyncSummary, Tag, type TagInput, type ThreadReferences, type UnsignedEvent, UrlError, WasmVerifyPoisonedError, type Watch, type WindowNostr, assertSubscriptionId, bareNostrUser, buildReplyTags, bytesToHex, canonicalizeFilter, canonicalizeFilters, classifyKind, createLoaders, createOutboxFeed, createSubscriptionId, decodeNostrURI, encodeClientMessage, encodeRelayMessage, eventAddress, filterFingerprint, finalizeEvent, formatEventAddress, getDTag, getEventHash, getFilterLimit, getPublicKey, getWindowNostr, groupAuthorsByOutboxRelay, hexToBytes, isAddressableKind, isAuthRequired, isEphemeralKind, isHex32, isHex64, isInsecureRelayUrl, isNip07Available, isRegularKind, isReplaceableKind, isReplaceableWinner, isTag, itemCompare, makeAuthEvent, markerOf, matchFilter, matchFilters, mergeCountHll, mergeFilters, naddrEncode, neventEncode, decode as nip19Decode, normalizeURL, noteEncode, nprofileEncode, npubEncode, nsecEncode, parseClientMessage, parseEventAddress, parseRelayList, parseRelayMessage, parseThreadTags, publicKeyFromHex, readRelays, relayListEventBuilder, relayListToTags, replyTo, serializeEvent, signEvent, signedMatchesUnsigned, sortEvents, sortedEvents, tagName, tagValue, useWebSocketImplementation, validateEvent, validateSignedEvent, verifyEvent, writeRelays };
|