Documentation ¶
Index ¶
- Constants
- Variables
- func BigCmp(a, b BigInt) int
- func DeciStr(bi BigInt) string
- func EcRecover(msg, signature []byte) ([]byte, error)
- func PublicKeyForSecpSecretKey(sk []byte) []byte
- func SignBLS(sk, msg []byte) ([]byte, error)
- func SignSecp(sk, msg []byte) ([]byte, error)
- func SizeStr(bi BigInt) string
- func ValidateBlsSignature(data []byte, addr address.Address, signature []byte) error
- func ValidateSecpSignature(data []byte, addr address.Address, signature []byte) error
- func ValidateSignature(data []byte, addr address.Address, sig Signature) error
- func VerifyBLS(pubKey, msg, signature []byte) bool
- func VerifyBLSAggregate(pubKeys, msgs [][]byte, signature []byte) bool
- func VerifySecp(pk, msg, signature []byte) bool
- type BigInt
- type KeyInfo
- func (ki *KeyInfo) Address() (address.Address, error)
- func (ki *KeyInfo) Equals(other *KeyInfo) bool
- func (ki *KeyInfo) Key() []byte
- func (t *KeyInfo) MarshalCBOR(w io.Writer) error
- func (ki *KeyInfo) MarshalJSON() ([]byte, error)
- func (ki *KeyInfo) PublicKey() []byte
- func (ki *KeyInfo) Type() SigType
- func (t *KeyInfo) UnmarshalCBOR(r io.Reader) error
- func (ki *KeyInfo) UnmarshalJSON(data []byte) error
- type SigType
- type Signature
Constants ¶
View Source
const ( SigTypeSecp256k1 = crypto.SigTypeSecp256k1 SigTypeBLS = crypto.SigTypeBLS )
View Source
const BigIntMaxSerializedLen = 128 // is this big enough? or too big?
View Source
const FilBase = uint64(2_000_000_000)
View Source
const FilecoinPrecision = uint64(1_000_000_000_000_000_000)
View Source
const PrivateKeyBytes = 32
PrivateKeyBytes is the size of a serialized private key.
Variables ¶
View Source
var EmptyInt = BigInt{}
View Source
var TotalFilecoinInt = FromFil(FilBase)
Functions ¶
func PublicKeyForSecpSecretKey ¶
PublicKeyForSecpSecretKey returns the public key for this private key.
func SignSecp ¶
SignSecp signs the given message using secp256k1 based cryptography, which must be 32 bytes long.
func ValidateBlsSignature ¶
func ValidateSecpSignature ¶
func ValidateSignature ¶
ValidateSignature cryptographically verifies that 'sig' is the signed hash of 'data' with the public key belonging to `addr`.
func VerifyBLSAggregate ¶
VerifyBLSAggregate checks the given signature is a valid aggregate signature over all messages and public keys
func VerifySecp ¶
VerifySecp checks the given signature is a secp256k1 signature and returns true if it is valid.
Types ¶
type KeyInfo ¶
type KeyInfo struct { // Private key. PrivateKey []byte `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) MarshalJSON ¶
func (*KeyInfo) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.