crypto

package
v0.0.0-...-f3a19db Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const PrivateKeyLength = 64
View Source
const PublicKeyLength = 32
View Source
const SeedLength = 32
View Source
const SignatureLength = 64

Variables

This section is empty.

Functions

func NewRandSeed

func NewRandSeed() ([]byte, error)

Types

type IKeypair

type IKeypair interface {
	Type() KeyType
	Sign(msg []byte) ([]byte, error)
	Public() IPrivateKey
	Private() IPublicKey
	Address() []byte
	Verify(message, signature []byte) (bool, error)
}

type IPrivateKey

type IPrivateKey interface {
}

type IPublicKey

type IPublicKey interface {
}

type KeyPair

type KeyPair struct {
	// contains filtered or unexported fields
}

func NewKeyPairFromSeed

func NewKeyPairFromSeed(seed []byte) (*KeyPair, error)

func (*KeyPair) Address

func (kp *KeyPair) Address() []byte

func (*KeyPair) Private

func (kp *KeyPair) Private() PrivateKey

func (*KeyPair) Public

func (kp *KeyPair) Public() PublicKey

func (*KeyPair) Sign

func (kp *KeyPair) Sign(msg []byte) ([]byte, error)

func (*KeyPair) Type

func (kp *KeyPair) Type() KeyType

type KeyType

type KeyType string
const (
	Ed25519Type   KeyType = "ed25519"
	Sr25519Type   KeyType = "Sr25519Type"
	Secp256k1Type KeyType = "Secp256k1Type"
)

type PrivateKey

type PrivateKey ed25519.PrivateKey

type PublicKey

type PublicKey ed25519.PublicKey

func (*PublicKey) Verify

func (pub *PublicKey) Verify(msg, sig []byte) (bool, error)

Jump to

Keyboard shortcuts

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