Documentation ¶
Index ¶
- Constants
- func MakePublicKey(privateKey *[64]byte) (publicKey *[32]byte)
- func Sha256(bytes []byte) []byte
- func Sign(privateKey *[PrivateKeySize]byte, message []byte) *[SignatureSize]byte
- func Sum(bz []byte) []byte
- func Verify(publicKey *[PublicKeySize]byte, message []byte, sig *[SignatureSize]byte) bool
- type Address
- type HexBytes
- type PrivKey
- type PrivKeyEd25519
- type PubKey
- type PubKeyEd25519
Constants ¶
const ( Ed25519PrivKeyAminoRoute = "tendermint/PrivKeyEd25519" Ed25519PubKeyAminoRoute = "tendermint/PubKeyEd25519" // Size of an Edwards25519 signature. Namely the size of a compressed // Edwards25519 point, and a field element. Both of which are 32 bytes. SignatureSize = 64 PrivateKeySize = 64 PublicKeySize = 32 )
Variables ¶
This section is empty.
Functions ¶
func MakePublicKey ¶
MakePublicKey makes a publicKey from the first half of privateKey.
func Sign ¶
func Sign(privateKey *[PrivateKeySize]byte, message []byte) *[SignatureSize]byte
Sign signs the message with privateKey and returns a signature.
func Verify ¶
func Verify(publicKey *[PublicKeySize]byte, message []byte, sig *[SignatureSize]byte) bool
Verify returns true iff sig is a valid signature of message by publicKey.
Types ¶
type PrivKeyEd25519 ¶
type PrivKeyEd25519 [64]byte
PrivKeyEd25519 implements crypto.PrivKey.
func GenPrivKeyFromSecret ¶
func GenPrivKeyFromSecret(secret []byte) PrivKeyEd25519
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 (PrivKeyEd25519) Bytes ¶
func (privKey PrivKeyEd25519) Bytes() []byte
Bytes marshals the privkey using amino encoding.
func (PrivKeyEd25519) PubKey ¶
func (privKey PrivKeyEd25519) PubKey() PubKey
PubKey gets the corresponding public key from the private key.
type PubKeyEd25519 ¶
type PubKeyEd25519 [32]byte
PubKeyEd25519 implements crypto.PubKey for the Ed25519 signature scheme.
func (PubKeyEd25519) Address ¶
func (pubKey PubKeyEd25519) Address() Address
Address is the SHA256-20 of the raw pubkey bytes.
func (PubKeyEd25519) Bytes ¶
func (pubKey PubKeyEd25519) Bytes() []byte
Bytes marshals the PubKey using amino encoding.
func (PubKeyEd25519) VerifyBytes ¶
func (pubKey PubKeyEd25519) VerifyBytes(msg []byte, sig_ []byte) bool