keystore

package
v0.13.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package keystore provides encrypted on-disk storage for identity key material. The keystore file is encrypted with AES-256-GCM using a key derived from a user-supplied passphrase via HKDF-SHA256.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when an address is not in the keystore.
	ErrNotFound = errors.New("keystore: identity not found")
	// ErrDecryptionFailed is returned when the passphrase is wrong.
	ErrDecryptionFailed = errors.New("keystore: decryption failed (wrong passphrase?)")
)

Functions

This section is empty.

Types

type Keystore

type Keystore struct {
	// contains filtered or unexported fields
}

Keystore manages encrypted identity key material on disk.

func New

func New(path, passphrase string) *Keystore

New creates a Keystore backed by the file at path. The passphrase is used to derive the encryption key. The file is created on first write.

func (*Keystore) List

func (ks *Keystore) List() ([]string, error)

List returns all addresses stored in the keystore.

func (*Keystore) Load

func (ks *Keystore) Load(address string) (*identity.IdentityKeyPair, error)

Load retrieves an identity key pair by address. Returns ErrNotFound if the address is not in the keystore.

func (*Keystore) Store

func (ks *Keystore) Store(address string, kp *identity.IdentityKeyPair) error

Store saves an identity key pair under the given address. If the keystore file already exists, it is decrypted, updated, and re-encrypted.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL