Versions in this module Expand all Collapse all v1 v1.1.0 Dec 6, 2024 Changes in this version + const Ed25519SignatureSize + const Secp256k1SignatureSize + func AggregateSignatures(signatures [][]byte, keyType KeyType) ([]byte, error) + func DeriveKey(masterKey []byte, index uint32, keyType KeyType) ([]byte, error) + func SignHash(privateKey []byte, hash []byte, keyType KeyType) ([]byte, error) + func VerifyAggregateSignature(pubKeys [][]byte, messages [][]byte, signature []byte, keyType KeyType) bool + func VerifyHashSignature(pubKey, hash, signature []byte, keyType KeyType) bool + type BatchVerifier struct + func NewBatchVerifier(keyType KeyType) *BatchVerifier + func (bv *BatchVerifier) AddSignature(pubKey, message, signature []byte) error + func (bv *BatchVerifier) Verify() bool + type DeterministicReader struct + func NewDeterministicReader(seed []byte) *DeterministicReader + func (r *DeterministicReader) Read(p []byte) (n int, err error) + type Ed25519Signer struct + func NewEd25519Signer(privateKey []byte) (*Ed25519Signer, error) + func (s *Ed25519Signer) GetAddress() types.Address + func (s *Ed25519Signer) GetPublicKey() []byte + func (s *Ed25519Signer) Sign(message []byte) ([]byte, error) + func (s *Ed25519Signer) Verify(pubKey, message, signature []byte) bool + type KeyPair struct + Address types.Address + KeyType KeyType + PrivateKey []byte + PublicKey []byte + func (kp *KeyPair) Sign(message []byte) ([]byte, error) + func (kp *KeyPair) Verify(message, signature []byte) bool + type KeyStore struct + func NewKeyStore() *KeyStore + func (ks *KeyStore) DeleteKey(address types.Address) error + func (ks *KeyStore) ExportPrivateKey(address types.Address) (string, error) + func (ks *KeyStore) GenerateFromSeed(seed string, keyType KeyType) (*KeyPair, error) + func (ks *KeyStore) GenerateKeyPair(keyType KeyType) (*KeyPair, error) + func (ks *KeyStore) GetKeyPair(address types.Address) (*KeyPair, error) + func (ks *KeyStore) ImportPrivateKey(privateKeyHex string, keyType KeyType) (*KeyPair, error) + func (ks *KeyStore) ListAddresses() []types.Address + type KeyType uint8 + const KeyTypeEd25519 + const KeyTypeSecp256k1 + type MultiSigner struct + func NewMultiSigner(threshold uint, publicKeys [][]byte, keyType KeyType) (*MultiSigner, error) + func (ms *MultiSigner) VerifyMultiSig(message []byte, signatures [][]byte, signerIndexes []uint) bool + type Signer interface + GetAddress func() types.Address + GetPublicKey func() []byte + Sign func(message []byte) ([]byte, error) + Verify func(pubKey, message, signature []byte) bool