keystore

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: Apache-2.0, MIT Imports: 6 Imported by: 8

Documentation

Overview

Package keystore defines a local key manager for OrbitDB and IPFS Log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	HasKey(id string) (bool, error)

	CreateKey(id string) (crypto.PrivKey, error)

	GetKey(id string) (crypto.PrivKey, error)

	Sign(pubKey crypto.PrivKey, bytes []byte) ([]byte, error)

	Verify(signature []byte, publicKey crypto.PubKey, data []byte) error
}

type Keystore

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

func NewKeystore

func NewKeystore(store datastore.Datastore) (*Keystore, error)

NewKeystore creates a new keystore.

func (*Keystore) CreateKey

func (k *Keystore) CreateKey(id string) (crypto.PrivKey, error)

CreateKey creates a new key in the key store.

func (*Keystore) GetKey

func (k *Keystore) GetKey(id string) (crypto.PrivKey, error)

GetKey retrieves a key from the keystore.

func (*Keystore) HasKey

func (k *Keystore) HasKey(id string) (bool, error)

HasKey checks whether a given key ID exist in the keystore.

func (*Keystore) Sign

func (k *Keystore) Sign(privKey crypto.PrivKey, bytes []byte) ([]byte, error)

Sign signs a value using a given private key.

func (*Keystore) Verify

func (k *Keystore) Verify(signature []byte, publicKey crypto.PubKey, data []byte) error

Verify verifies a signature.

Jump to

Keyboard shortcuts

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