go-ipfs: github.com/ipfs/go-ipfs/keystore Index | Files

package keystore

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

Index

Package Files

keystore.go memkeystore.go

Variables

var ErrKeyExists = fmt.Errorf("key by that name already exists, refusing to overwrite")
var ErrNoSuchKey = fmt.Errorf("no key by the given name was found")

type FSKeystore Uses

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

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

func NewFSKeystore Uses

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

func (*FSKeystore) Delete Uses

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

Delete removes a key from the Keystore

func (*FSKeystore) Get Uses

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 Uses

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

Has returns whether or not a key exist in the Keystore

func (*FSKeystore) List Uses

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

List return a list of key identifier

func (*FSKeystore) Put Uses

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 Uses

type Keystore interface {
    // Has returns whether or not a key exist 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

type MemKeystore Uses

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

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

func NewMemKeystore Uses

func NewMemKeystore() *MemKeystore

func (*MemKeystore) Delete Uses

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

Delete remove a key from the Keystore

func (*MemKeystore) Get Uses

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

Get retrieve a key from the Keystore

func (*MemKeystore) Has Uses

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

Has return whether or not a key exist in the Keystore

func (*MemKeystore) List Uses

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

List return a list of key identifier

func (*MemKeystore) Put Uses

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

Put store a key in the Keystore

Package keystore imports 7 packages (graph) and is imported by 44 packages. Updated 2019-06-20. Refresh now. Tools for package owners.