Documentation
¶
Overview ¶
Package wallet provides an encrypted-at-rest local keystore plus a signing facade for the three Filecoin signature types Lantern supports:
- BLS (G1 pubkey, G2 sig) via crypto/sigs/bls (pure-Go gnark backend)
- secp256k1 via crypto/sigs/secp (lifted from Lotus, pure-Go)
- delegated (Ethereum-shaped f4 addresses) via crypto/sigs/delegated (lifted from Lotus, pure-Go)
Keystore on-disk format is compatible with Lotus' lib/keystore (one JSON file per key, AES-GCM-wrapped with a passphrase-derived key) so users can import/export to and from a Lotus install.
Subpackages:
- wallet/keystore — disk-backed encrypted key store
- wallet/mnemonic — BIP-39 mnemonic <-> seed
The top-level wallet package wires these together behind a small goroutine-safe Wallet type that the RPC handlers (WalletNew, WalletSign, WalletList, ...) call into.
No CGo. No filecoin-ffi.
Index ¶
- Variables
- type KeyInfo
- type KeyType
- type Wallet
- func (w *Wallet) Default(_ context.Context) (address.Address, error)
- func (w *Wallet) Delete(_ context.Context, addr address.Address) error
- func (w *Wallet) Export(_ context.Context, addr address.Address) (*KeyInfo, error)
- func (w *Wallet) Has(_ context.Context, addr address.Address) (bool, error)
- func (w *Wallet) Import(_ context.Context, ki *KeyInfo) (address.Address, error)
- func (w *Wallet) List(_ context.Context) ([]address.Address, error)
- func (w *Wallet) NewAddress(_ context.Context, kt KeyType) (address.Address, error)
- func (w *Wallet) SetDefault(_ context.Context, addr address.Address) error
- func (w *Wallet) Sign(_ context.Context, addr address.Address, msg []byte) (*gscrypto.Signature, error)
- func (w *Wallet) SignatureType(_ context.Context, addr address.Address) (gscrypto.SigType, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNoDefault = errors.New("wallet: no default address set")
ErrNoDefault is returned when Default() is called with an empty wallet.
Functions ¶
This section is empty.
Types ¶
type KeyInfo ¶
KeyInfo is the Lotus-compatible export shape. Lotus uses {Type: string, PrivateKey: []byte (base64 JSON)}.
type KeyType ¶
type KeyType string
KeyType is a stable string identifier for one of the three key types. Mirrors Lotus' lib/wallet/key.KeyType values so import/export with Lotus JSON KeyInfo files works.
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
Wallet wraps an encrypted keystore and exposes Lotus-compatible operations.
func (*Wallet) NewAddress ¶
NewAddress generates a new key of the requested type, stores it, and returns its address.
func (*Wallet) SetDefault ¶
SetDefault marks addr as the default address.