Documentation
¶
Overview ¶
Package crypto implements cryptographic operations for ATLYS
Package crypto implements cryptographic signing operations for ATLYS
Index ¶
- Constants
- 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
- type DeterministicReader
- type Ed25519Signer
- type KeyPair
- type 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
- type MultiSigner
- type Signer
Constants ¶
const ( Ed25519SignatureSize = 64 Secp256k1SignatureSize = 65 )
SignatureSize defines the size of signatures in bytes
Variables ¶
This section is empty.
Functions ¶
func AggregateSignatures ¶
AggregateSignatures combines multiple signatures into one
func VerifyAggregateSignature ¶
func VerifyAggregateSignature(pubKeys [][]byte, messages [][]byte, signature []byte, keyType KeyType) bool
VerifyAggregateSignature verifies an aggregated signature
func VerifyHashSignature ¶
VerifyHashSignature verifies a signature on a pre-computed hash
Types ¶
type BatchVerifier ¶
type BatchVerifier struct {
// contains filtered or unexported fields
}
BatchVerifier handles batch signature verification
func NewBatchVerifier ¶
func NewBatchVerifier(keyType KeyType) *BatchVerifier
NewBatchVerifier creates a new batch signature verifier
func (*BatchVerifier) AddSignature ¶
func (bv *BatchVerifier) AddSignature(pubKey, message, signature []byte) error
AddSignature adds a signature to the batch
func (*BatchVerifier) Verify ¶
func (bv *BatchVerifier) Verify() bool
Verify performs batch signature verification
type DeterministicReader ¶
type DeterministicReader struct {
// contains filtered or unexported fields
}
DeterministicReader provides deterministic randomness from a seed
func NewDeterministicReader ¶
func NewDeterministicReader(seed []byte) *DeterministicReader
type Ed25519Signer ¶
type Ed25519Signer struct {
// contains filtered or unexported fields
}
Ed25519Signer implements Signer for Ed25519
func NewEd25519Signer ¶
func NewEd25519Signer(privateKey []byte) (*Ed25519Signer, error)
NewEd25519Signer creates a new Ed25519 signer
func (*Ed25519Signer) GetAddress ¶
func (s *Ed25519Signer) GetAddress() types.Address
func (*Ed25519Signer) GetPublicKey ¶
func (s *Ed25519Signer) GetPublicKey() []byte
func (*Ed25519Signer) Sign ¶
func (s *Ed25519Signer) Sign(message []byte) ([]byte, error)
Sign signs a message using Ed25519
func (*Ed25519Signer) Verify ¶
func (s *Ed25519Signer) Verify(pubKey, message, signature []byte) bool
Verify verifies an Ed25519 signature
type KeyPair ¶
KeyPair represents a cryptographic key pair
type KeyStore ¶
type KeyStore struct {
// contains filtered or unexported fields
}
KeyStore manages cryptographic keys
func (*KeyStore) ExportPrivateKey ¶
ExportPrivateKey exports a private key for a given address
func (*KeyStore) GenerateFromSeed ¶
GenerateFromSeed generates a deterministic key pair from a seed phrase
func (*KeyStore) GenerateKeyPair ¶
GenerateKeyPair creates a new key pair
func (*KeyStore) GetKeyPair ¶
GetKeyPair retrieves a key pair by address
func (*KeyStore) ImportPrivateKey ¶
ImportPrivateKey imports an existing private key
func (*KeyStore) ListAddresses ¶
ListAddresses returns all addresses in the keystore
type MultiSigner ¶
type MultiSigner struct {
// contains filtered or unexported fields
}
MultiSigner handles multi-signature operations
func NewMultiSigner ¶
func NewMultiSigner(threshold uint, publicKeys [][]byte, keyType KeyType) (*MultiSigner, error)
NewMultiSigner creates a new multi-signature handler
func (*MultiSigner) VerifyMultiSig ¶
func (ms *MultiSigner) VerifyMultiSig(message []byte, signatures [][]byte, signerIndexes []uint) bool
VerifyMultiSig verifies a multi-signature