Documentation ¶
Index ¶
- Variables
- func CRandBytes(numBytes int) []byte
- func MixEntropy(seedBytes []byte)
- func Sha256(bytes []byte) []byte
- type PrivKey
- type PrivKeyEd25519
- type PrivKeyInner
- type PubKey
- type PubKeyEd25519
- func (pubKey PubKeyEd25519) Equals(other PubKey) bool
- func (pubKey PubKeyEd25519) KeyString() string
- func (p PubKeyEd25519) MarshalJSON() ([]byte, error)
- func (pubKey PubKeyEd25519) String() string
- func (p *PubKeyEd25519) UnmarshalJSON(enc []byte) error
- func (pubKey PubKeyEd25519) VerifyBytes(msg []byte, sig_ Signature) bool
- func (hi PubKeyEd25519) Wrap() PubKey
- type PubKeyInner
- type Signature
- type SignatureEd25519
- type SignatureInner
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var PrivKeyMapper = data.NewMapper(PrivKey{})
var PubKeyMapper = data.NewMapper(PubKey{})
var SignatureMapper = data.NewMapper(Signature{})
Functions ¶
func MixEntropy ¶
func MixEntropy(seedBytes []byte)
Mix additional bytes of randomness, e.g. from hardware, user-input, etc. It is OK to call it multiple times. It does not diminish security.
Types ¶
type PrivKey ¶
type PrivKey struct {
PrivKeyInner "json:\"unwrap\""
}
func PrivKeyFromBytes ¶
func (PrivKey) MarshalJSON ¶
func (*PrivKey) UnmarshalJSON ¶
func (PrivKey) Unwrap ¶
func (h PrivKey) Unwrap() PrivKeyInner
Unwrap recovers the concrete interface safely (regardless of levels of embeds)
type PrivKeyEd25519 ¶
type PrivKeyEd25519 [64]byte
Implements PrivKey
func GenPrivKeyEd25519 ¶
func GenPrivKeyEd25519() PrivKeyEd25519
func (PrivKeyEd25519) MarshalJSON ¶
func (p PrivKeyEd25519) MarshalJSON() ([]byte, error)
func (PrivKeyEd25519) PubKey ¶
func (privKey PrivKeyEd25519) PubKey() PubKey
func (PrivKeyEd25519) Sign ¶
func (privKey PrivKeyEd25519) Sign(msg []byte) Signature
func (PrivKeyEd25519) String ¶
func (privKey PrivKeyEd25519) String() string
func (*PrivKeyEd25519) UnmarshalJSON ¶
func (p *PrivKeyEd25519) UnmarshalJSON(enc []byte) error
func (PrivKeyEd25519) Wrap ¶
func (hi PrivKeyEd25519) Wrap() PrivKey
type PrivKeyInner ¶
DO NOT USE THIS INTERFACE. You probably want to use PrivKey +gen wrapper:"PrivKey,Impl[PrivKeyEd25519,PrivKeySecp256k1],ed25519,secp256k1"
type PubKey ¶
type PubKey struct {
PubKeyInner "json:\"unwrap\""
}
func (PubKey) MarshalJSON ¶
func (*PubKey) UnmarshalJSON ¶
func (PubKey) Unwrap ¶
func (h PubKey) Unwrap() PubKeyInner
Unwrap recovers the concrete interface safely (regardless of levels of embeds)
type PubKeyEd25519 ¶
type PubKeyEd25519 [32]byte
Implements PubKeyInner
func (PubKeyEd25519) Equals ¶
func (pubKey PubKeyEd25519) Equals(other PubKey) bool
func (PubKeyEd25519) KeyString ¶
func (pubKey PubKeyEd25519) KeyString() string
Must return the full bytes in hex. Used for map keying, etc.
func (PubKeyEd25519) MarshalJSON ¶
func (p PubKeyEd25519) MarshalJSON() ([]byte, error)
func (PubKeyEd25519) String ¶
func (pubKey PubKeyEd25519) String() string
func (*PubKeyEd25519) UnmarshalJSON ¶
func (p *PubKeyEd25519) UnmarshalJSON(enc []byte) error
func (PubKeyEd25519) VerifyBytes ¶
func (pubKey PubKeyEd25519) VerifyBytes(msg []byte, sig_ Signature) bool
func (PubKeyEd25519) Wrap ¶
func (hi PubKeyEd25519) Wrap() PubKey
type PubKeyInner ¶
type PubKeyInner interface { KeyString() string VerifyBytes(msg []byte, sig Signature) bool Equals(PubKey) bool Wrap() PubKey }
DO NOT USE THIS INTERFACE. You probably want to use PubKey +gen wrapper:"PubKey,Impl[PubKeyEd25519,PubKeySecp256k1],ed25519,secp256k1"
type Signature ¶
type Signature struct {
SignatureInner "json:\"unwrap\""
}
func SignatureFromBytes ¶
func (Signature) MarshalJSON ¶
func (*Signature) UnmarshalJSON ¶
func (Signature) Unwrap ¶
func (h Signature) Unwrap() SignatureInner
Unwrap recovers the concrete interface safely (regardless of levels of embeds)
type SignatureEd25519 ¶
type SignatureEd25519 [64]byte
Implements Signature
func (SignatureEd25519) Bytes ¶
func (sig SignatureEd25519) Bytes() []byte
func (SignatureEd25519) MarshalJSON ¶
func (sig SignatureEd25519) MarshalJSON() ([]byte, error)
func (*SignatureEd25519) UnmarshalJSON ¶
func (sig *SignatureEd25519) UnmarshalJSON(enc []byte) error
func (SignatureEd25519) Wrap ¶
func (hi SignatureEd25519) Wrap() Signature
type SignatureInner ¶
DO NOT USE THIS INTERFACE. You probably want to use Signature. +gen wrapper:"Signature,Impl[SignatureEd25519,SignatureSecp256k1],ed25519,secp256k1"