From 614d9500838a7221e32ada3018ec9866d37d0781 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 18 Dec 2024 01:58:50 -0600 Subject: [PATCH] Switch bunker to nip44 encryption https://gitlab.com/soapbox-pub/ditto/-/issues/279 --- src/features/nostr/NBunker.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/features/nostr/NBunker.ts b/src/features/nostr/NBunker.ts index 078d22a83..6b7cbc3ad 100644 --- a/src/features/nostr/NBunker.ts +++ b/src/features/nostr/NBunker.ts @@ -183,7 +183,7 @@ export class NBunker { private async sendResponse(pubkey: string, response: NostrConnectResponse): Promise { const { bunkerSigner, relay } = this.opts; - const content = await bunkerSigner.nip04!.encrypt(pubkey, JSON.stringify(response)); + const content = await bunkerSigner.nip44!.encrypt(pubkey, JSON.stringify(response)); const event = await bunkerSigner.signEvent({ kind: 24133, @@ -198,11 +198,7 @@ export class NBunker { /** Auto-decrypt NIP-44 or NIP-04 ciphertext. */ private async decrypt(pubkey: string, ciphertext: string): Promise { const { bunkerSigner } = this.opts; - try { - return await bunkerSigner.nip44!.decrypt(pubkey, ciphertext); - } catch { - return await bunkerSigner.nip04!.decrypt(pubkey, ciphertext); - } + return await bunkerSigner.nip44!.decrypt(pubkey, ciphertext); } /** Authorize the pubkey to perform signer actions (ie any other actions besides `connect`). */