diff --git a/src/signers/ConnectSigner.ts b/src/signers/ConnectSigner.ts index e7d61a8..4dda0b1 100644 --- a/src/signers/ConnectSigner.ts +++ b/src/signers/ConnectSigner.ts @@ -1,3 +1,4 @@ +// deno-lint-ignore-file require-await import { NConnectSigner } from '@nostrify/nostrify'; import { AdminSigner } from '@/signers/AdminSigner.ts'; @@ -9,18 +10,26 @@ import { Storages } from '@/storages.ts'; * Simple extension of nostrify's `NConnectSigner`, with our options to keep it DRY. */ export class ConnectSigner extends NConnectSigner { + private _pubkey: string; + constructor(pubkey: string, private relays?: string[]) { super({ pubkey, - // TODO: use a remote relay for `nprofile` signing, if present and Conf.relay isn't already in the list + // TODO: use a remote relay for `nprofile` signing (if present and `Conf.relay` isn't already in the list) relay: Storages.pubsub, signer: new AdminSigner(), timeout: 60000, }); + + this._pubkey = pubkey; + } + + // Prevent unnecessary NIP-46 round-trips. + async getPublicKey(): Promise { + return this._pubkey; } /** Get the user's relays if they passed in an `nprofile` auth token. */ - // deno-lint-ignore require-await async getRelays(): Promise> { return this.relays?.reduce>((acc, relay) => { acc[relay] = { read: true, write: true };