Run NodesReferencewallet

keychain

Package keychain

import "github.com/luxfi/node/wallet/keychain"

Types

KeyType

KeyType represents the type of cryptographic key

Keychain

Keychain interface that wallet signers can use This allows both secp256k1fx.Keychain and ledger-lux-go/keychain.Keychain to be used Generic across chains, DAGs, and post-quantum crypto

PQKeychain

PQKeychain implements Keychain with post-quantum support

func NewPQKeychain(defaultType KeyType) *PQKeychain
func (kc *PQKeychain) AddBLS(key *bls.SecretKey) ids.ShortID
func (kc *PQKeychain) AddHybrid(classical *secp256k1.PrivateKey, pq interface{}) ids.ShortID
func (kc *PQKeychain) AddHybridBLS(blsKey *bls.SecretKey, pqKey *mldsa.PrivateKey) ids.ShortID
func (kc *PQKeychain) AddMLDSA(key *mldsa.PrivateKey, keyType KeyType) ids.ShortID
func (kc *PQKeychain) AddMLKEM(pubKey *mlkem.PublicKey, privKey *mlkem.PrivateKey, mode mlkem.Mode) ids.ShortID
func (kc *PQKeychain) AddRingSig(signer ring.Signer, scheme ring.Scheme) ids.ShortID
func (kc *PQKeychain) AddSLHDSA(key *slhdsa.PrivateKey, keyType KeyType) ids.ShortID
func (kc *PQKeychain) AddSecp256k1(key *secp256k1.PrivateKey) ids.ShortID
func (kc *PQKeychain) Addresses() []ids.ShortID
func (kc *PQKeychain) GenerateCoronaKey(scheme ring.Scheme) (ids.ShortID, error)
func (kc *PQKeychain) GenerateKey() (ids.ShortID, error)
func (kc *PQKeychain) Get(addr ids.ShortID) (Signer, bool)
func (kc *PQKeychain) GetPQSigner(addr ids.ShortID) (*PQSigner, bool)
func (kc *PQKeychain) SetDefaultType(keyType KeyType)

PQSigner

PQSigner implements Signer with post-quantum support

func (s *PQSigner) Address() ids.ShortID
func (s *PQSigner) BLSPublicKey() *bls.PublicKey
func (s *PQSigner) Decapsulate(ciphertext []byte) (sharedSecret []byte, err error)
func (s *PQSigner) Encapsulate(recipientPubKey *mlkem.PublicKey) (ciphertext, sharedSecret []byte, err error)
func (s *PQSigner) KeyImage() []byte
func (s *PQSigner) KeyType() KeyType
func (s *PQSigner) PublicKey() []byte
func (s *PQSigner) RingScheme() ring.Scheme
func (s *PQSigner) Sign(msg []byte) ([]byte, error)
func (s *PQSigner) SignHash(hash []byte) ([]byte, error)
func (s *PQSigner) SignRing(message []byte, ringPubKeys [][]byte, signerIndex int) (ring.RingSignature, error)

Signer

Signer interface for signing operations Generic interface for all signing needs (classical and post-quantum)

UnifiedKeychain

UnifiedKeychain uses the unified crypto interface for all key operations

func NewUnifiedKeychain(defaultAlgo crypto.Algorithm) *UnifiedKeychain
func (kc *UnifiedKeychain) AddKey(privKey crypto.PrivateKey, pubKey crypto.PublicKey) ids.ShortID
func (kc *UnifiedKeychain) Addresses() []ids.ShortID
func (kc *UnifiedKeychain) GenerateKey() (ids.ShortID, error)
func (kc *UnifiedKeychain) GenerateKeyWithAlgo(algo crypto.Algorithm) (ids.ShortID, error)
func (kc *UnifiedKeychain) Get(addr ids.ShortID) (Signer, bool)
func (kc *UnifiedKeychain) GetUnifiedSigner(addr ids.ShortID) (*UnifiedSigner, bool)

UnifiedSigner

UnifiedSigner implements the Signer interface using unified crypto

func (s *UnifiedSigner) Address() ids.ShortID
func (s *UnifiedSigner) Algorithm() crypto.Algorithm
func (s *UnifiedSigner) Decapsulate(ciphertext []byte) (sharedSecret []byte, err error)
func (s *UnifiedSigner) Encapsulate(pubKey crypto.PublicKey) (ciphertext []byte, sharedSecret []byte, err error)
func (s *UnifiedSigner) PublicKey() crypto.PublicKey
func (s *UnifiedSigner) Sign(msg []byte) ([]byte, error)
func (s *UnifiedSigner) SignHash(hash []byte) ([]byte, error)
func (s *UnifiedSigner) SignRing(message []byte, ring []crypto.PublicKey) ([]byte, error)