@konemono/nostr-login 1.11.1 → 1.11.3
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/dist/index.esm.js +12 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/modules/Nip46.d.ts +16 -25
- package/dist/unpkg.js +12 -23
- package/package.json +1 -1
- package/src/modules/AuthNostrService.ts +43 -24
- package/src/modules/ModalManager.ts +2 -3
- package/src/modules/Nip46.ts +121 -227
- package/src/modules/Signer.ts +1 -2
- package/src/utils/index.ts +4 -5
- package/src/utils/nip44.ts +1 -2
package/dist/modules/Nip46.d.ts
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
import NDK, { NDKEvent, NDKFilter, NDKNip46Signer, NDKNostrRpc, NDKRpcRequest, NDKRpcResponse, NDKSubscription } from '@nostr-dev-kit/ndk';
|
|
1
|
+
import NDK, { NDKEvent, NDKFilter, NDKNip46Signer, NDKNostrRpc, NDKRpcRequest, NDKRpcResponse, NDKSubscription, NDKUser, NostrEvent } from '@nostr-dev-kit/ndk';
|
|
2
2
|
import { PrivateKeySigner } from './Signer';
|
|
3
|
-
/**
|
|
4
|
-
* NDKのリレー接続を待機する
|
|
5
|
-
*/
|
|
6
|
-
export declare function waitForConnection(ndk: NDK, timeout: number): Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* NDKの接続を強制的に確立する
|
|
9
|
-
*/
|
|
10
|
-
export declare function ensureNDKConnection(ndk: NDK, timeout: number): Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* NIP-46専用リレーも含めて接続を確立する
|
|
13
|
-
*/
|
|
14
|
-
export declare function ensureNIP46Connection(ndk: NDK, timeout: number): Promise<void>;
|
|
15
3
|
declare class NostrRpc extends NDKNostrRpc {
|
|
16
4
|
protected _ndk: NDK;
|
|
17
5
|
protected _signer: PrivateKeySigner;
|
|
18
6
|
protected requests: Set<string>;
|
|
19
7
|
private sub?;
|
|
20
8
|
protected _useNip44: boolean;
|
|
21
|
-
private
|
|
22
|
-
private maxReconnectAttempts;
|
|
23
|
-
private reconnectDelay;
|
|
9
|
+
private eventEmitter;
|
|
24
10
|
constructor(ndk: NDK, signer: PrivateKeySigner);
|
|
25
11
|
subscribe(filter: NDKFilter): Promise<NDKSubscription>;
|
|
26
12
|
stop(): void;
|
|
@@ -31,26 +17,21 @@ declare class NostrRpc extends NDKNostrRpc {
|
|
|
31
17
|
listen(nostrConnectSecret: string): Promise<string>;
|
|
32
18
|
connect(pubkey: string, token?: string, perms?: string): Promise<void>;
|
|
33
19
|
connectWithTimeout(pubkey: string, token?: string, perms?: string, timeoutMs?: number): Promise<void>;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
private ensureConnected;
|
|
37
|
-
protected reconnect(): Promise<void>;
|
|
20
|
+
ping(remotePubkey: string): Promise<void>;
|
|
21
|
+
pingWithTimeout(remotePubkey: string, timeoutMs?: number): Promise<void>;
|
|
38
22
|
protected getId(): string;
|
|
39
23
|
sendRequest(remotePubkey: string, method: string, params?: string[], kind?: number, cb?: (res: NDKRpcResponse) => void): Promise<NDKRpcResponse>;
|
|
40
24
|
protected setResponseHandler(id: string, cb?: (res: NDKRpcResponse) => void): Promise<NDKRpcResponse>;
|
|
41
25
|
protected createRequestEvent(id: string, remotePubkey: string, method: string, params?: string[], kind?: number): Promise<NDKEvent>;
|
|
26
|
+
on: <EventKey extends string | symbol = string>(event: EventKey, listener: (...args: any[]) => void) => this;
|
|
27
|
+
emit: <EventKey extends string | symbol = string>(event: EventKey, ...args: any[]) => boolean;
|
|
42
28
|
}
|
|
43
29
|
export declare class IframeNostrRpc extends NostrRpc {
|
|
44
30
|
private peerOrigin?;
|
|
45
31
|
private iframePort?;
|
|
46
32
|
private iframeRequests;
|
|
47
|
-
private heartbeatInterval?;
|
|
48
|
-
private lastResponseTime;
|
|
49
|
-
private heartbeatTimeoutMs;
|
|
50
33
|
constructor(ndk: NDK, localSigner: PrivateKeySigner, iframePeerOrigin?: string);
|
|
51
34
|
subscribe(filter: NDKFilter): Promise<NDKSubscription>;
|
|
52
|
-
private startHeartbeat;
|
|
53
|
-
private stopHeartbeat;
|
|
54
35
|
setWorkerIframePort(port: MessagePort): void;
|
|
55
36
|
sendRequest(remotePubkey: string, method: string, params?: string[], kind?: number, cb?: (res: NDKRpcResponse) => void): Promise<NDKRpcResponse>;
|
|
56
37
|
}
|
|
@@ -64,18 +45,28 @@ export declare class ReadyListener {
|
|
|
64
45
|
export declare class Nip46Signer extends NDKNip46Signer {
|
|
65
46
|
private _userPubkey;
|
|
66
47
|
private _rpc;
|
|
48
|
+
private lastPingTime;
|
|
49
|
+
private pingCacheDuration;
|
|
50
|
+
private _remotePubkey?;
|
|
67
51
|
constructor(ndk: NDK, localSigner: PrivateKeySigner, signerPubkey: string, iframeOrigin?: string);
|
|
68
52
|
get userPubkey(): string;
|
|
53
|
+
get remotePubkeyAccessor(): string | undefined;
|
|
54
|
+
set remotePubkeyAccessor(value: string | undefined);
|
|
55
|
+
private ensureConnection;
|
|
69
56
|
private setSignerPubkey;
|
|
70
57
|
initUserPubkey(hintPubkey?: string): Promise<void>;
|
|
71
58
|
listen(nostrConnectSecret: string): Promise<void>;
|
|
72
59
|
connect(token?: string, perms?: string): Promise<void>;
|
|
73
60
|
setListenReply(reply: any, nostrConnectSecret: string): Promise<void>;
|
|
61
|
+
sign(event: NostrEvent): Promise<string>;
|
|
62
|
+
encrypt(recipient: NDKUser, value: string): Promise<string>;
|
|
63
|
+
decrypt(sender: NDKUser, value: string): Promise<string>;
|
|
74
64
|
createAccount2({ bunkerPubkey, name, domain, perms }: {
|
|
75
65
|
bunkerPubkey: string;
|
|
76
66
|
name: string;
|
|
77
67
|
domain: string;
|
|
78
68
|
perms?: string;
|
|
79
69
|
}): Promise<string>;
|
|
70
|
+
emit: <EventKey extends string | symbol = string>(event: EventKey, ...args: any[]) => boolean;
|
|
80
71
|
}
|
|
81
72
|
export {};
|