keystore

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 8 Imported by: 26

README

go-ipfs-keystore

go-ipfs-keystore implements keystores for ipfs Travis CI Go Reference

❗ This repo is no longer maintained.

👉 We highly recommend switching to the maintained version at https://github.com/ipfs/boxo/tree/main/keystore. 🏎️ Good news! There is tooling and documentation to expedite a switch in your repo.

⚠️ If you continue using this repo, please note that security fixes will not be provided (unless someone steps in to maintain it).

📚 Learn more, including how to take the maintainership mantle or ask questions, here.

go-ipfs-keystore provides the Keystore interface for key management. Keystores support adding, retrieving, and deleting keys as well as listing all keys and checking for membership.

Table of Contents

Install

go-ipfs-keystore works like a regular Go module:

> go get github.com/ipfs/go-ipfs-keystore

Usage

import "github.com/ipfs/go-ipfs-keystore"

License

This project is dual-licensed under Apache 2.0 and MIT terms:

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyExists = fmt.Errorf("key by that name already exists, refusing to overwrite")

ErrKeyExists is an error message returned when a key already exists

Deprecated: use github.com/ipfs/boxo/keystore.ErrKeyExists

View Source
var ErrNoSuchKey = fmt.Errorf("no key by the given name was found")

ErrNoSuchKey is an error message returned when no key of a given name was found.

Deprecated: use github.com/ipfs/boxo/keystore.ErrNoSuchKey

Functions

This section is empty.

Types

type FSKeystore deprecated

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

FSKeystore is a keystore backed by files in a given directory stored on disk.

Deprecated: use github.com/ipfs/boxo/keystore.FSKeystore

func NewFSKeystore deprecated

func NewFSKeystore(dir string) (*FSKeystore, error)

NewFSKeystore returns a new filesystem-backed keystore.

Deprecated: use github.com/ipfs/boxo/keystore.NewFSKeystore

func (*FSKeystore) Delete

func (ks *FSKeystore) Delete(name string) error

Delete removes a key from the Keystore

func (*FSKeystore) Get

func (ks *FSKeystore) Get(name string) (ci.PrivKey, error)

Get retrieves a key from the Keystore if it exists, and returns ErrNoSuchKey otherwise.

func (*FSKeystore) Has

func (ks *FSKeystore) Has(name string) (bool, error)

Has returns whether or not a key exists in the Keystore

func (*FSKeystore) List

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

List return a list of key identifier

func (*FSKeystore) Put

func (ks *FSKeystore) Put(name string, k ci.PrivKey) error

Put stores a key in the Keystore, if a key with the same name already exists, returns ErrKeyExists

type Keystore deprecated

type Keystore interface {
	// Has returns whether or not a key exists in the Keystore
	Has(string) (bool, error)
	// Put stores a key in the Keystore, if a key with the same name already exists, returns ErrKeyExists
	Put(string, ci.PrivKey) error
	// Get retrieves a key from the Keystore if it exists, and returns ErrNoSuchKey
	// otherwise.
	Get(string) (ci.PrivKey, error)
	// Delete removes a key from the Keystore
	Delete(string) error
	// List returns a list of key identifier
	List() ([]string, error)
}

Keystore provides a key management interface

Deprecated: use github.com/ipfs/boxo/keystore.Keystore

type MemKeystore deprecated

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

MemKeystore is an in memory keystore implementation that is not persisted to any backing storage.

Deprecated: use github.com/ipfs/boxo/keystore.MemKeystore

func NewMemKeystore deprecated

func NewMemKeystore() *MemKeystore

NewMemKeystore creates a MemKeystore.

Deprecated: use github.com/ipfs/boxo/keystore.NewMemKeystore

func (*MemKeystore) Delete

func (mk *MemKeystore) Delete(name string) error

Delete remove a key from the Keystore

func (*MemKeystore) Get

func (mk *MemKeystore) Get(name string) (ci.PrivKey, error)

Get retrieve a key from the Keystore

func (*MemKeystore) Has

func (mk *MemKeystore) Has(name string) (bool, error)

Has return whether or not a key exists in the Keystore

func (*MemKeystore) List

func (mk *MemKeystore) List() ([]string, error)

List return a list of key identifier

func (*MemKeystore) Put

func (mk *MemKeystore) Put(name string, k ci.PrivKey) error

Put store a key in the Keystore

Jump to

Keyboard shortcuts

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