I have been hacking on it today, but it seems to me thay the bech32 class in bitwasp does not play nice with tlv. I have no idea why, also the decode function does not allow for bechs longer than 90 chara,but in nostr-tools this limit is raised to 5000. I feel I need to fork and improve the bech32 encoding/decoding functions. What are your thoughts on this?
nostr:npub1efz8l77esdtpw6l359sjvakm7azvyv6mkuxphjdk3vfzkgxkatrqlpf9s4 I'm working on a full integration of NIP-19 in nostr:npub1phpdev2d38u5hzs4jrsh360mevh0rjctu9669quy97wu23u8sqdqpfha0j but as regular webdeveloper I'm struggling to write the correct low-level stuff with the encoding/decoding with the bits and bytes before all is being encoded with the bech32 helper.
Work in progress: https://github.com/nostrver-se/nostr-php/tree/nip19 and this is the writeTLVEntry() method where I'm taking care of this: https://github.com/nostrver-se/nostr-php/blob/nip19/src/Nip19/Nip19Helper.php#L200.
So I'm looking for some help / guidance 🤓 Can you help me along? 🙏
Discussion
Can this help?
https://github.com/nostrver-se/nostr-php/issues/74
My idea: fork it, change it, show it how it works (I don't this either, that's the part I need to learn) and reach out to the maintainers with your findings (but I see there is not much activity in the repo)?
Yes, doing that indeed, I will just recreate something based on de scure-base typescript repo
Note from nostr:npub100mahqlhxg50thmt5dyynu40nl25hat9kkkknzk8pqjfkvgq0xsqtdfyy5 he shared in the Nostr-PHP telegram group:
Apparently the 90 char limit is in the bech32 BIP https://bips.xyz/173#bech32
The library author probably didn't think of bech32 being used for anything other than encoding P2WPKH/P2WSH addresses
Still have to provide documentation, but it now supports different Bech32 kinds: https://github.com/nostriphant/nip-19
No, I thought that something like that was the case 😅