sr25519

package
v0.0.0-...-f498596 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrivKeyAminoName = "tendermint/PrivKeySr25519"
	PubKeyAminoName  = "tendermint/PubKeySr25519"

	// SignatureSize is the size of an Edwards25519 signature. Namely the size of a compressed
	// Sr25519 point, and a field element. Both of which are 32 bytes.
	SignatureSize = 64
)
View Source
const PrivKeySr25519Size = 32

PrivKeySr25519Size is the number of bytes in an Sr25519 private key.

View Source
const PubKeySr25519Size = 32

PubKeySr25519Size is the number of bytes in an Sr25519 public key.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrivKeySr25519

type PrivKeySr25519 [PrivKeySr25519Size]byte

PrivKeySr25519 implements crypto.PrivKey.

func GenPrivKey

func GenPrivKey() PrivKeySr25519

GenPrivKey generates a new sr25519 private key. It uses OS randomness in conjunction with the current global random seed in tendermint/libs/common to generate the private key.

func GenPrivKeyFromSecret

func GenPrivKeyFromSecret(secret []byte) PrivKeySr25519

GenPrivKeyFromSecret hashes the secret with SHA2, and uses that 32 byte output to create the private key. NOTE: secret should be the output of a KDF like bcrypt, if it's derived from user input.

func (PrivKeySr25519) Bytes

func (privKey PrivKeySr25519) Bytes() []byte

Bytes marshals the privkey using amino encoding.

func (PrivKeySr25519) Equals

func (privKey PrivKeySr25519) Equals(other crypto.PrivKey) bool

Equals - you probably don't need to use this. Runs in constant time based on length of the keys.

func (PrivKeySr25519) PubKey

func (privKey PrivKeySr25519) PubKey() crypto.PubKey

PubKey gets the corresponding public key from the private key.

func (PrivKeySr25519) Sign

func (privKey PrivKeySr25519) Sign(msg []byte) ([]byte, error)

Sign produces a signature on the provided message.

type PubKeySr25519

type PubKeySr25519 [PubKeySr25519Size]byte

PubKeySr25519 implements crypto.PubKey for the Sr25519 signature scheme.

func (PubKeySr25519) Address

func (pubKey PubKeySr25519) Address() crypto.Address

Address is the SHA256-20 of the raw pubkey bytes.

func (PubKeySr25519) AminoSize

func (pubKey PubKeySr25519) AminoSize(_ *amino.Codec) int

func (PubKeySr25519) Bytes

func (pubKey PubKeySr25519) Bytes() []byte

Bytes marshals the PubKey using amino encoding.

func (PubKeySr25519) Equals

func (pubKey PubKeySr25519) Equals(other crypto.PubKey) bool

Equals - checks that two public keys are the same time Runs in constant time based on length of the keys.

func (PubKeySr25519) String

func (pubKey PubKeySr25519) String() string

func (PubKeySr25519) VerifyBytes

func (pubKey PubKeySr25519) VerifyBytes(msg []byte, sig []byte) bool

Jump to

Keyboard shortcuts

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