keystore

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0, MIT Imports: 7 Imported by: 7

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(ctx context.Context, id string) (bool, error)

	CreateKey(ctx context.Context, id string) (crypto.PrivKey, error)

	GetKey(ctx context.Context, 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(ctx context.Context, id string) (crypto.PrivKey, error)

CreateKey creates a new key in the key store.

func (*Keystore) GetKey

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

GetKey retrieves a key from the keystore.

func (*Keystore) HasKey

func (k *Keystore) HasKey(ctx context.Context, 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