Documentation
¶
Index ¶
- func DeriveKey(mnemonic []string, index uint32) (crypto.PrivateKey, error)
- func ExportKey(key *Key, format string, writer io.Writer) error
- func GenerateMnemonic(bitSize int) ([]string, error)
- type Key
- type Keychain
- type Manager
- func (m *Manager) Delete(keyID ids.ID) error
- func (m *Manager) DeleteKey(keyID ids.ID) error
- func (m *Manager) ExportKey(keyID ids.ID) (string, error)
- func (m *Manager) GenerateBLS() (*Key, *bls.SecretKey, error)
- func (m *Manager) GenerateEd25519() (*Key, error)
- func (m *Manager) GenerateKey(keyType string) (*Key, error)
- func (m *Manager) Get(keyID ids.ID) (*Key, error)
- func (m *Manager) GetByAddress(address ids.ShortID) (*Key, error)
- func (m *Manager) GetKey(keyID ids.ID) (*Key, error)
- func (m *Manager) ImportKey(privateKey crypto.PrivateKey, keyType string) (*Key, error)
- func (m *Manager) ImportPrivateKey(privateKey crypto.PrivateKey) (*Key, error)
- func (m *Manager) List() []*Key
- func (m *Manager) ListKeys() []*Key
- func (m *Manager) Save(keyID ids.ID) error
- func (m *Manager) SaveAll() error
- func (m *Manager) SaveKey(key *Key) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveKey ¶
func DeriveKey(mnemonic []string, index uint32) (crypto.PrivateKey, error)
DeriveKey derives a key from a mnemonic at the given index
func GenerateMnemonic ¶
GenerateMnemonic generates a mnemonic phrase
Types ¶
type Key ¶
type Key struct {
ID ids.ID `json:"id"`
Type string `json:"type"` // "ed25519", "bls", "secp256k1"
PrivateKey crypto.PrivateKey `json:"-"`
PublicKey crypto.PublicKey `json:"publicKey"`
Address ids.ShortID `json:"address"`
Metadata map[string]string `json:"metadata,omitempty"`
}
Key represents a cryptographic key with metadata
func (*Key) PrivKeyHex ¶ added in v0.2.1
PrivKeyHex returns the private key as a hex string
type Keychain ¶
type Keychain struct {
// contains filtered or unexported fields
}
Keychain manages a collection of private keys for signing
func (*Keychain) Add ¶
func (kc *Keychain) Add(privateKey crypto.PrivateKey) error
Add adds a private key to the keychain
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles key generation, storage, and retrieval
func NewManager ¶
NewManager creates a new key manager
func (*Manager) GenerateBLS ¶
GenerateBLS generates a new BLS key
func (*Manager) GenerateEd25519 ¶
GenerateEd25519 generates a new Ed25519 key
func (*Manager) GenerateKey ¶
GenerateKey generates a new key of the specified type
func (*Manager) GetByAddress ¶
GetByAddress retrieves a key by address
func (*Manager) ImportPrivateKey ¶
func (m *Manager) ImportPrivateKey(privateKey crypto.PrivateKey) (*Key, error)
ImportPrivateKey imports an existing private key
Click to show internal directories.
Click to hide internal directories.