fix nip19: relays TLV items are optional.

This commit is contained in:
fiatjaf
2023-02-26 07:44:00 -03:00
parent 9530849f0a
commit 27749d91b8
3 changed files with 16 additions and 4 deletions

View File

@@ -56,3 +56,15 @@ test('encode and decode naddr', () => {
expect(data.kind).toEqual(30023)
expect(data.identifier).toEqual('banana')
})
test('encode and decode naddr from habla.news', () => {
let {type, data} = nip19.decode(
'naddr1qq98yetxv4ex2mnrv4esygrl54h466tz4v0re4pyuavvxqptsejl0vxcmnhfl60z3rth2xkpjspsgqqqw4rsf34vl5'
)
expect(type).toEqual('naddr')
expect(data.pubkey).toEqual(
'7fa56f5d6962ab1e3cd424e758c3002b8665f7b0d8dcee9fe9e288d7751ac194'
)
expect(data.kind).toEqual(30023)
expect(data.identifier).toEqual('references')
})