Documentation ¶
Index ¶
- Constants
- func Generate(sigType crypto.SigType) ([]byte, error)
- func RegisterSignature(typ crypto.SigType, vs SigShim)
- func Sign(msg []byte, privkey []byte, sigType SigType) (*crypto.Signature, error)
- func ToPublic(sigType crypto.SigType, pk []byte) ([]byte, error)
- func Verify(sig *crypto.Signature, addr address.Address, msg []byte) error
- func VerifyAggregate(pubKeys, msgs [][]byte, signature []byte) error
- type KeyInfo
- func (ki *KeyInfo) Address() (address.Address, error)
- func (ki *KeyInfo) Equals(other *KeyInfo) bool
- func (ki *KeyInfo) Key() []byte
- func (ki KeyInfo) MarshalJSON() ([]byte, error)
- func (ki *KeyInfo) PublicKey() ([]byte, error)
- func (ki *KeyInfo) SetPrivateKey(privateKey []byte)
- func (ki *KeyInfo) Type() SigType
- func (ki *KeyInfo) UnmarshalJSON(data []byte) error
- func (ki *KeyInfo) UsePrivateKey(f func([]byte) error) error
- type SigShim
- type SigType
- type Signature
Constants ¶
View Source
const ( SigTypeSecp256k1 = crypto.SigTypeSecp256k1 SigTypeBLS = crypto.SigTypeBLS )
View Source
const (
BLSSignatureBytes = 96
)
Variables ¶
This section is empty.
Functions ¶
func RegisterSignature ¶ added in v1.0.1
RegisterSignature should be only used during init
func Sign ¶
Sign takes in signature type, private key and message. Returns a signature for that message. Valid sigTypes are: "secp256k1" and "bls"
func VerifyAggregate ¶ added in v1.0.1
Types ¶
type KeyInfo ¶
type KeyInfo struct { // Private key. PrivateKey *memguard.Enclave `json:"privateKey"` // Cryptographic system used to generate private key. SigType SigType `json:"type"` }
KeyInfo is a key and its type used for signing.
func NewSecpKeyFromSeed ¶
NewSecpKeyFromSeed generates a new key from the given reader.
func (*KeyInfo) Key ¶
Key returns the private key of KeyInfo This method makes the key escape from memguard's protection, so use caution
func (KeyInfo) MarshalJSON ¶
func (*KeyInfo) SetPrivateKey ¶ added in v0.9.7
func (*KeyInfo) UnmarshalJSON ¶
type SigShim ¶ added in v1.0.1
type SigShim interface { GenPrivate() ([]byte, error) GenPrivateFromSeed(seed io.Reader) ([]byte, error) ToPublic(pk []byte) ([]byte, error) Sign(pk []byte, msg []byte) ([]byte, error) Verify(sig []byte, a address.Address, msg []byte) error VerifyAggregate(pubKeys, msgs [][]byte, signature []byte) bool }
SigShim is used for introducing signature functions
Click to show internal directories.
Click to hide internal directories.