Closed alexgleason closed 1 year ago
See: https://github.com/nbd-wtf/nostr-tools/pull/241
bech32.encode('npub', ...)
`npub1${string}`
bech32.encode('bc', ...)
`bc1${string}`
bech32.encode('BC', ...)
bech32.decode('npub1...' as `npub1${string}`) will return Bech32Decoded<'npub'> where the prefix is already identified.
bech32.decode('npub1...' as `npub1${string}`)
Bech32Decoded<'npub'>
The benefit is that we sometimes know the type of the thing we're decoding and can have more convenient types.
This should be a non-breaking change.
See: https://github.com/nbd-wtf/nostr-tools/pull/241
bech32.encode('npub', ...)
will return a type of`npub1${string}`
bech32.encode('bc', ...)
will return a type of`bc1${string}`
bech32.encode('BC', ...)
will return a type of`bc1${string}`
bech32.decode('npub1...' as `npub1${string}`)
will returnBech32Decoded<'npub'>
where the prefix is already identified.The benefit is that we sometimes know the type of the thing we're decoding and can have more convenient types.
This should be a non-breaking change.