sr25519

package
v0.0.78 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExchangeKeys

func ExchangeKeys(privKey *PrivateKey, pubKey *PublicKey, length int) ([]byte, error)

func PublicKeyFromBytes

func PublicKeyFromBytes(keyBytes []byte) (crypto.PublicKey, error)

PublicKeyFromBytes - Convert byte array to PublicKey

Types

type PrivateKey

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

PrivateKey based on the sr25519 curve

func GenerateKey

func GenerateKey(rand io.Reader) (*PrivateKey, error)

func PrivateKeyFromBytes

func PrivateKeyFromBytes(privKey []byte) (*PrivateKey, error)

PrivateKeyFromBytes get a private key from seed []byte

func (*PrivateKey) Bytes

func (pk *PrivateKey) Bytes() []byte

Bytes returns the byte representation of the private key

func (*PrivateKey) Kind

func (pk *PrivateKey) Kind() string

Kind is the type of private key.

func (*PrivateKey) PublicKey

func (pk *PrivateKey) PublicKey() crypto.PublicKey

PublicKey return the crypto.PublicKey that is derived from the Privatekey

func (*PrivateKey) Sign

func (pk *PrivateKey) Sign(message []byte) ([]byte, error)

Sign uses the PrivateKey to sign the message using the sr25519 signature algorithm

type PublicKey

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

PublicKey based on the sr25519 curve

func (PublicKey) Bytes

func (pk PublicKey) Bytes() []byte

Bytes return Publickey Bytes

func (PublicKey) Kind

func (pk PublicKey) Kind() string

Kind returns the key type

func (PublicKey) Verify

func (pk PublicKey) Verify(message, sig []byte) bool

Verify uses the sr25519 signature algorithm to verify that the message was signed by this public key; it returns true if this key created the signature for the message, false otherwise

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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