nostr-tools 2.23.2 → 2.23.4
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/lib/cjs/abstract-pool.js +6 -2
- package/lib/cjs/abstract-pool.js.map +2 -2
- package/lib/cjs/abstract-relay.js +6 -2
- package/lib/cjs/abstract-relay.js.map +2 -2
- package/lib/cjs/index.js +181 -17
- package/lib/cjs/index.js.map +4 -4
- package/lib/cjs/nip17.js +31 -9
- package/lib/cjs/nip17.js.map +2 -2
- package/lib/cjs/nip22.js +154 -0
- package/lib/cjs/nip22.js.map +7 -0
- package/lib/cjs/nip44.js +34 -10
- package/lib/cjs/nip44.js.map +2 -2
- package/lib/cjs/nip46.js +40 -12
- package/lib/cjs/nip46.js.map +2 -2
- package/lib/cjs/nip47.js +3 -3
- package/lib/cjs/nip47.js.map +2 -2
- package/lib/cjs/nip59.js +31 -9
- package/lib/cjs/nip59.js.map +2 -2
- package/lib/cjs/pool.js +6 -2
- package/lib/cjs/pool.js.map +2 -2
- package/lib/cjs/relay.js +6 -2
- package/lib/cjs/relay.js.map +2 -2
- package/lib/esm/abstract-pool.js +6 -2
- package/lib/esm/abstract-pool.js.map +2 -2
- package/lib/esm/abstract-relay.js +6 -2
- package/lib/esm/abstract-relay.js.map +2 -2
- package/lib/esm/index.js +181 -17
- package/lib/esm/index.js.map +4 -4
- package/lib/esm/nip17.js +31 -9
- package/lib/esm/nip17.js.map +2 -2
- package/lib/esm/nip22.js +133 -0
- package/lib/esm/nip22.js.map +7 -0
- package/lib/esm/nip44.js +34 -10
- package/lib/esm/nip44.js.map +2 -2
- package/lib/esm/nip46.js +40 -12
- package/lib/esm/nip46.js.map +2 -2
- package/lib/esm/nip47.js +3 -3
- package/lib/esm/nip47.js.map +2 -2
- package/lib/esm/nip59.js +31 -9
- package/lib/esm/nip59.js.map +2 -2
- package/lib/esm/pool.js +6 -2
- package/lib/esm/pool.js.map +2 -2
- package/lib/esm/relay.js +6 -2
- package/lib/esm/relay.js.map +2 -2
- package/lib/nostr.bundle.js +189 -25
- package/lib/nostr.bundle.js.map +4 -4
- package/package.json +8 -2
- package/lib/types/abstract-pool.d.ts +0 -60
- package/lib/types/abstract-relay.d.ts +0 -110
- package/lib/types/benchmarks.d.ts +0 -1
- package/lib/types/core.d.ts +0 -32
- package/lib/types/core.test.d.ts +0 -1
- package/lib/types/fakejson.d.ts +0 -6
- package/lib/types/fakejson.test.d.ts +0 -1
- package/lib/types/filter.d.ts +0 -19
- package/lib/types/filter.test.d.ts +0 -1
- package/lib/types/helpers.d.ts +0 -2
- package/lib/types/index.d.ts +0 -30
- package/lib/types/kinds.d.ts +0 -200
- package/lib/types/kinds.test.d.ts +0 -1
- package/lib/types/nip04.d.ts +0 -2
- package/lib/types/nip04.test.d.ts +0 -1
- package/lib/types/nip05.d.ts +0 -17
- package/lib/types/nip05.test.d.ts +0 -1
- package/lib/types/nip06.d.ts +0 -15
- package/lib/types/nip06.test.d.ts +0 -1
- package/lib/types/nip07.d.ts +0 -13
- package/lib/types/nip10.d.ts +0 -24
- package/lib/types/nip10.test.d.ts +0 -1
- package/lib/types/nip11.d.ts +0 -266
- package/lib/types/nip11.test.d.ts +0 -1
- package/lib/types/nip13.d.ts +0 -8
- package/lib/types/nip13.test.d.ts +0 -1
- package/lib/types/nip17.d.ts +0 -15
- package/lib/types/nip17.test.d.ts +0 -1
- package/lib/types/nip18.d.ts +0 -22
- package/lib/types/nip18.test.d.ts +0 -1
- package/lib/types/nip19.d.ts +0 -81
- package/lib/types/nip19.test.d.ts +0 -1
- package/lib/types/nip21.d.ts +0 -34
- package/lib/types/nip21.test.d.ts +0 -1
- package/lib/types/nip25.d.ts +0 -15
- package/lib/types/nip25.test.d.ts +0 -1
- package/lib/types/nip27.d.ts +0 -32
- package/lib/types/nip27.test.d.ts +0 -1
- package/lib/types/nip28.d.ts +0 -46
- package/lib/types/nip28.test.d.ts +0 -1
- package/lib/types/nip29.d.ts +0 -265
- package/lib/types/nip30.d.ts +0 -22
- package/lib/types/nip30.test.d.ts +0 -1
- package/lib/types/nip39.d.ts +0 -2
- package/lib/types/nip39.test.d.ts +0 -1
- package/lib/types/nip40.d.ts +0 -10
- package/lib/types/nip40.test.d.ts +0 -1
- package/lib/types/nip42.d.ts +0 -5
- package/lib/types/nip42.test.d.ts +0 -1
- package/lib/types/nip44.d.ts +0 -13
- package/lib/types/nip44.test.d.ts +0 -1
- package/lib/types/nip46.d.ts +0 -117
- package/lib/types/nip47.d.ts +0 -9
- package/lib/types/nip47.test.d.ts +0 -1
- package/lib/types/nip49.d.ts +0 -3
- package/lib/types/nip49.test.d.ts +0 -1
- package/lib/types/nip54.d.ts +0 -1
- package/lib/types/nip54.test.d.ts +0 -1
- package/lib/types/nip55.d.ts +0 -30
- package/lib/types/nip55.test.d.ts +0 -1
- package/lib/types/nip57.d.ts +0 -25
- package/lib/types/nip57.test.d.ts +0 -1
- package/lib/types/nip58.d.ts +0 -134
- package/lib/types/nip58.test.d.ts +0 -1
- package/lib/types/nip59.d.ts +0 -12
- package/lib/types/nip59.test.d.ts +0 -1
- package/lib/types/nip75.d.ts +0 -61
- package/lib/types/nip75.test.d.ts +0 -1
- package/lib/types/nip77.d.ts +0 -102
- package/lib/types/nip77.test.d.ts +0 -1
- package/lib/types/nip94.d.ts +0 -87
- package/lib/types/nip94.test.d.ts +0 -1
- package/lib/types/nip98.d.ts +0 -74
- package/lib/types/nip98.test.d.ts +0 -1
- package/lib/types/nip99.d.ts +0 -92
- package/lib/types/nip99.test.d.ts +0 -1
- package/lib/types/nipb7.d.ts +0 -23
- package/lib/types/nipb7.test.d.ts +0 -1
- package/lib/types/pool.d.ts +0 -6
- package/lib/types/pool.test.d.ts +0 -1
- package/lib/types/pure.d.ts +0 -8
- package/lib/types/pure.test.d.ts +0 -1
- package/lib/types/references.d.ts +0 -10
- package/lib/types/references.test.d.ts +0 -1
- package/lib/types/relay.d.ts +0 -11
- package/lib/types/relay.test.d.ts +0 -1
- package/lib/types/signer.d.ts +0 -11
- package/lib/types/test-helpers.d.ts +0 -14
- package/lib/types/utils.d.ts +0 -9
- package/lib/types/utils.test.d.ts +0 -1
- package/lib/types/wasm.d.ts +0 -8
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "nostr-tools",
|
|
4
|
-
"version": "2.23.
|
|
4
|
+
"version": "2.23.4",
|
|
5
5
|
"description": "Tools for making a Nostr client.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/nbd-wtf/nostr-tools.git"
|
|
8
|
+
"url": "git+https://github.com/nbd-wtf/nostr-tools.git"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"lib"
|
|
@@ -144,6 +144,12 @@
|
|
|
144
144
|
"require": "./lib/cjs/nip21.js",
|
|
145
145
|
"types": "./lib/types/nip21.d.ts"
|
|
146
146
|
},
|
|
147
|
+
"./nip22": {
|
|
148
|
+
"source": "./nip22.ts",
|
|
149
|
+
"import": "./lib/esm/nip22.js",
|
|
150
|
+
"require": "./lib/cjs/nip22.js",
|
|
151
|
+
"types": "./lib/types/nip22.d.ts"
|
|
152
|
+
},
|
|
147
153
|
"./nip25": {
|
|
148
154
|
"source": "./nip25.ts",
|
|
149
155
|
"import": "./lib/esm/nip25.js",
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { AbstractRelay as AbstractRelay, SubscriptionParams, type AbstractRelayConstructorOptions } from './abstract-relay.ts';
|
|
2
|
-
import type { Event, EventTemplate, Nostr, VerifiedEvent } from './core.ts';
|
|
3
|
-
import { type Filter } from './filter.ts';
|
|
4
|
-
export type SubCloser = {
|
|
5
|
-
close: (reason?: string) => void;
|
|
6
|
-
};
|
|
7
|
-
export type AbstractPoolConstructorOptions = AbstractRelayConstructorOptions & {
|
|
8
|
-
automaticallyAuth?: (relayURL: string) => null | ((event: EventTemplate) => Promise<VerifiedEvent>);
|
|
9
|
-
onRelayConnectionFailure?: (url: string) => void;
|
|
10
|
-
onRelayConnectionSuccess?: (url: string) => void;
|
|
11
|
-
allowConnectingToRelay?: (url: string, operation: ['read', Filter[]] | ['write', Event]) => boolean;
|
|
12
|
-
maxWaitForConnection: number;
|
|
13
|
-
};
|
|
14
|
-
export type SubscribeManyParams = Omit<SubscriptionParams, 'onclose'> & {
|
|
15
|
-
maxWait?: number;
|
|
16
|
-
abort?: AbortSignal;
|
|
17
|
-
onclose?: (reasons: string[]) => void;
|
|
18
|
-
onauth?: (event: EventTemplate) => Promise<VerifiedEvent>;
|
|
19
|
-
id?: string;
|
|
20
|
-
label?: string;
|
|
21
|
-
};
|
|
22
|
-
export declare class AbstractSimplePool {
|
|
23
|
-
protected relays: Map<string, AbstractRelay>;
|
|
24
|
-
seenOn: Map<string, Set<AbstractRelay>>;
|
|
25
|
-
trackRelays: boolean;
|
|
26
|
-
verifyEvent: Nostr['verifyEvent'];
|
|
27
|
-
enablePing: boolean | undefined;
|
|
28
|
-
enableReconnect: boolean;
|
|
29
|
-
automaticallyAuth?: (relayURL: string) => null | ((event: EventTemplate) => Promise<VerifiedEvent>);
|
|
30
|
-
trustedRelayURLs: Set<string>;
|
|
31
|
-
onRelayConnectionFailure?: (url: string) => void;
|
|
32
|
-
onRelayConnectionSuccess?: (url: string) => void;
|
|
33
|
-
allowConnectingToRelay?: (url: string, operation: ['read', Filter[]] | ['write', Event]) => boolean;
|
|
34
|
-
maxWaitForConnection: number;
|
|
35
|
-
private _WebSocket?;
|
|
36
|
-
constructor(opts: AbstractPoolConstructorOptions);
|
|
37
|
-
ensureRelay(url: string, params?: {
|
|
38
|
-
connectionTimeout?: number;
|
|
39
|
-
abort?: AbortSignal;
|
|
40
|
-
}): Promise<AbstractRelay>;
|
|
41
|
-
close(relays: string[]): void;
|
|
42
|
-
subscribe(relays: string[], filter: Filter, params: SubscribeManyParams): SubCloser;
|
|
43
|
-
subscribeMany(relays: string[], filter: Filter, params: SubscribeManyParams): SubCloser;
|
|
44
|
-
subscribeMap(requests: {
|
|
45
|
-
url: string;
|
|
46
|
-
filter: Filter;
|
|
47
|
-
}[], params: SubscribeManyParams): SubCloser;
|
|
48
|
-
subscribeEose(relays: string[], filter: Filter, params: Pick<SubscribeManyParams, 'label' | 'id' | 'onevent' | 'oninvalidevent' | 'onclose' | 'maxWait' | 'onauth'>): SubCloser;
|
|
49
|
-
subscribeManyEose(relays: string[], filter: Filter, params: Pick<SubscribeManyParams, 'label' | 'id' | 'onevent' | 'oninvalidevent' | 'onclose' | 'maxWait' | 'onauth'>): SubCloser;
|
|
50
|
-
querySync(relays: string[], filter: Filter, params?: Pick<SubscribeManyParams, 'label' | 'id' | 'maxWait'>): Promise<Event[]>;
|
|
51
|
-
get(relays: string[], filter: Filter, params?: Pick<SubscribeManyParams, 'label' | 'id' | 'maxWait'>): Promise<Event | null>;
|
|
52
|
-
publish(relays: string[], event: Event, params?: {
|
|
53
|
-
onauth?: (evt: EventTemplate) => Promise<VerifiedEvent>;
|
|
54
|
-
maxWait?: number;
|
|
55
|
-
abort?: AbortSignal;
|
|
56
|
-
}): Promise<string>[];
|
|
57
|
-
listConnectionStatus(): Map<string, boolean>;
|
|
58
|
-
destroy(): void;
|
|
59
|
-
pruneIdleRelays(idleThresholdMs?: number): string[];
|
|
60
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { Event, EventTemplate, VerifiedEvent, Nostr } from './core.ts';
|
|
2
|
-
import { type Filter } from './filter.ts';
|
|
3
|
-
export type AbstractRelayConstructorOptions = {
|
|
4
|
-
verifyEvent: Nostr['verifyEvent'];
|
|
5
|
-
websocketImplementation?: typeof WebSocket;
|
|
6
|
-
enablePing?: boolean;
|
|
7
|
-
enableReconnect?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare class SendingOnClosedConnection extends Error {
|
|
10
|
-
constructor(message: string, relay: string);
|
|
11
|
-
}
|
|
12
|
-
export declare class AbstractRelay {
|
|
13
|
-
readonly url: string;
|
|
14
|
-
private _connected;
|
|
15
|
-
onclose: (() => void) | null;
|
|
16
|
-
onnotice: (msg: string) => void;
|
|
17
|
-
onauth: undefined | ((evt: EventTemplate) => Promise<VerifiedEvent>);
|
|
18
|
-
baseEoseTimeout: number;
|
|
19
|
-
publishTimeout: number;
|
|
20
|
-
pingFrequency: number;
|
|
21
|
-
pingTimeout: number;
|
|
22
|
-
resubscribeBackoff: number[];
|
|
23
|
-
openSubs: Map<string, Subscription>;
|
|
24
|
-
enablePing: boolean | undefined;
|
|
25
|
-
enableReconnect: boolean;
|
|
26
|
-
idleSince: number | undefined;
|
|
27
|
-
ongoingOperations: number;
|
|
28
|
-
private reconnectTimeoutHandle;
|
|
29
|
-
private pingIntervalHandle;
|
|
30
|
-
private reconnectAttempts;
|
|
31
|
-
private skipReconnection;
|
|
32
|
-
private connectionPromise;
|
|
33
|
-
private openCountRequests;
|
|
34
|
-
private openEventPublishes;
|
|
35
|
-
private ws;
|
|
36
|
-
private challenge;
|
|
37
|
-
private authPromise;
|
|
38
|
-
private serial;
|
|
39
|
-
private verifyEvent;
|
|
40
|
-
private _WebSocket;
|
|
41
|
-
constructor(url: string, opts: AbstractRelayConstructorOptions);
|
|
42
|
-
static connect(url: string, opts: AbstractRelayConstructorOptions & Parameters<AbstractRelay['connect']>[0]): Promise<AbstractRelay>;
|
|
43
|
-
private closeAllSubscriptions;
|
|
44
|
-
get connected(): boolean;
|
|
45
|
-
private reconnect;
|
|
46
|
-
private handleHardClose;
|
|
47
|
-
connect(opts?: {
|
|
48
|
-
timeout?: number;
|
|
49
|
-
abort?: AbortSignal;
|
|
50
|
-
}): Promise<void>;
|
|
51
|
-
private waitForPingPong;
|
|
52
|
-
private waitForDummyReq;
|
|
53
|
-
private pingpong;
|
|
54
|
-
send(message: string): Promise<void>;
|
|
55
|
-
auth(signAuthEvent: (evt: EventTemplate) => Promise<VerifiedEvent>): Promise<string>;
|
|
56
|
-
publish(event: Event): Promise<string>;
|
|
57
|
-
count(filters: Filter[], params: {
|
|
58
|
-
id?: string | null;
|
|
59
|
-
}): Promise<number>;
|
|
60
|
-
subscribe(filters: Filter[], params: Partial<SubscriptionParams> & {
|
|
61
|
-
label?: string;
|
|
62
|
-
id?: string;
|
|
63
|
-
}): Subscription;
|
|
64
|
-
prepareSubscription(filters: Filter[], params: Partial<SubscriptionParams> & {
|
|
65
|
-
label?: string;
|
|
66
|
-
id?: string;
|
|
67
|
-
}): Subscription;
|
|
68
|
-
close(): void;
|
|
69
|
-
_onmessage(ev: MessageEvent<any>): void;
|
|
70
|
-
}
|
|
71
|
-
export declare class Subscription {
|
|
72
|
-
readonly relay: AbstractRelay;
|
|
73
|
-
readonly id: string;
|
|
74
|
-
lastEmitted: number | undefined;
|
|
75
|
-
closed: boolean;
|
|
76
|
-
eosed: boolean;
|
|
77
|
-
filters: Filter[];
|
|
78
|
-
alreadyHaveEvent: ((id: string) => boolean) | undefined;
|
|
79
|
-
receivedEvent: ((relay: AbstractRelay, id: string) => void) | undefined;
|
|
80
|
-
onevent: (evt: Event) => void;
|
|
81
|
-
oninvalidevent: ((evt: unknown) => void) | undefined;
|
|
82
|
-
oneose: (() => void) | undefined;
|
|
83
|
-
onclose: ((reason: string) => void) | undefined;
|
|
84
|
-
oncustom: ((msg: string[]) => void) | undefined;
|
|
85
|
-
eoseTimeout: number;
|
|
86
|
-
private eoseTimeoutHandle;
|
|
87
|
-
constructor(relay: AbstractRelay, id: string, filters: Filter[], params: SubscriptionParams);
|
|
88
|
-
fire(): void;
|
|
89
|
-
receivedEose(): void;
|
|
90
|
-
close(reason?: string): void;
|
|
91
|
-
}
|
|
92
|
-
export type SubscriptionParams = {
|
|
93
|
-
onevent?: (evt: Event) => void;
|
|
94
|
-
oninvalidevent?: (evt: unknown) => void;
|
|
95
|
-
oneose?: () => void;
|
|
96
|
-
onclose?: (reason: string) => void;
|
|
97
|
-
alreadyHaveEvent?: (id: string) => boolean;
|
|
98
|
-
receivedEvent?: (relay: AbstractRelay, id: string) => void;
|
|
99
|
-
eoseTimeout?: number;
|
|
100
|
-
abort?: AbortSignal;
|
|
101
|
-
};
|
|
102
|
-
export type CountResolver = {
|
|
103
|
-
resolve: (count: number) => void;
|
|
104
|
-
reject: (err: Error) => void;
|
|
105
|
-
};
|
|
106
|
-
export type EventPublishResolver = {
|
|
107
|
-
resolve: (reason: string) => void;
|
|
108
|
-
reject: (err: Error) => void;
|
|
109
|
-
timeout: ReturnType<typeof setTimeout>;
|
|
110
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/core.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface Nostr {
|
|
2
|
-
generateSecretKey(): Uint8Array;
|
|
3
|
-
getPublicKey(secretKey: Uint8Array): string;
|
|
4
|
-
finalizeEvent(event: EventTemplate, secretKey: Uint8Array): VerifiedEvent;
|
|
5
|
-
verifyEvent(event: Event): event is VerifiedEvent;
|
|
6
|
-
}
|
|
7
|
-
/** Designates a verified event signature. */
|
|
8
|
-
export declare const verifiedSymbol: unique symbol;
|
|
9
|
-
export type NostrEvent = {
|
|
10
|
-
kind: number;
|
|
11
|
-
tags: string[][];
|
|
12
|
-
content: string;
|
|
13
|
-
created_at: number;
|
|
14
|
-
pubkey: string;
|
|
15
|
-
id: string;
|
|
16
|
-
sig: string;
|
|
17
|
-
[verifiedSymbol]?: boolean;
|
|
18
|
-
};
|
|
19
|
-
export type Event = NostrEvent;
|
|
20
|
-
export type EventTemplate = Pick<Event, 'kind' | 'tags' | 'content' | 'created_at'>;
|
|
21
|
-
export type UnsignedEvent = Pick<Event, 'kind' | 'tags' | 'content' | 'created_at' | 'pubkey'>;
|
|
22
|
-
/** An event whose signature has been verified. */
|
|
23
|
-
export interface VerifiedEvent extends Event {
|
|
24
|
-
[verifiedSymbol]: true;
|
|
25
|
-
}
|
|
26
|
-
export declare function validateEvent<T>(event: T): event is T & UnsignedEvent;
|
|
27
|
-
/**
|
|
28
|
-
* Sort events in reverse-chronological order by the `created_at` timestamp,
|
|
29
|
-
* and then by the event `id` (lexicographically) in case of ties.
|
|
30
|
-
* This mutates the array.
|
|
31
|
-
*/
|
|
32
|
-
export declare function sortEvents(events: Event[]): Event[];
|
package/lib/types/core.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/fakejson.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function getHex64(json: string, field: string): string;
|
|
2
|
-
export declare function getInt(json: string, field: string): number;
|
|
3
|
-
export declare function getSubscriptionId(json: string): string | null;
|
|
4
|
-
export declare function matchEventId(json: string, id: string): boolean;
|
|
5
|
-
export declare function matchEventPubkey(json: string, pubkey: string): boolean;
|
|
6
|
-
export declare function matchEventKind(json: string, kind: number): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/filter.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Event } from './core.ts';
|
|
2
|
-
export type Filter = {
|
|
3
|
-
ids?: string[];
|
|
4
|
-
kinds?: number[];
|
|
5
|
-
authors?: string[];
|
|
6
|
-
since?: number;
|
|
7
|
-
until?: number;
|
|
8
|
-
limit?: number;
|
|
9
|
-
search?: string;
|
|
10
|
-
[key: `#${string}`]: string[] | undefined;
|
|
11
|
-
};
|
|
12
|
-
export declare function matchFilter(filter: Filter, event: Event): boolean;
|
|
13
|
-
export declare function matchFilters(filters: Filter[], event: Event): boolean;
|
|
14
|
-
export declare function mergeFilters(...filters: Filter[]): Filter;
|
|
15
|
-
/**
|
|
16
|
-
* Calculate the intrinsic limit of a filter.
|
|
17
|
-
* This function returns a positive integer, or `Infinity` if there is no intrinsic limit.
|
|
18
|
-
*/
|
|
19
|
-
export declare function getFilterLimit(filter: Filter): number;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/helpers.d.ts
DELETED
package/lib/types/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export * from './pure.ts';
|
|
2
|
-
export { Relay } from './relay.ts';
|
|
3
|
-
export * from './filter.ts';
|
|
4
|
-
export { SimplePool } from './pool.ts';
|
|
5
|
-
export * from './references.ts';
|
|
6
|
-
export * as nip04 from './nip04.ts';
|
|
7
|
-
export * as nip05 from './nip05.ts';
|
|
8
|
-
export * as nip10 from './nip10.ts';
|
|
9
|
-
export * as nip11 from './nip11.ts';
|
|
10
|
-
export * as nip13 from './nip13.ts';
|
|
11
|
-
export * as nip17 from './nip17.ts';
|
|
12
|
-
export * as nip18 from './nip18.ts';
|
|
13
|
-
export * as nip19 from './nip19.ts';
|
|
14
|
-
export * as nip21 from './nip21.ts';
|
|
15
|
-
export * as nip25 from './nip25.ts';
|
|
16
|
-
export * as nip27 from './nip27.ts';
|
|
17
|
-
export * as nip28 from './nip28.ts';
|
|
18
|
-
export * as nip30 from './nip30.ts';
|
|
19
|
-
export * as nip39 from './nip39.ts';
|
|
20
|
-
export * as nip42 from './nip42.ts';
|
|
21
|
-
export * as nip44 from './nip44.ts';
|
|
22
|
-
export * as nip47 from './nip47.ts';
|
|
23
|
-
export * as nip54 from './nip54.ts';
|
|
24
|
-
export * as nip57 from './nip57.ts';
|
|
25
|
-
export * as nip59 from './nip59.ts';
|
|
26
|
-
export * as nip77 from './nip77.ts';
|
|
27
|
-
export * as nip98 from './nip98.ts';
|
|
28
|
-
export * as kinds from './kinds.ts';
|
|
29
|
-
export * as fj from './fakejson.ts';
|
|
30
|
-
export * as utils from './utils.ts';
|
package/lib/types/kinds.d.ts
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { NostrEvent } from './pure.ts';
|
|
2
|
-
/** Events are **regular**, which means they're all expected to be stored by relays. */
|
|
3
|
-
export declare function isRegularKind(kind: number): boolean;
|
|
4
|
-
/** Events are **replaceable**, which means that, for each combination of `pubkey` and `kind`, only the latest event is expected to (SHOULD) be stored by relays, older versions are expected to be discarded. */
|
|
5
|
-
export declare function isReplaceableKind(kind: number): boolean;
|
|
6
|
-
/** Events are **ephemeral**, which means they are not expected to be stored by relays. */
|
|
7
|
-
export declare function isEphemeralKind(kind: number): boolean;
|
|
8
|
-
/** Events are **addressable**, which means that, for each combination of `pubkey`, `kind` and the `d` tag, only the latest event is expected to be stored by relays, older versions are expected to be discarded. */
|
|
9
|
-
export declare function isAddressableKind(kind: number): boolean;
|
|
10
|
-
/** Classification of the event kind. */
|
|
11
|
-
export type KindClassification = 'regular' | 'replaceable' | 'ephemeral' | 'parameterized' | 'unknown';
|
|
12
|
-
/** Determine the classification of this kind of event if known, or `unknown`. */
|
|
13
|
-
export declare function classifyKind(kind: number): KindClassification;
|
|
14
|
-
export declare function isKind<T extends number>(event: unknown, kind: T | Array<T>): event is NostrEvent & {
|
|
15
|
-
kind: T;
|
|
16
|
-
};
|
|
17
|
-
export declare const Metadata = 0;
|
|
18
|
-
export type Metadata = typeof Metadata;
|
|
19
|
-
export declare const ShortTextNote = 1;
|
|
20
|
-
export type ShortTextNote = typeof ShortTextNote;
|
|
21
|
-
export declare const RecommendRelay = 2;
|
|
22
|
-
export type RecommendRelay = typeof RecommendRelay;
|
|
23
|
-
export declare const Contacts = 3;
|
|
24
|
-
export type Contacts = typeof Contacts;
|
|
25
|
-
export declare const EncryptedDirectMessage = 4;
|
|
26
|
-
export type EncryptedDirectMessage = typeof EncryptedDirectMessage;
|
|
27
|
-
export declare const EventDeletion = 5;
|
|
28
|
-
export type EventDeletion = typeof EventDeletion;
|
|
29
|
-
export declare const Repost = 6;
|
|
30
|
-
export type Repost = typeof Repost;
|
|
31
|
-
export declare const Reaction = 7;
|
|
32
|
-
export type Reaction = typeof Reaction;
|
|
33
|
-
export declare const BadgeAward = 8;
|
|
34
|
-
export type BadgeAward = typeof BadgeAward;
|
|
35
|
-
export declare const ChatMessage = 9;
|
|
36
|
-
export type ChatMessage = typeof ChatMessage;
|
|
37
|
-
export declare const ForumThread = 11;
|
|
38
|
-
export type ForumThread = typeof ForumThread;
|
|
39
|
-
export declare const Seal = 13;
|
|
40
|
-
export type Seal = typeof Seal;
|
|
41
|
-
export declare const PrivateDirectMessage = 14;
|
|
42
|
-
export type PrivateDirectMessage = typeof PrivateDirectMessage;
|
|
43
|
-
export declare const FileMessage = 15;
|
|
44
|
-
export type FileMessage = typeof FileMessage;
|
|
45
|
-
export declare const GenericRepost = 16;
|
|
46
|
-
export type GenericRepost = typeof GenericRepost;
|
|
47
|
-
export declare const Photo = 20;
|
|
48
|
-
export type Photo = typeof Photo;
|
|
49
|
-
export declare const NormalVideo = 21;
|
|
50
|
-
export type NormalVideo = typeof NormalVideo;
|
|
51
|
-
export declare const ShortVideo = 22;
|
|
52
|
-
export type ShortVideo = typeof ShortVideo;
|
|
53
|
-
export declare const ChannelCreation = 40;
|
|
54
|
-
export type ChannelCreation = typeof ChannelCreation;
|
|
55
|
-
export declare const ChannelMetadata = 41;
|
|
56
|
-
export type ChannelMetadata = typeof ChannelMetadata;
|
|
57
|
-
export declare const ChannelMessage = 42;
|
|
58
|
-
export type ChannelMessage = typeof ChannelMessage;
|
|
59
|
-
export declare const ChannelHideMessage = 43;
|
|
60
|
-
export type ChannelHideMessage = typeof ChannelHideMessage;
|
|
61
|
-
export declare const ChannelMuteUser = 44;
|
|
62
|
-
export type ChannelMuteUser = typeof ChannelMuteUser;
|
|
63
|
-
export declare const OpenTimestamps = 1040;
|
|
64
|
-
export type OpenTimestamps = typeof OpenTimestamps;
|
|
65
|
-
export declare const GiftWrap = 1059;
|
|
66
|
-
export type GiftWrap = typeof GiftWrap;
|
|
67
|
-
export declare const Poll = 1068;
|
|
68
|
-
export type Poll = typeof Poll;
|
|
69
|
-
export declare const FileMetadata = 1063;
|
|
70
|
-
export type FileMetadata = typeof FileMetadata;
|
|
71
|
-
export declare const Comment = 1111;
|
|
72
|
-
export type Comment = typeof Comment;
|
|
73
|
-
export declare const LiveChatMessage = 1311;
|
|
74
|
-
export type LiveChatMessage = typeof LiveChatMessage;
|
|
75
|
-
export declare const Voice = 1222;
|
|
76
|
-
export type Voice = typeof Voice;
|
|
77
|
-
export declare const VoiceComment = 1244;
|
|
78
|
-
export type VoiceComment = typeof VoiceComment;
|
|
79
|
-
export declare const ProblemTracker = 1971;
|
|
80
|
-
export type ProblemTracker = typeof ProblemTracker;
|
|
81
|
-
export declare const Report = 1984;
|
|
82
|
-
export type Report = typeof Report;
|
|
83
|
-
export declare const Reporting = 1984;
|
|
84
|
-
export type Reporting = typeof Reporting;
|
|
85
|
-
export declare const Label = 1985;
|
|
86
|
-
export type Label = typeof Label;
|
|
87
|
-
export declare const CommunityPostApproval = 4550;
|
|
88
|
-
export type CommunityPostApproval = typeof CommunityPostApproval;
|
|
89
|
-
export declare const JobRequest = 5999;
|
|
90
|
-
export type JobRequest = typeof JobRequest;
|
|
91
|
-
export declare const JobResult = 6999;
|
|
92
|
-
export type JobResult = typeof JobResult;
|
|
93
|
-
export declare const JobFeedback = 7000;
|
|
94
|
-
export type JobFeedback = typeof JobFeedback;
|
|
95
|
-
export declare const ZapGoal = 9041;
|
|
96
|
-
export type ZapGoal = typeof ZapGoal;
|
|
97
|
-
export declare const ZapRequest = 9734;
|
|
98
|
-
export type ZapRequest = typeof ZapRequest;
|
|
99
|
-
export declare const Zap = 9735;
|
|
100
|
-
export type Zap = typeof Zap;
|
|
101
|
-
export declare const Highlights = 9802;
|
|
102
|
-
export type Highlights = typeof Highlights;
|
|
103
|
-
export declare const PollResponse = 1018;
|
|
104
|
-
export type PollResponse = typeof PollResponse;
|
|
105
|
-
export declare const Mutelist = 10000;
|
|
106
|
-
export type Mutelist = typeof Mutelist;
|
|
107
|
-
export declare const Pinlist = 10001;
|
|
108
|
-
export type Pinlist = typeof Pinlist;
|
|
109
|
-
export declare const RelayList = 10002;
|
|
110
|
-
export type RelayList = typeof RelayList;
|
|
111
|
-
export declare const BookmarkList = 10003;
|
|
112
|
-
export type BookmarkList = typeof BookmarkList;
|
|
113
|
-
export declare const CommunitiesList = 10004;
|
|
114
|
-
export type CommunitiesList = typeof CommunitiesList;
|
|
115
|
-
export declare const PublicChatsList = 10005;
|
|
116
|
-
export type PublicChatsList = typeof PublicChatsList;
|
|
117
|
-
export declare const BlockedRelaysList = 10006;
|
|
118
|
-
export type BlockedRelaysList = typeof BlockedRelaysList;
|
|
119
|
-
export declare const SearchRelaysList = 10007;
|
|
120
|
-
export type SearchRelaysList = typeof SearchRelaysList;
|
|
121
|
-
export declare const FavoriteRelays = 10012;
|
|
122
|
-
export type FavoriteRelays = typeof FavoriteRelays;
|
|
123
|
-
export declare const InterestsList = 10015;
|
|
124
|
-
export type InterestsList = typeof InterestsList;
|
|
125
|
-
export declare const UserEmojiList = 10030;
|
|
126
|
-
export type UserEmojiList = typeof UserEmojiList;
|
|
127
|
-
export declare const DirectMessageRelaysList = 10050;
|
|
128
|
-
export type DirectMessageRelaysList = typeof DirectMessageRelaysList;
|
|
129
|
-
export declare const FileServerPreference = 10096;
|
|
130
|
-
export type FileServerPreference = typeof FileServerPreference;
|
|
131
|
-
export declare const BlossomServerList = 10063;
|
|
132
|
-
export type BlossomServerList = typeof BlossomServerList;
|
|
133
|
-
export declare const NWCWalletInfo = 13194;
|
|
134
|
-
export type NWCWalletInfo = typeof NWCWalletInfo;
|
|
135
|
-
export declare const LightningPubRPC = 21000;
|
|
136
|
-
export type LightningPubRPC = typeof LightningPubRPC;
|
|
137
|
-
export declare const ClientAuth = 22242;
|
|
138
|
-
export type ClientAuth = typeof ClientAuth;
|
|
139
|
-
export declare const NWCWalletRequest = 23194;
|
|
140
|
-
export type NWCWalletRequest = typeof NWCWalletRequest;
|
|
141
|
-
export declare const NWCWalletResponse = 23195;
|
|
142
|
-
export type NWCWalletResponse = typeof NWCWalletResponse;
|
|
143
|
-
export declare const NostrConnect = 24133;
|
|
144
|
-
export type NostrConnect = typeof NostrConnect;
|
|
145
|
-
export declare const HTTPAuth = 27235;
|
|
146
|
-
export type HTTPAuth = typeof HTTPAuth;
|
|
147
|
-
export declare const Followsets = 30000;
|
|
148
|
-
export type Followsets = typeof Followsets;
|
|
149
|
-
export declare const Genericlists = 30001;
|
|
150
|
-
export type Genericlists = typeof Genericlists;
|
|
151
|
-
export declare const Relaysets = 30002;
|
|
152
|
-
export type Relaysets = typeof Relaysets;
|
|
153
|
-
export declare const Bookmarksets = 30003;
|
|
154
|
-
export type Bookmarksets = typeof Bookmarksets;
|
|
155
|
-
export declare const Curationsets = 30004;
|
|
156
|
-
export type Curationsets = typeof Curationsets;
|
|
157
|
-
export declare const ProfileBadges = 30008;
|
|
158
|
-
export type ProfileBadges = typeof ProfileBadges;
|
|
159
|
-
export declare const BadgeDefinition = 30009;
|
|
160
|
-
export type BadgeDefinition = typeof BadgeDefinition;
|
|
161
|
-
export declare const Interestsets = 30015;
|
|
162
|
-
export type Interestsets = typeof Interestsets;
|
|
163
|
-
export declare const CreateOrUpdateStall = 30017;
|
|
164
|
-
export type CreateOrUpdateStall = typeof CreateOrUpdateStall;
|
|
165
|
-
export declare const CreateOrUpdateProduct = 30018;
|
|
166
|
-
export type CreateOrUpdateProduct = typeof CreateOrUpdateProduct;
|
|
167
|
-
export declare const LongFormArticle = 30023;
|
|
168
|
-
export type LongFormArticle = typeof LongFormArticle;
|
|
169
|
-
export declare const DraftLong = 30024;
|
|
170
|
-
export type DraftLong = typeof DraftLong;
|
|
171
|
-
export declare const Emojisets = 30030;
|
|
172
|
-
export type Emojisets = typeof Emojisets;
|
|
173
|
-
export declare const Application = 30078;
|
|
174
|
-
export type Application = typeof Application;
|
|
175
|
-
export declare const LiveEvent = 30311;
|
|
176
|
-
export type LiveEvent = typeof LiveEvent;
|
|
177
|
-
export declare const UserStatuses = 30315;
|
|
178
|
-
export type UserStatuses = typeof UserStatuses;
|
|
179
|
-
export declare const ClassifiedListing = 30402;
|
|
180
|
-
export type ClassifiedListing = typeof ClassifiedListing;
|
|
181
|
-
export declare const DraftClassifiedListing = 30403;
|
|
182
|
-
export type DraftClassifiedListing = typeof DraftClassifiedListing;
|
|
183
|
-
export declare const Date = 31922;
|
|
184
|
-
export type Date = typeof Date;
|
|
185
|
-
export declare const Time = 31923;
|
|
186
|
-
export type Time = typeof Time;
|
|
187
|
-
export declare const Calendar = 31924;
|
|
188
|
-
export type Calendar = typeof Calendar;
|
|
189
|
-
export declare const CalendarEventRSVP = 31925;
|
|
190
|
-
export type CalendarEventRSVP = typeof CalendarEventRSVP;
|
|
191
|
-
export declare const RelayReview = 31987;
|
|
192
|
-
export type RelayReview = typeof RelayReview;
|
|
193
|
-
export declare const Handlerrecommendation = 31989;
|
|
194
|
-
export type Handlerrecommendation = typeof Handlerrecommendation;
|
|
195
|
-
export declare const Handlerinformation = 31990;
|
|
196
|
-
export type Handlerinformation = typeof Handlerinformation;
|
|
197
|
-
export declare const CommunityDefinition = 34550;
|
|
198
|
-
export type CommunityDefinition = typeof CommunityDefinition;
|
|
199
|
-
export declare const GroupMetadata = 39000;
|
|
200
|
-
export type GroupMetadata = typeof GroupMetadata;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip04.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip05.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ProfilePointer } from './nip19.ts';
|
|
2
|
-
export type Nip05 = `${string}@${string}`;
|
|
3
|
-
/**
|
|
4
|
-
* NIP-05 regex. The localpart is optional, and should be assumed to be `_` otherwise.
|
|
5
|
-
*
|
|
6
|
-
* - 0: full match
|
|
7
|
-
* - 1: name (optional)
|
|
8
|
-
* - 2: domain
|
|
9
|
-
*/
|
|
10
|
-
export declare const NIP05_REGEX: RegExp;
|
|
11
|
-
export declare const isNip05: (value?: string | null) => value is Nip05;
|
|
12
|
-
export declare function useFetchImplementation(fetchImplementation: unknown): void;
|
|
13
|
-
export declare function searchDomain(domain: string, query?: string): Promise<{
|
|
14
|
-
[name: string]: string;
|
|
15
|
-
}>;
|
|
16
|
-
export declare function queryProfile(fullname: string): Promise<ProfilePointer | null>;
|
|
17
|
-
export declare function isValid(pubkey: string, nip05: Nip05): Promise<boolean>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip06.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare function privateKeyFromSeedWords(mnemonic: string, passphrase?: string, accountIndex?: number): Uint8Array;
|
|
2
|
-
export declare function accountFromSeedWords(mnemonic: string, passphrase?: string, accountIndex?: number): {
|
|
3
|
-
privateKey: Uint8Array;
|
|
4
|
-
publicKey: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function extendedKeysFromSeedWords(mnemonic: string, passphrase?: string, extendedAccountIndex?: number): {
|
|
7
|
-
privateExtendedKey: string;
|
|
8
|
-
publicExtendedKey: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function accountFromExtendedKey(base58key: string, accountIndex?: number): {
|
|
11
|
-
privateKey?: Uint8Array;
|
|
12
|
-
publicKey: string;
|
|
13
|
-
};
|
|
14
|
-
export declare function generateSeedWords(): string;
|
|
15
|
-
export declare function validateWords(words: string): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/nip07.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { EventTemplate, VerifiedEvent } from './core.ts';
|
|
2
|
-
export interface WindowNostr {
|
|
3
|
-
getPublicKey(): Promise<string>;
|
|
4
|
-
signEvent(event: EventTemplate): Promise<VerifiedEvent>;
|
|
5
|
-
nip04?: {
|
|
6
|
-
encrypt(pubkey: string, plaintext: string): Promise<string>;
|
|
7
|
-
decrypt(pubkey: string, ciphertext: string): Promise<string>;
|
|
8
|
-
};
|
|
9
|
-
nip44?: {
|
|
10
|
-
encrypt(pubkey: string, plaintext: string): Promise<string>;
|
|
11
|
-
decrypt(pubkey: string, ciphertext: string): Promise<string>;
|
|
12
|
-
};
|
|
13
|
-
}
|
package/lib/types/nip10.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Event } from './core.ts';
|
|
2
|
-
import type { EventPointer, ProfilePointer } from './nip19.ts';
|
|
3
|
-
export declare function parse(event: Pick<Event, 'tags'>): {
|
|
4
|
-
/**
|
|
5
|
-
* Pointer to the root of the thread.
|
|
6
|
-
*/
|
|
7
|
-
root: EventPointer | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* Pointer to a "parent" event that parsed event replies to (responded to).
|
|
10
|
-
*/
|
|
11
|
-
reply: EventPointer | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Pointers to events that may or may not be in the reply chain.
|
|
14
|
-
*/
|
|
15
|
-
mentions: EventPointer[];
|
|
16
|
-
/**
|
|
17
|
-
* Pointers to events that were directly quoted.
|
|
18
|
-
*/
|
|
19
|
-
quotes: EventPointer[];
|
|
20
|
-
/**
|
|
21
|
-
* List of pubkeys that are involved in the thread in no particular order.
|
|
22
|
-
*/
|
|
23
|
-
profiles: ProfilePointer[];
|
|
24
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|