keystore

package
v1.4.8-rc.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: BSD-3-Clause Imports: 23 Imported by: 27

Documentation

Overview

(c) 2021-2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockchainKeystore

type BlockchainKeystore interface {
	// Get a database that is able to read and write unencrypted values from the
	// underlying database.
	GetDatabase(username, password string) (*encdb.Database, error)

	// Get the underlying database that is able to read and write encrypted
	// values. This Database will not perform any encrypting or decrypting of
	// values and is not recommended to be used when implementing a VM.
	GetRawDatabase(username, password string) (database.Database, error)
}

type Client added in v1.0.6

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

Client ...

func NewClient added in v1.0.6

func NewClient(uri string, requestTimeout time.Duration) *Client

NewClient ...

func (*Client) CreateUser added in v1.0.6

func (c *Client) CreateUser(user api.UserPass) (bool, error)

CreateUser ...

func (*Client) DeleteUser added in v1.0.6

func (c *Client) DeleteUser(user api.UserPass) (bool, error)

DeleteUser removes [user] from the node's keystore users

func (*Client) ExportUser added in v1.0.6

func (c *Client) ExportUser(user api.UserPass) ([]byte, error)

ExportUser returns the byte representation of the requested [user]

func (*Client) ImportUser added in v1.0.6

func (c *Client) ImportUser(user api.UserPass, account []byte) (bool, error)

ImportUser imports the keystore user in [account] under [user]

func (*Client) ListUsers added in v1.0.6

func (c *Client) ListUsers() ([]string, error)

ListUsers lists the usernames of all keystore users on the node

type ExportUserArgs

type ExportUserArgs struct {
	// The username and password
	api.UserPass
	// The encoding for the exported user ("hex" or "cb58")
	Encoding formatting.Encoding `json:"encoding"`
}

type ExportUserReply

type ExportUserReply struct {
	// String representation of the user
	User string `json:"user"`
	// The encoding for the exported user ("hex" or "cb58")
	Encoding formatting.Encoding `json:"encoding"`
}

type ImportUserArgs

type ImportUserArgs struct {
	// The username and password of the user being imported
	api.UserPass
	// The string representation of the user
	User string `json:"user"`
	// The encoding of [User] ("hex" or "cb58")
	Encoding formatting.Encoding `json:"encoding"`
}

type Keystore

type Keystore interface {
	// Create the API endpoint for this keystore.
	CreateHandler() (http.Handler, error)

	// NewBlockchainKeyStore returns this keystore limiting the functionality to
	// a single blockchain database.
	NewBlockchainKeyStore(blockchainID ids.ID) BlockchainKeystore

	// Get a database that is able to read and write unencrypted values from the
	// underlying database.
	GetDatabase(bID ids.ID, username, password string) (*encdb.Database, error)

	// Get the underlying database that is able to read and write encrypted
	// values. This Database will not perform any encrypting or decrypting of
	// values and is not recommended to be used when implementing a VM.
	GetRawDatabase(bID ids.ID, username, password string) (database.Database, error)

	// CreateUser attempts to register this username and password as a new user
	// of the keystore.
	CreateUser(username, pw string) error

	// DeleteUser attempts to remove the provided username and all of its data
	// from the keystore.
	DeleteUser(username, pw string) error

	// ListUsers returns all the users that currently exist in this keystore.
	ListUsers() ([]string, error)

	// ImportUser imports a serialized encoding of a user's information complete
	// with encrypted database values. The password is integrity checked.
	ImportUser(username, pw string, user []byte) error

	// ExportUser exports a serialized encoding of a user's information complete
	// with encrypted database values.
	ExportUser(username, pw string) ([]byte, error)
	// contains filtered or unexported methods
}

func CreateTestKeystore added in v0.8.0

func CreateTestKeystore() (Keystore, error)

CreateTestKeystore returns a new keystore that can be utilized for testing

func New added in v1.3.2

func New(log logging.Logger, dbManager manager.Manager) (Keystore, error)

type ListUsersReply

type ListUsersReply struct {
	Users []string `json:"users"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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