Documentation ¶
Index ¶
- Constants
- Variables
- func PubKeyFromBytes(bz []byte) fwcryptotypes.PubKey
- type PrivKey
- func (privKey *PrivKey) Bytes() []byte
- func (*PrivKey) Descriptor() ([]byte, []int)deprecated
- func (privKey *PrivKey) Equals(other fwcryptotypes.LedgerPrivKey) bool
- func (x *PrivKey) GetKey() []byte
- func (*PrivKey) ProtoMessage()
- func (x *PrivKey) ProtoReflect() protoreflect.Message
- func (privKey *PrivKey) PubKey() fwcryptotypes.PubKey
- func (x *PrivKey) Reset()
- func (privKey *PrivKey) Sign(msg []byte) ([]byte, error)
- func (x *PrivKey) String() string
- func (privKey *PrivKey) Type() string
- type PubKey
- func (pubKey *PubKey) Address() fwcryptotypes.Address
- func (pubKey *PubKey) Bytes() []byte
- func (*PubKey) Descriptor() ([]byte, []int)deprecated
- func (pubKey *PubKey) Equals(other fwcryptotypes.PubKey) bool
- func (x *PubKey) GetKey() []byte
- func (*PubKey) ProtoMessage()
- func (x *PubKey) ProtoReflect() protoreflect.Message
- func (x *PubKey) Reset()
- func (x *PubKey) String() string
- func (pubKey *PubKey) Type() string
- func (pubKey *PubKey) VerifySignature(msg []byte, sig []byte) bool
Constants ¶
const ( // PubKeySize is is the size, in bytes, of public keys as used in this package. PubKeySize = 32 // PrivKeySize is the size, in bytes, of private keys as used in this package. PrivKeySize = 64 // 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 // SeedSize is the size, in bytes, of private key seeds. These are the // private key representations used by RFC 8032. SeedSize = 32 KeyType = "ed25519" )
Variables ¶
var File_framework_crypto_ed25519_keys_proto protoreflect.FileDescriptor
Functions ¶
func PubKeyFromBytes ¶
func PubKeyFromBytes(bz []byte) fwcryptotypes.PubKey
Types ¶
type PrivKey ¶
type PrivKey struct { Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
PrivKey defines a ed25519 private key. NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context.
func GenPrivKey ¶
func GenPrivKey() *PrivKey
GenPrivKey generates a new ed25519 private key. These ed25519 keys must not be used in SDK apps except in a tendermint validator context. It uses OS randomness in conjunction with the current global random seed in tendermint/libs/common to generate the private key.
func GenPrivKeyFromSecret ¶
GenPrivKeyFromSecret hashes the secret with SHA2, and uses that 32 byte output to create the private key. NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. NOTE: secret should be the output of a KDF like bcrypt, if it's derived from user input.
func (*PrivKey) Descriptor
deprecated
func (*PrivKey) Equals ¶
func (privKey *PrivKey) Equals(other fwcryptotypes.LedgerPrivKey) bool
Equals - you probably don't need to use this. Runs in constant time based on length of the keys.
func (*PrivKey) ProtoMessage ¶
func (*PrivKey) ProtoMessage()
func (*PrivKey) ProtoReflect ¶
func (x *PrivKey) ProtoReflect() protoreflect.Message
func (*PrivKey) PubKey ¶
func (privKey *PrivKey) PubKey() fwcryptotypes.PubKey
PubKey gets the corresponding public key from the private key.
Panics if the private key is not initialized.
func (*PrivKey) Sign ¶
Sign produces a signature on the provided message. This assumes the privkey is wellformed in the golang format. The first 32 bytes should be random, corresponding to the normal ed25519 private key. The latter 32 bytes should be the compressed public key. If these conditions aren't met, Sign will panic or produce an incorrect signature.
type PubKey ¶
type PubKey struct { Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
PubKey is an ed25519 public key for handling Tendermint keys in SDK. It's needed for Any serialization and SDK compatibility. It must not be used in a non Tendermint key context because it doesn't implement ADR-28. Nevertheless, you will like to use ed25519 in app user level then you must create a new proto message and follow ADR-28 for Address construction.
func (*PubKey) Address ¶
func (pubKey *PubKey) Address() fwcryptotypes.Address
Address is the SHA256-20 of the raw pubkey bytes. It doesn't implement ADR-28 addresses and it must not be used in SDK except in a tendermint validator context.
func (*PubKey) Descriptor
deprecated
func (*PubKey) ProtoMessage ¶
func (*PubKey) ProtoMessage()
func (*PubKey) ProtoReflect ¶
func (x *PubKey) ProtoReflect() protoreflect.Message