paulmillr / scure-base

Secure, audited & 0-deps implementation of bech32, base64, base32, base16 & base58
https://paulmillr.com/noble/#scure
MIT License
106 stars 13 forks source link

bech32: use template literal type #15

Closed alexgleason closed 1 year ago

alexgleason commented 1 year ago

See: https://github.com/nbd-wtf/nostr-tools/pull/241

bech32.decode('npub1...' as `npub1${string}`) will return Bech32Decoded<'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.