From fa99657b4a3144677d5fae9254b2a5916e07d556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Arturo=20Cabral=20Mej=C3=ADa?= Date: Fri, 12 Jan 2024 01:22:03 -0500 Subject: [PATCH] chore: convert info.pubkey from bech32 to hex for nip-11 (#355) --- src/handlers/request-handlers/root-request-handler.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/handlers/request-handlers/root-request-handler.ts b/src/handlers/request-handlers/root-request-handler.ts index d9450334..0e88bb8d 100644 --- a/src/handlers/request-handlers/root-request-handler.ts +++ b/src/handlers/request-handlers/root-request-handler.ts @@ -3,6 +3,7 @@ import { path } from 'ramda' import { createSettings } from '../../factories/settings-factory' import { FeeSchedule } from '../../@types/settings' +import { fromBech32 } from '../../utils/transform' import packageJson from '../../../package.json' export const rootRequestHandler = (request: Request, response: Response, next: NextFunction) => { @@ -10,7 +11,7 @@ export const rootRequestHandler = (request: Request, response: Response, next: N if (request.header('accept') === 'application/nostr+json') { const { - info: { name, description, pubkey, contact, relay_url }, + info: { name, description, pubkey: rawPubkey, contact, relay_url }, } = settings const paymentsUrl = new URL(relay_url) @@ -19,6 +20,10 @@ export const rootRequestHandler = (request: Request, response: Response, next: N const content = settings.limits?.event?.content + const pubkey = rawPubkey.startsWith('npub1') + ? fromBech32(rawPubkey) + : rawPubkey + const relayInformationDocument = { name, description,