bech32

package
v0.0.0-...-40260bb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package bech32 implements bech32 encoding and decoding.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength    = errors.New("invalid length")
	ErrMissingSeparator = errors.New("missing separator '" + string(separator) + "'")
	ErrInvalidSeparator = errors.New("separator '" + string(separator) + "' at invalid position")
	ErrMixedCase        = errors.New("mixed case")
	ErrInvalidCharacter = errors.New("invalid character")
	ErrInvalidChecksum  = errors.New("invalid checksum")
)

Errors reported during bech32 decoding.

Functions

func Decode

func Decode(s string) (string, []byte, error)

Decode decodes the Bech32 string s into its human-readable and data part. It returns an error when s does not represent a valid Bech32 encoding. An SyntaxError is returned when the error can be matched to a certain position in s.

func Encode

func Encode(hrp string, src []byte) (string, error)

Encode encodes the hrp string and the src data as a Bech32 string. It returns an error when the input is invalid.

Types

type SyntaxError

type SyntaxError struct {
	Offset int // error occurred after reading Offset bytes
	// contains filtered or unexported fields
}

A SyntaxError is a description of a Bech32 syntax error.

func (*SyntaxError) Error

func (e *SyntaxError) Error() string

func (*SyntaxError) Unwrap

func (e *SyntaxError) Unwrap() error

Directories

Path Synopsis
Package address provides utility functionality to encode and decode bech32 based addresses.
Package address provides utility functionality to encode and decode bech32 based addresses.
internal
base32
Package base32 implements the conversion for bytes (base256) to base32.
Package base32 implements the conversion for bytes (base256) to base32.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL