applesauce-signers 0.0.0-next-20250128152442

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.
@@ -0,0 +1,327 @@
1
+ import { kinds, verifyEvent } from "nostr-tools";
2
+ import { SimpleSigner } from "applesauce-signers";
3
+ import { createDefer } from "applesauce-core/promise";
4
+ import { isHexKey, unixNow } from "applesauce-core/helpers";
5
+ import { logger } from "applesauce-core";
6
+ import { getPublicKey } from "nostr-tools";
7
+ import { nanoid } from "nanoid";
8
+ import { isNIP04 } from "../helpers/encryption.js";
9
+ export function isErrorResponse(response) {
10
+ return !!response.error;
11
+ }
12
+ export var Permission;
13
+ (function (Permission) {
14
+ Permission["GetPublicKey"] = "get_pubic_key";
15
+ Permission["SignEvent"] = "sign_event";
16
+ Permission["Nip04Encrypt"] = "nip04_encrypt";
17
+ Permission["Nip04Decrypt"] = "nip04_decrypt";
18
+ Permission["Nip44Encrypt"] = "nip44_encrypt";
19
+ Permission["Nip44Decrypt"] = "nip44_decrypt";
20
+ })(Permission || (Permission = {}));
21
+ export var NostrConnectMethod;
22
+ (function (NostrConnectMethod) {
23
+ NostrConnectMethod["Connect"] = "connect";
24
+ NostrConnectMethod["CreateAccount"] = "create_account";
25
+ NostrConnectMethod["GetPublicKey"] = "get_public_key";
26
+ NostrConnectMethod["SignEvent"] = "sign_event";
27
+ NostrConnectMethod["Nip04Encrypt"] = "nip04_encrypt";
28
+ NostrConnectMethod["Nip04Decrypt"] = "nip04_decrypt";
29
+ NostrConnectMethod["Nip44Encrypt"] = "nip44_encrypt";
30
+ NostrConnectMethod["Nip44Decrypt"] = "nip44_decrypt";
31
+ })(NostrConnectMethod || (NostrConnectMethod = {}));
32
+ async function defaultHandleAuth(url) {
33
+ window.open(url, "auth", "width=400,height=600,resizable=no,status=no,location=no,toolbar=no,menubar=no");
34
+ }
35
+ export class NostrConnectSigner {
36
+ /** A method that is called when the subscription needs to be updated */
37
+ onSubOpen;
38
+ /** A method called when the subscription should be closed */
39
+ onSubClose;
40
+ /** A method that is called when an event needs to be published */
41
+ onPublishEvent;
42
+ // protected pool: IConnectionPool;
43
+ // protected sub: MultiSubscription;
44
+ log = logger.extend("NostrConnectSigner");
45
+ /** The local client signer */
46
+ signer;
47
+ subscriptionOpen = false;
48
+ /** Whether the signer is connected to the remote signer */
49
+ isConnected = false;
50
+ /** The users pubkey */
51
+ pubkey;
52
+ /** Relays to communicate over */
53
+ relays;
54
+ /** The remote signer pubkey */
55
+ remote;
56
+ /** Client pubkey */
57
+ get clientPubkey() {
58
+ return getPublicKey(this.signer.key);
59
+ }
60
+ onAuth = defaultHandleAuth;
61
+ verifyEvent = verifyEvent;
62
+ /** A secret used when initiating a connection from the client side */
63
+ clientSecret = nanoid(12);
64
+ nip04;
65
+ nip44;
66
+ constructor(opts) {
67
+ this.relays = opts.relays;
68
+ this.pubkey = opts.pubkey;
69
+ this.remote = opts.remote;
70
+ this.onSubOpen = opts.onSubOpen;
71
+ this.onSubClose = opts.onSubClose;
72
+ this.onPublishEvent = opts.onPublishEvent;
73
+ if (opts.onAuth)
74
+ this.onAuth = opts.onAuth;
75
+ this.signer = opts?.signer || new SimpleSigner();
76
+ this.nip04 = {
77
+ encrypt: this.nip04Encrypt.bind(this),
78
+ decrypt: this.nip04Decrypt.bind(this),
79
+ };
80
+ this.nip44 = {
81
+ encrypt: this.nip44Encrypt.bind(this),
82
+ decrypt: this.nip44Decrypt.bind(this),
83
+ };
84
+ }
85
+ /** Open the connection */
86
+ async open() {
87
+ if (this.subscriptionOpen)
88
+ return;
89
+ this.subscriptionOpen = true;
90
+ const pubkey = await this.signer.getPublicKey();
91
+ // Setup subscription
92
+ await this.onSubOpen?.([
93
+ {
94
+ kinds: [kinds.NostrConnect],
95
+ "#p": [pubkey],
96
+ },
97
+ ], this.relays, this.handleEvent.bind(this));
98
+ this.log("Opened", this.relays);
99
+ }
100
+ /** Close the connection */
101
+ async close() {
102
+ this.subscriptionOpen = false;
103
+ this.isConnected = false;
104
+ await this.onSubClose?.();
105
+ this.log("Closed");
106
+ }
107
+ requests = new Map();
108
+ auths = new Set();
109
+ /** Call this method with incoming events */
110
+ async handleEvent(event) {
111
+ if (!this.verifyEvent(event))
112
+ return;
113
+ // ignore the event if its not from the remote signer
114
+ if (this.remote && event.pubkey !== this.remote)
115
+ return;
116
+ try {
117
+ const responseStr = isNIP04(event.content)
118
+ ? await this.signer.nip04.decrypt(event.pubkey, event.content)
119
+ : await this.signer.nip44.decrypt(event.pubkey, event.content);
120
+ const response = JSON.parse(responseStr);
121
+ // handle remote signer connection
122
+ if (!this.remote && (response.result === "ack" || (this.clientSecret && response.result === this.clientSecret))) {
123
+ this.log("Got ack response from", event.pubkey, response.result);
124
+ this.isConnected = true;
125
+ this.remote = event.pubkey;
126
+ this.waitingPromise?.resolve();
127
+ this.waitingPromise = null;
128
+ return;
129
+ }
130
+ if (response.id) {
131
+ const p = this.requests.get(response.id);
132
+ if (!p)
133
+ return;
134
+ if (response.error) {
135
+ this.log("Got Error", response.id, response.result, response.error);
136
+ if (response.result === "auth_url") {
137
+ if (!this.auths.has(response.id)) {
138
+ this.auths.add(response.id);
139
+ if (this.onAuth) {
140
+ try {
141
+ await this.onAuth(response.error);
142
+ }
143
+ catch (e) {
144
+ p.reject(e);
145
+ }
146
+ }
147
+ }
148
+ }
149
+ else
150
+ p.reject(response);
151
+ }
152
+ else if (response.result) {
153
+ this.log("Got Response", response.id, response.result);
154
+ p.resolve(response.result);
155
+ }
156
+ }
157
+ }
158
+ catch (e) { }
159
+ }
160
+ async createRequestEvent(content, target = this.remote, kind = kinds.NostrConnect) {
161
+ if (!target)
162
+ throw new Error("Missing target pubkey");
163
+ return await this.signer.signEvent({
164
+ kind,
165
+ created_at: unixNow(),
166
+ tags: [["p", target]],
167
+ content,
168
+ });
169
+ }
170
+ async makeRequest(method, params, kind = kinds.NostrConnect) {
171
+ // Talk to the remote signer or the users pubkey
172
+ if (!this.remote)
173
+ throw new Error("Missing remote signer pubkey");
174
+ const id = nanoid(8);
175
+ const request = { id, method, params };
176
+ const encrypted = await this.signer.nip44.encrypt(this.remote, JSON.stringify(request));
177
+ const event = await this.createRequestEvent(encrypted, this.remote, kind);
178
+ this.log(`Sending request ${id} (${method}) ${JSON.stringify(params)}`);
179
+ const p = createDefer();
180
+ this.requests.set(id, p);
181
+ await this.onPublishEvent?.(event, this.relays);
182
+ return p;
183
+ }
184
+ /** Connect to remote signer */
185
+ async connect(secret, permissions) {
186
+ // Attempt to connect to the users pubkey if remote note set
187
+ if (!this.remote && this.pubkey)
188
+ this.remote = this.pubkey;
189
+ if (!this.remote)
190
+ throw new Error("Missing remote signer pubkey");
191
+ await this.open();
192
+ try {
193
+ const result = await this.makeRequest(NostrConnectMethod.Connect, [
194
+ this.remote,
195
+ secret || "",
196
+ permissions?.join(",") ?? "",
197
+ ]);
198
+ this.isConnected = true;
199
+ return result;
200
+ }
201
+ catch (e) {
202
+ this.isConnected = false;
203
+ this.close();
204
+ throw e;
205
+ }
206
+ }
207
+ waitingPromise = null;
208
+ /** Wait for a remote signer to connect */
209
+ waitForSigner() {
210
+ if (this.isConnected)
211
+ return Promise.resolve();
212
+ this.open();
213
+ this.waitingPromise = createDefer();
214
+ return this.waitingPromise;
215
+ }
216
+ /** Request to create an account on the remote signer */
217
+ async createAccount(username, domain, email, permissions) {
218
+ if (!this.remote)
219
+ throw new Error("Remote pubkey must be set");
220
+ await this.open();
221
+ try {
222
+ const newPubkey = await this.makeRequest(NostrConnectMethod.CreateAccount, [
223
+ username,
224
+ domain,
225
+ email ?? "",
226
+ permissions?.join(",") ?? "",
227
+ ]);
228
+ // set the users new pubkey
229
+ this.pubkey = newPubkey;
230
+ this.isConnected = true;
231
+ return newPubkey;
232
+ }
233
+ catch (e) {
234
+ this.isConnected = false;
235
+ this.close();
236
+ throw e;
237
+ }
238
+ }
239
+ /** Ensure the signer is connected to the remote signer */
240
+ async requireConnection() {
241
+ if (!this.isConnected)
242
+ await this.connect();
243
+ }
244
+ /** Get the users pubkey */
245
+ async getPublicKey() {
246
+ if (this.pubkey)
247
+ return this.pubkey;
248
+ await this.requireConnection();
249
+ return this.makeRequest(NostrConnectMethod.GetPublicKey, []);
250
+ }
251
+ /** Request to sign an event */
252
+ async signEvent(template) {
253
+ await this.requireConnection();
254
+ const eventString = await this.makeRequest(NostrConnectMethod.SignEvent, [JSON.stringify(template)]);
255
+ const event = JSON.parse(eventString);
256
+ if (!this.verifyEvent(event))
257
+ throw new Error("Invalid event");
258
+ return event;
259
+ }
260
+ // NIP-04
261
+ async nip04Encrypt(pubkey, plaintext) {
262
+ await this.requireConnection();
263
+ return this.makeRequest(NostrConnectMethod.Nip04Encrypt, [pubkey, plaintext]);
264
+ }
265
+ async nip04Decrypt(pubkey, ciphertext) {
266
+ await this.requireConnection();
267
+ const plaintext = await this.makeRequest(NostrConnectMethod.Nip04Decrypt, [pubkey, ciphertext]);
268
+ // NOTE: not sure why this is here, best guess is some signer used to return results as '["plaintext"]'
269
+ if (plaintext.startsWith('["') && plaintext.endsWith('"]'))
270
+ return JSON.parse(plaintext)[0];
271
+ return plaintext;
272
+ }
273
+ // NIP-44
274
+ async nip44Encrypt(pubkey, plaintext) {
275
+ await this.requireConnection();
276
+ return this.makeRequest(NostrConnectMethod.Nip44Encrypt, [pubkey, plaintext]);
277
+ }
278
+ async nip44Decrypt(pubkey, ciphertext) {
279
+ await this.requireConnection();
280
+ const plaintext = await this.makeRequest(NostrConnectMethod.Nip44Decrypt, [pubkey, ciphertext]);
281
+ // NOTE: not sure why this is here, best guess is some signer used to return results as '["plaintext"]'
282
+ if (plaintext.startsWith('["') && plaintext.endsWith('"]'))
283
+ return JSON.parse(plaintext)[0];
284
+ return plaintext;
285
+ }
286
+ /** Returns the nostrconnect:// URI for this signer */
287
+ getNostrConnectURI(metadata) {
288
+ const params = new URLSearchParams();
289
+ params.set("secret", this.clientSecret);
290
+ if (metadata?.name)
291
+ params.set("name", metadata.name);
292
+ if (metadata?.url)
293
+ params.set("url", String(metadata.url));
294
+ if (metadata?.image)
295
+ params.set("image", metadata.image);
296
+ if (metadata?.permissions)
297
+ params.set("perms", metadata.permissions.join(","));
298
+ for (const relay of this.relays)
299
+ params.append("relay", relay);
300
+ const client = getPublicKey(this.signer.key);
301
+ return `nostrconnect://${client}?` + params.toString();
302
+ }
303
+ /** Parses a bunker:// URI */
304
+ static parseBunkerURI(uri) {
305
+ const url = new URL(uri);
306
+ // firefox puts pubkey part in host, chrome puts pubkey in pathname
307
+ const remote = url.host || url.pathname.replace("//", "");
308
+ if (!isHexKey(remote))
309
+ throw new Error("Invalid connection URI");
310
+ const relays = url.searchParams.getAll("relay");
311
+ if (relays.length === 0)
312
+ throw new Error("Missing relays");
313
+ const secret = url.searchParams.get("secret") ?? undefined;
314
+ return { remote, relays, secret };
315
+ }
316
+ /** Builds an array of signing permissions for event kinds */
317
+ static buildSigningPermissions(kinds) {
318
+ return [Permission.GetPublicKey, ...kinds.map((k) => `${Permission.SignEvent}:${k}`)];
319
+ }
320
+ /** Create a {@link NostrConnectSigner} from a bunker:// URI */
321
+ static async fromBunkerURI(uri, options) {
322
+ const { remote, relays, secret } = NostrConnectSigner.parseBunkerURI(uri);
323
+ const client = new NostrConnectSigner({ relays, remote, ...options });
324
+ await client.connect(secret, options.permissions);
325
+ return client;
326
+ }
327
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { NostrConnectSigner } from "./nostr-connect-signer.js";
3
+ import { SimpleSigner } from "./simple-signer.js";
4
+ describe("NostrConnectSigner", () => {
5
+ describe("connection", () => {
6
+ it("should call onSubOpen with filters", async () => {
7
+ const relays = ["wss://relay.signer.com"];
8
+ const onSubOpen = vi.fn(async () => { });
9
+ const onSubClose = vi.fn(async () => { });
10
+ const onPublishEvent = vi.fn(async () => { });
11
+ const client = new SimpleSigner();
12
+ const remote = new SimpleSigner();
13
+ const signer = new NostrConnectSigner({
14
+ onSubOpen,
15
+ onSubClose,
16
+ onPublishEvent,
17
+ relays,
18
+ remote: await remote.getPublicKey(),
19
+ signer: client,
20
+ });
21
+ signer.connect();
22
+ expect(onSubOpen).toHaveBeenCalledWith([{ "#p": [await client.getPublicKey()], kinds: [24133] }], relays, expect.any(Function));
23
+ });
24
+ });
25
+ });
@@ -0,0 +1,29 @@
1
+ import { EventTemplate } from "nostr-tools";
2
+ import { Deferred } from "applesauce-core/promise";
3
+ import { Nip07Interface } from "../nip-07.js";
4
+ /** A NIP-49 (Private Key Encryption) signer */
5
+ export declare class PasswordSigner implements Nip07Interface {
6
+ key: Uint8Array | null;
7
+ ncryptsec?: string;
8
+ nip04: {
9
+ encrypt: (pubkey: string, plaintext: string) => Promise<string> | string;
10
+ decrypt: (pubkey: string, ciphertext: string) => Promise<string> | string;
11
+ };
12
+ nip44: {
13
+ encrypt: (pubkey: string, plaintext: string) => Promise<string> | string;
14
+ decrypt: (pubkey: string, ciphertext: string) => Promise<string> | string;
15
+ };
16
+ get unlocked(): boolean;
17
+ constructor();
18
+ unlockPromise?: Deferred<void>;
19
+ protected requestUnlock(): Deferred<void> | undefined;
20
+ setPassword(password: string): Promise<void>;
21
+ testPassword(password: string): Promise<void>;
22
+ unlock(password: string): Promise<void>;
23
+ getPublicKey(): Promise<string>;
24
+ signEvent(event: EventTemplate): Promise<import("nostr-tools").VerifiedEvent>;
25
+ nip04Encrypt(pubkey: string, plaintext: string): Promise<string>;
26
+ nip04Decrypt(pubkey: string, ciphertext: string): Promise<string>;
27
+ nip44Encrypt(pubkey: string, plaintext: string): Promise<string>;
28
+ nip44Decrypt(pubkey: string, ciphertext: string): Promise<string>;
29
+ }
@@ -0,0 +1,85 @@
1
+ import { finalizeEvent, getPublicKey, nip04, nip44 } from "nostr-tools";
2
+ import { encrypt, decrypt } from "nostr-tools/nip49";
3
+ import { createDefer } from "applesauce-core/promise";
4
+ /** A NIP-49 (Private Key Encryption) signer */
5
+ export class PasswordSigner {
6
+ key = null;
7
+ ncryptsec;
8
+ nip04;
9
+ nip44;
10
+ get unlocked() {
11
+ return !!this.key;
12
+ }
13
+ constructor() {
14
+ this.nip04 = {
15
+ encrypt: this.nip04Encrypt.bind(this),
16
+ decrypt: this.nip04Decrypt.bind(this),
17
+ };
18
+ this.nip44 = {
19
+ encrypt: this.nip44Encrypt.bind(this),
20
+ decrypt: this.nip44Decrypt.bind(this),
21
+ };
22
+ }
23
+ unlockPromise;
24
+ requestUnlock() {
25
+ if (this.key)
26
+ return;
27
+ if (this.unlockPromise)
28
+ return this.unlockPromise;
29
+ const p = createDefer();
30
+ this.unlockPromise = p;
31
+ return p;
32
+ }
33
+ async setPassword(password) {
34
+ if (!this.key)
35
+ throw new Error("Cant set password until unlocked");
36
+ this.ncryptsec = encrypt(this.key, password);
37
+ }
38
+ async testPassword(password) {
39
+ if (this.ncryptsec) {
40
+ const key = decrypt(this.ncryptsec, password);
41
+ if (!key)
42
+ throw new Error("Failed to decrypt key");
43
+ }
44
+ else
45
+ throw new Error("Missing ncryptsec");
46
+ }
47
+ async unlock(password) {
48
+ if (this.key)
49
+ return;
50
+ if (this.ncryptsec) {
51
+ this.key = decrypt(this.ncryptsec, password);
52
+ if (!this.key)
53
+ throw new Error("Failed to decrypt key");
54
+ }
55
+ else
56
+ throw new Error("Missing ncryptsec");
57
+ }
58
+ // public methods
59
+ async getPublicKey() {
60
+ await this.requestUnlock();
61
+ return getPublicKey(this.key);
62
+ }
63
+ async signEvent(event) {
64
+ await this.requestUnlock();
65
+ return finalizeEvent(event, this.key);
66
+ }
67
+ // NIP-04
68
+ async nip04Encrypt(pubkey, plaintext) {
69
+ await this.requestUnlock();
70
+ return nip04.encrypt(this.key, pubkey, plaintext);
71
+ }
72
+ async nip04Decrypt(pubkey, ciphertext) {
73
+ await this.requestUnlock();
74
+ return nip04.decrypt(this.key, pubkey, ciphertext);
75
+ }
76
+ // NIP-44
77
+ async nip44Encrypt(pubkey, plaintext) {
78
+ await this.requestUnlock();
79
+ return nip44.v2.encrypt(plaintext, nip44.v2.utils.getConversationKey(this.key, pubkey));
80
+ }
81
+ async nip44Decrypt(pubkey, ciphertext) {
82
+ await this.requestUnlock();
83
+ return nip44.v2.decrypt(ciphertext, nip44.v2.utils.getConversationKey(this.key, pubkey));
84
+ }
85
+ }
@@ -0,0 +1,22 @@
1
+ import { VerifiedEvent } from "nostr-tools";
2
+ import { Nip07Interface } from "../nip-07.js";
3
+ /** A signer that only implements getPublicKey and throws on ever other method */
4
+ export declare class ReadonlySigner implements Nip07Interface {
5
+ private pubkey;
6
+ nip04: {
7
+ encrypt: (pubkey: string, plaintext: string) => Promise<string> | string;
8
+ decrypt: (pubkey: string, ciphertext: string) => Promise<string> | string;
9
+ };
10
+ nip44: {
11
+ encrypt: (pubkey: string, plaintext: string) => Promise<string> | string;
12
+ decrypt: (pubkey: string, ciphertext: string) => Promise<string> | string;
13
+ };
14
+ constructor(pubkey: string);
15
+ getPublicKey(): string;
16
+ getRelays(): {};
17
+ signEvent(): VerifiedEvent;
18
+ nip04Encrypt(): string;
19
+ nip04Decrypt(): string;
20
+ nip44Encrypt(): string;
21
+ nip44Decrypt(): string;
22
+ }
@@ -0,0 +1,38 @@
1
+ /** A signer that only implements getPublicKey and throws on ever other method */
2
+ export class ReadonlySigner {
3
+ pubkey;
4
+ nip04;
5
+ nip44;
6
+ constructor(pubkey) {
7
+ this.pubkey = pubkey;
8
+ this.nip04 = {
9
+ encrypt: this.nip04Encrypt.bind(this),
10
+ decrypt: this.nip04Decrypt.bind(this),
11
+ };
12
+ this.nip44 = {
13
+ encrypt: this.nip44Encrypt.bind(this),
14
+ decrypt: this.nip44Decrypt.bind(this),
15
+ };
16
+ }
17
+ getPublicKey() {
18
+ return this.pubkey;
19
+ }
20
+ getRelays() {
21
+ return {};
22
+ }
23
+ signEvent() {
24
+ throw new Error("Cant sign events with readonly");
25
+ }
26
+ nip04Encrypt() {
27
+ throw new Error("Cant encrypt with readonly");
28
+ }
29
+ nip04Decrypt() {
30
+ throw new Error("Cant decrypt with readonly");
31
+ }
32
+ nip44Encrypt() {
33
+ throw new Error("Cant encrypt with readonly");
34
+ }
35
+ nip44Decrypt() {
36
+ throw new Error("Cant decrypt with readonly");
37
+ }
38
+ }
@@ -0,0 +1,56 @@
1
+ import { EventTemplate, verifyEvent } from "nostr-tools";
2
+ import { Deferred } from "applesauce-core/promise";
3
+ import { Nip07Interface } from "../nip-07.js";
4
+ type Callback = () => void;
5
+ type DeviceOpts = {
6
+ onConnect?: Callback;
7
+ onDisconnect?: Callback;
8
+ onError?: (err: Error) => void;
9
+ onDone?: Callback;
10
+ };
11
+ /** A signer that works with [nostr-signing-device](https://github.com/lnbits/nostr-signing-device) */
12
+ export declare class SerialPortSigner implements Nip07Interface {
13
+ protected log: import("debug").Debugger;
14
+ protected writer: WritableStreamDefaultWriter<string> | null;
15
+ pubkey?: string;
16
+ get isConnected(): boolean;
17
+ verifyEvent: typeof verifyEvent;
18
+ nip04: {
19
+ encrypt: (pubkey: string, plaintext: string) => Promise<string> | string;
20
+ decrypt: (pubkey: string, ciphertext: string) => Promise<string> | string;
21
+ };
22
+ constructor();
23
+ protected lastCommand: Deferred<string> | null;
24
+ callMethodOnDevice(method: string, params: string[], opts?: DeviceOpts): Promise<string>;
25
+ connectToDevice({ onConnect, onDisconnect, onError, onDone }: DeviceOpts): Promise<void>;
26
+ sendCommand(method: string, params?: string[]): Promise<void>;
27
+ protected readFromSerialPort(reader: ReadableStreamDefaultReader<string>): (separator?: string) => Promise<{
28
+ value: string;
29
+ done: boolean;
30
+ }>;
31
+ protected parseResponse(value: string): {
32
+ method: string;
33
+ data: string;
34
+ };
35
+ nip04Encrypt(pubkey: string, text: string): Promise<string>;
36
+ nip04Decrypt(pubkey: string, data: string): Promise<string>;
37
+ /** Returns the public key on the device */
38
+ getPublicKey(): Promise<string>;
39
+ /** Sets the secret key used on the device */
40
+ restore(secretKey: Uint8Array): Promise<void>;
41
+ /** Requires the device to sign an event */
42
+ signEvent(draft: EventTemplate & {
43
+ pubkey?: string;
44
+ }): Promise<import("nostr-tools").VerifiedEvent>;
45
+ /** Pings to device to see if the connection is open */
46
+ ping(): void;
47
+ static SUPPORTED: boolean;
48
+ static METHOD_PING: string;
49
+ static METHOD_LOG: string;
50
+ static METHOD_SIGN_MESSAGE: string;
51
+ static METHOD_SHARED_SECRET: string;
52
+ static METHOD_PUBLIC_KEY: string;
53
+ static METHOD_RESTORE: string;
54
+ static PUBLIC_METHODS: string[];
55
+ }
56
+ export {};