From 55ba4a3a9b304ebd2ccb82e20c45ae31f5ce5c0b Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 5 Apr 2024 17:39:33 -0500 Subject: [PATCH] Remove X-Nostr-Sign header support --- src/signers/APISigner.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/signers/APISigner.ts b/src/signers/APISigner.ts index cc4cde3..3960a1e 100644 --- a/src/signers/APISigner.ts +++ b/src/signers/APISigner.ts @@ -12,7 +12,7 @@ import { createAdminEvent } from '@/utils/api.ts'; * Sign Nostr event using the app context. * * - If a secret key is provided, it will be used to sign the event. - * - If `X-Nostr-Sign` is passed, it will use NIP-46 to sign the event. + * - Otherwise, it will use NIP-46 to sign the event. */ export class APISigner implements NostrSigner { #c: AppContext; @@ -34,21 +34,14 @@ export class APISigner implements NostrSigner { async signEvent(event: Omit): Promise { const seckey = this.#c.get('seckey'); - const header = this.#c.req.header('x-nostr-sign'); if (seckey) { this.#console.debug(`Signing Event<${event.kind}> with secret key`); return new NSecSigner(seckey).signEvent(event); } - if (header) { - this.#console.debug(`Signing Event<${event.kind}> with NIP-46`); - return await this.#signNostrConnect(event); - } - - throw new HTTPException(400, { - res: this.#c.json({ id: 'ditto.sign', error: 'Unable to sign event' }, 400), - }); + this.#console.debug(`Signing Event<${event.kind}> with NIP-46`); + return await this.#signNostrConnect(event); } /** Sign event with NIP-46, waiting in the background for the signed event. */