keystore

package
v0.0.0-...-015e77e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 11 Imported by: 0

README

Keystore

Keystore is an IPFS compliant keystore built on Chestnut. It implements an IPFS keystore interface, allowing it to be used natively with many existing IPFS implementations, and tools.

We recommend using AES256-CTR for encryption based in part on this helpful analysis of database encryption approaches and trade-offs from Shawn Wang, PostgreSQL Database Core.

For a detailed example on importing and using the Keystore, please check out the Keystore example under the examples folder.

IMPORTANT!
package main

import  (
    "github.com/ipfs/go-ipfs/keystore"
    "github.com/libp2p/go-libp2p-core/crypto"
)

Please make sure you import go-ipfs and go-libp2p-core, and are NOT importing go-ipfs-keystore and go-libp2p-crypto. Those repos are DEPRECATED, out of date, archived, etc. This will save you time and sanity.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ECDSAPrivateKeyToPrivKey

func ECDSAPrivateKeyToPrivKey(privateKey *ecdsa.PrivateKey) crypto.PrivKey

ECDSAPrivateKeyToPrivKey converts standard library ecdsa private keys to libp2p/go-libp2p-core/crypto private keys.

func Ed25519PrivateKeyToPrivKey

func Ed25519PrivateKeyToPrivKey(privateKey *ed25519.PrivateKey) crypto.PrivKey

Ed25519PrivateKeyToPrivKey converts ed25519 private keys to libp2p/go-libp2p-core/crypto private keys.

func PrivKeyToECDSAPrivateKey

func PrivKeyToECDSAPrivateKey(privKey crypto.PrivKey) *ecdsa.PrivateKey

PrivKeyToECDSAPrivateKey converts libp2p/go-libp2p-core/crypto private keys to new standard library ecdsa private keys.

func PrivKeyToEd25519PrivateKey

func PrivKeyToEd25519PrivateKey(privKey crypto.PrivKey) *ed25519.PrivateKey

PrivKeyToEd25519PrivateKey converts libp2p/go-libp2p-core/crypto private keys to ed25519 private keys.

func PrivKeyToRSAPrivateKey

func PrivKeyToRSAPrivateKey(privKey crypto.PrivKey) *rsa.PrivateKey

PrivKeyToRSAPrivateKey converts libp2p/go-libp2p-core/crypto private keys to standard library rsa private keys.

func RSAPrivateKeyToPrivKey

func RSAPrivateKeyToPrivKey(privateKey *rsa.PrivateKey) crypto.PrivKey

RSAPrivateKeyToPrivKey converts standard library rsa private keys to libp2p/go-libp2p-core/crypto private keys.

Types

type Keystore

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

Keystore is used to manage an encrypted IPFS-compliant keystore.

func NewKeystore

func NewKeystore(store storage.Storage, opt ...chestnut.ChestOption) *Keystore

NewKeystore is used to create a new chestnut ipfs-compliant keystore. Suggest using using this with AES256-CTR encryption based in part on this helpful analysis from Shawn Wang, PostgreSQL Database Core: https://www.highgo.ca/2019/08/08/the-difference-in-five-modes-in-the-aes-encryption-algorithm/

func (*Keystore) Close

func (ks *Keystore) Close() error

Close the Keystore

func (*Keystore) Delete

func (ks *Keystore) Delete(s string) error

Delete removes a key from the Keystore

func (*Keystore) Export

func (ks *Keystore) Export(path string) error

Export the Keystore

func (*Keystore) Get

func (ks *Keystore) Get(s string) (ci.PrivKey, error)

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

func (*Keystore) Has

func (ks *Keystore) Has(s string) (bool, error)

Has returns whether or not a key exists in the Keystore

func (*Keystore) List

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

List returns a list of key identifier

func (*Keystore) Open

func (ks *Keystore) Open() error

Open the Keystore

func (*Keystore) Put

func (ks *Keystore) Put(s string, key ci.PrivKey) error

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

Jump to

Keyboard shortcuts

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