Version: v1.0.1 Latest Latest

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

Go to latest
Published: Jul 31, 2020 License: GPL-3.0 Imports: 6 Imported by: 0




View Source
const (
	EcdsaPrivKeyAminoRoute = "true/PrivKeyTrue"
	EcdsaPubKeyAminoRoute  = "true/PubKeyTrue"
	// Size of an Edwards25519 signature. Namely the size of a compressed
	// Edwards25519 point, and a field element. Both of which are 32 bytes.
	SignatureEd25519Size = 64



This section is empty.


This section is empty.


type PrivKey

type PrivKey interface {
	Bytes() []byte
	Sign(msg []byte) ([]byte, error)
	PubKey() PubKey
	Equals(PrivKey) bool

PrivKey is private key interface

type PrivKeyTrue

type PrivKeyTrue ecdsa.PrivateKey

PrivKeyTrue implements PrivKey.

func GenPrivKey

func GenPrivKey() PrivKeyTrue

GenPrivKey generates a new ed25519 private key.

func (PrivKeyTrue) Bytes

func (priv PrivKeyTrue) Bytes() []byte

Bytes marshals the privkey using amino encoding.

func (PrivKeyTrue) Equals

func (priv PrivKeyTrue) Equals(other PrivKey) bool

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

func (PrivKeyTrue) PubKey

func (priv PrivKeyTrue) PubKey() PubKey

PubKey gets the corresponding public key from the private key.

func (PrivKeyTrue) Sign

func (priv PrivKeyTrue) Sign(msg []byte) ([]byte, error)

Sign produces a signature on the provided message.

type PubKey

type PubKey interface {
	Address() help.Address
	Bytes() []byte
	VerifyBytes(msg []byte, sig []byte) bool
	Equals(PubKey) bool

PubKey An address is a []byte, but hex-encoded even in JSON. []byte leaves us the option to change the address length. Use an alias so Unmarshal methods (with ptr receivers) are available too.

type PubKeyTrue

type PubKeyTrue ecdsa.PublicKey

PubKeyTrue implements PubKey for the ecdsa.PublicKey signature scheme.

func (PubKeyTrue) Address

func (pub PubKeyTrue) Address() help.Address

Address is the Keccak256 of the raw pubkey bytes.

func (PubKeyTrue) Bytes

func (pub PubKeyTrue) Bytes() []byte

Bytes marshals the PubKey using amino encoding.

func (PubKeyTrue) Equals

func (pub PubKeyTrue) Equals(other PubKey) bool

Equals is comp public key

func (PubKeyTrue) String

func (pub PubKeyTrue) String() string

func (PubKeyTrue) VerifyBytes

func (pub PubKeyTrue) VerifyBytes(msg []byte, sig []byte) bool

VerifyBytes is check msg

type Symmetric

type Symmetric interface {
	Keygen() []byte
	Encrypt(plaintext []byte, secret []byte) (ciphertext []byte)
	Decrypt(ciphertext []byte, secret []byte) (plaintext []byte, err error)

Symmetric is Keygen,Encrypt and Decrypt interface


Path Synopsis

Jump to

Keyboard shortcuts

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