From 5a63c75f2443c46c4f5c214f4ce88c32068a58c6 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sun, 26 Mar 2023 09:35:42 -0300 Subject: [PATCH] nevent author is not mandatory. --- nip19.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nip19.ts b/nip19.ts index dd08ffe..628abd5 100644 --- a/nip19.ts +++ b/nip19.ts @@ -48,7 +48,8 @@ export function decode(nip19: string): { let tlv = parseTLV(data) if (!tlv[0]?.[0]) throw new Error('missing TLV 0 for nevent') if (tlv[0][0].length !== 32) throw new Error('TLV 0 should be 32 bytes') - if (tlv[2]?.[0].length !== 32) throw new Error('TLV 2 should be 32 bytes') + if (tlv[2] && tlv[2][0].length !== 32) + throw new Error('TLV 2 should be 32 bytes') return { type: 'nevent',