keystore

package
v0.18.0-rc38-no-dont-h... Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("keystore: key not found")

ErrNotFound is returned when the key does not exist.

Functions

This section is empty.

Types

type KeyName

type KeyName string

KeyName represents private key name.

func KeyNameFromBase32

func KeyNameFromBase32(bs string) (KeyName, error)

KeyNameFromBase32 decodes KeyName from Base32 format.

func (KeyName) Base32

func (kn KeyName) Base32() string

Base32 formats KeyName to Base32 format.

func (KeyName) String

func (kn KeyName) String() string

type Keystore

type Keystore interface {
	// Put stores given PrivKey.
	Put(KeyName, PrivKey) error

	// Get reads PrivKey using given KeyName.
	Get(KeyName) (PrivKey, error)

	// Delete erases PrivKey using given KeyName.
	Delete(name KeyName) error

	// List lists all stored key names.
	List() ([]KeyName, error)

	// Path reports the path of the Keystore.
	Path() string

	// Keyring returns the keyring corresponding to the node's
	// keystore.
	Keyring() keyring.Keyring
}

Keystore is meant to manage private keys.

func NewFSKeystore

func NewFSKeystore(path string, ring keyring.Keyring) (Keystore, error)

NewFSKeystore creates a new Keystore over OS filesystem. The path must point to a directory. It is created automatically if necessary.

func NewMapKeystore

func NewMapKeystore() Keystore

NewMapKeystore constructs in-memory Keystore.

type PrivKey

type PrivKey struct {
	Body []byte `json:"body"`
}

PrivKey represents private key with arbitrary body.

Jump to

Keyboard shortcuts

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