filestorage

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: GPL-3.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

package filestorage provides a secure on-disk storage of private keys and metadata. Security is enforced by file and directory permissions, much like standard ssh key storage.

Index

Constants

View Source
const (
	BlockType = "Tendermint Light Client"

	// PrivExt is the extension for private keys.
	PrivExt = "tlc"
	// PubExt is the extensions for public keys.
	PubExt = "pub"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

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

func New

func New(dir string) FileStore

New creates an instance of file-based key storage with tight permissions

dir should be an absolute path of a directory owner by this user. It will be created if it doesn't exist already.

func (FileStore) Delete

func (s FileStore) Delete(name string) error

Delete permanently removes the public and private info for the named key The calling function should provide some security checks first.

func (FileStore) Get

func (s FileStore) Get(name string) ([]byte, keys.Info, error)

Get loads the info and (encoded) private key from the directory It uses `name` to generate the filename, and returns an error if the files don't exist or are in the incorrect format

func (FileStore) List

func (s FileStore) List() (keys.Infos, error)

List parses the key directory for public info and returns a list of Info for all keys located in this directory.

func (FileStore) Put

func (s FileStore) Put(name string, key []byte, info keys.Info) error

Put creates two files, one with the public info as json, the other with the (encoded) private key as gpg ascii-armor style

Jump to

Keyboard shortcuts

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