lnurl

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Helper functions for encoding and decoding (LNURLs) which are used to specify which VASP controls a specific virtual asset address. OpenVASP and TRP both use LNURLs to facilitate travel rule transfers and the TRISA protocol recommends its use.

https://www.21analytics.ch/blog/lnurl-for-fatf-travel-rule-software-solution/

The bech32 implementation of the bech32 format specified in BIP 173 was ported from https://github.com/fiatjaf/go-lnurl per their MIT license and the test cases from the BIP were ported from the https://github.com/btcsuite/btcd repository per their ISC license.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnhandledScheme        = errors.New("unhandled lnurl scheme")
	ErrMixedCase              = errors.New("string is not all lowercase or all uppercase")
	ErrInvalidBitGroups       = errors.New("only bit groups between 1 and 8 allowed")
	ErrInvalidIncompleteGroup = errors.New("invalid incomplete group")
)

Functions

func Decode

func Decode(lnurl string) (url string, err error)

Decode a bech32 encoded lnurl string and returns a plain-text https URL.

func Encode

func Encode(url string) (lnurl string, err error)

Encode a plain-text https URL into a bech32-encoded uppercased lnurl string.

Types

type ErrInvalidCharacter

type ErrInvalidCharacter rune

ErrInvalidCharacter is returned when the bech32 string has a character outside the range of the supported charset.

func (ErrInvalidCharacter) Error

func (e ErrInvalidCharacter) Error() string

type ErrInvalidChecksum

type ErrInvalidChecksum struct {
	Expected string
	Actual   string
}

ErrInvalidChecksum is returned when the extracted checksum of the string is different than what was expected.

func (ErrInvalidChecksum) Error

func (e ErrInvalidChecksum) Error() string

type ErrInvalidDataByte

type ErrInvalidDataByte byte

ErrInvalidDataByte is returned when a byte outside the range required for conversion into a string was found.

func (ErrInvalidDataByte) Error

func (e ErrInvalidDataByte) Error() string

type ErrInvalidSeparatorIndex

type ErrInvalidSeparatorIndex int

ErrInvalidSeparatorIndex is returned when the separator character '1' is in an invalid position in the bech32 string.

func (ErrInvalidSeparatorIndex) Error

func (e ErrInvalidSeparatorIndex) Error() string

type ErrNonCharsetChar

type ErrNonCharsetChar rune

ErrNonCharsetChar is returned when a character outside of the specific bech32 charset is used in the string.

func (ErrNonCharsetChar) Error

func (e ErrNonCharsetChar) Error() string

Jump to

Keyboard shortcuts

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