Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/libauth/src/lib/address/bech32.ts

An ultra-lightweight, zero-dependency JavaScript library for Bitcoin Cash, Bitcoin, and Bitauth applications.
Latest
import * as libauth from "https://deno.land/x/libauth@v2.0.0-alpha.9/src/lib/address/bech32.ts";

Variables

The list of 32 symbols used in Bech32 encoding.

An object mapping each of the 32 symbols used in Bech32 encoding to their respective index in the character set.

Convert a padded bech32-encoded string (without checksum) to a Uint8Array, removing the padding. If the string is not valid Bech32, or if the array of 5-bit integers would require padding to be regrouped into 8-bit bytes, this method returns an error message.

Convert a Uint8Array to a padded bech32-encoded string (without a checksum), adding padding bits as necessary to convert all bytes to 5-bit integers.

Decode a Bech32-encoded string into an array of 5-bit integers.

Encode an array of numbers as a base32 string using the Bech32 character set.

Validate that a string uses only characters from the bech32 character set.

Given an array of integers, regroup bits from sourceWordLength to resultWordLength, returning a new array of integers between 0 and toWordLength^2.