encoding

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 91

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PubKeyFromProto

func PubKeyFromProto(k pc.PublicKey) (crypto.PubKey, error)

PubKeyFromProto takes a protobuf Pubkey and transforms it to a crypto.Pubkey. It returns ErrUnsupportedKey if the pubkey type is unsupported or ErrInvalidKeyLen if the key length is invalid.

func PubKeyFromTypeAndBytes added in v1.0.0

func PubKeyFromTypeAndBytes(pkType string, bytes []byte) (crypto.PubKey, error)

PubKeyFromTypeAndBytes builds a crypto.PubKey from the given type and bytes. It returns ErrUnsupportedKey if the pubkey type is unsupported or ErrInvalidKeyLen if the key length is invalid.

func PubKeyToProto

func PubKeyToProto(k crypto.PubKey) (pc.PublicKey, error)

PubKeyToProto takes crypto.PubKey and transforms it to a protobuf Pubkey. It returns ErrUnsupportedKey if the pubkey type is unsupported.

Types

type ErrInvalidKeyLen added in v1.0.0

type ErrInvalidKeyLen struct {
	Key       any
	Got, Want int
}

InvalidKeyLen describes an error resulting from the use of a key with an invalid length in PubKeyFromProto.

func (ErrInvalidKeyLen) Error added in v1.0.0

func (e ErrInvalidKeyLen) Error() string

type ErrUnsupportedKey added in v1.0.0

type ErrUnsupportedKey struct {
	KeyType string
}

ErrUnsupportedKey describes an error resulting from the use of an unsupported key in PubKeyToProto or PubKeyFromProto.

func (ErrUnsupportedKey) Error added in v1.0.0

func (e ErrUnsupportedKey) Error() string

Jump to

Keyboard shortcuts

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