strkey

package
v1.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidVersionByte = errors.New("invalid version byte")

ErrInvalidVersionByte is returned when the version byte from a provided strkey-encoded string is not one of the valid values.

Functions

func Decode

func Decode(expected VersionByte, src string) ([]byte, error)

Decode decodes the provided StrKey into a raw value, checking the checksum and ensuring the expected VersionByte (the version parameter) is the value actually encoded into the provided src string.

func Encode

func Encode(version VersionByte, src []byte) (string, error)

Encode encodes the provided data to a StrKey, using the provided version byte.

func MustDecode

func MustDecode(expected VersionByte, src string) []byte

MustDecode is like Decode, but panics on error

func MustEncode

func MustEncode(version VersionByte, src []byte) string

MustEncode is like Encode, but panics on error

Types

type VersionByte

type VersionByte byte

VersionByte represents one of the possible prefix values for a StrKey base string--the string the when encoded using base58 yields a final StrKey.

const (
	// VersionByteAccountID is the version byte used for encoded textile address
	VersionByteAccountID VersionByte = 0xdd // Base58-encodes to 'P...'
	// VersionByteSeed is the version byte used for encoded textile seed
	VersionByteSeed = 0xff // Base58-encodes to 'S...'
)

func Version

func Version(src string) (VersionByte, error)

Version extracts and returns the version byte from the provided source string.

Jump to

Keyboard shortcuts

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