keys

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	KeyLengthEd25519   = 32
	KeyLengthSecp256k1 = 65
	KeyLengthGOST      = 64
)
View Source
const PrefixUncompressedSecp259k1Key = 0x04

Variables

This section is empty.

Functions

func SignMessageByKeyType

func SignMessageByKeyType(keyType proto.KeyType, keys *Keys, message []byte) ([]byte, []byte, error)

SignMessageByKeyType signs message depending on specified key type

func ValidateKeyLength

func ValidateKeyLength(key []byte) bool

func VerifySignatureByKeyType

func VerifySignatureByKeyType(keyType pb.KeyType, publicKeyBytes, message, signature []byte) (bool, error)

VerifySignatureByKeyType returns true if signature corresponds to signed message

Types

type Keys

type Keys struct {
	KeyType             proto.KeyType
	PublicKeyEd25519    ed25519.PublicKey
	PrivateKeyEd25519   ed25519.PrivateKey
	PublicKeySecp256k1  *ecdsa.PublicKey
	PrivateKeySecp256k1 *ecdsa.PrivateKey
	PublicKeyGOST       *gost3410.PublicKey
	PrivateKeyGOST      *gost3410.PrivateKey
	PublicKeyBytes      []byte
	PrivateKeyBytes     []byte
	PublicKeyBase58     string
}

func GenerateAllKeys

func GenerateAllKeys() (*Keys, error)

GenerateAllKeys generates all kind of keys

func GenerateEd25519FromBase58

func GenerateEd25519FromBase58(base58encoded string) (*Keys, error)

GenerateEd25519FromBase58 generates ed25519 key from base58 encoded string

func GenerateEd25519FromHex

func GenerateEd25519FromHex(hexEncoded string) (*Keys, error)

GenerateEd25519FromHex generates ed25519 key from base58 encoded string

func GenerateKeysByKeyType

func GenerateKeysByKeyType(keyType proto.KeyType) (*Keys, error)

GenerateKeysByKeyType generates private and public keys based on specified key type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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