Skip to content

Commit

Permalink
chore: convert info.pubkey from bech32 to hex for nip-11
Browse files Browse the repository at this point in the history
  • Loading branch information
cameri committed Jan 12, 2024
1 parent 4cf24b9 commit 04e4ed3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/handlers/request-handlers/root-request-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ 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) => {
const settings = createSettings()

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)
Expand All @@ -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,
Expand Down

0 comments on commit 04e4ed3

Please sign in to comment.