Skip to content

Commit fa99657

Browse files
authored
chore: convert info.pubkey from bech32 to hex for nip-11 (#355)
1 parent 4cf24b9 commit fa99657

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/handlers/request-handlers/root-request-handler.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import { path } from 'ramda'
33

44
import { createSettings } from '../../factories/settings-factory'
55
import { FeeSchedule } from '../../@types/settings'
6+
import { fromBech32 } from '../../utils/transform'
67
import packageJson from '../../../package.json'
78

89
export const rootRequestHandler = (request: Request, response: Response, next: NextFunction) => {
910
const settings = createSettings()
1011

1112
if (request.header('accept') === 'application/nostr+json') {
1213
const {
13-
info: { name, description, pubkey, contact, relay_url },
14+
info: { name, description, pubkey: rawPubkey, contact, relay_url },
1415
} = settings
1516

1617
const paymentsUrl = new URL(relay_url)
@@ -19,6 +20,10 @@ export const rootRequestHandler = (request: Request, response: Response, next: N
1920

2021
const content = settings.limits?.event?.content
2122

23+
const pubkey = rawPubkey.startsWith('npub1')
24+
? fromBech32(rawPubkey)
25+
: rawPubkey
26+
2227
const relayInformationDocument = {
2328
name,
2429
description,

0 commit comments

Comments
 (0)