keystore

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: BSD-3-Clause Imports: 22 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockchainKeystore

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

BlockchainKeystore ...

func (*BlockchainKeystore) GetDatabase

func (bks *BlockchainKeystore) GetDatabase(username, password string) (database.Database, error)

GetDatabase ...

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"`
}

ExportUserArgs ...

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"`
}

ExportUserReply is the reply from ExportUser

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"`
}

ImportUserArgs are arguments for ImportUser

type KeyValuePair

type KeyValuePair struct {
	Key   []byte `serialize:"true"`
	Value []byte `serialize:"true"`
}

KeyValuePair ...

type Keystore

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

Keystore is the RPC interface for keystore management

func CreateTestKeystore added in v0.8.0

func CreateTestKeystore() (*Keystore, error)

CreateTestKeystore returns a new keystore that can be utilized for testing

func (*Keystore) AddUser added in v0.8.0

func (ks *Keystore) AddUser(username, pword string) error

AddUser attempts to register this username and password as a new user of the keystore.

func (*Keystore) CreateHandler

func (ks *Keystore) CreateHandler() (*common.HTTPHandler, error)

CreateHandler returns a new service object that can send requests to thisAPI.

func (*Keystore) CreateUser

func (ks *Keystore) CreateUser(_ *http.Request, args *api.UserPass, reply *api.SuccessResponse) error

CreateUser creates an empty user with the provided username and password

func (*Keystore) DeleteUser added in v0.8.0

func (ks *Keystore) DeleteUser(_ *http.Request, args *api.UserPass, reply *api.SuccessResponse) error

DeleteUser deletes user with the provided username and password.

func (*Keystore) ExportUser

func (ks *Keystore) ExportUser(_ *http.Request, args *ExportUserArgs, reply *ExportUserReply) error

ExportUser exports a serialized encoding of a user's information complete with encrypted database values

func (*Keystore) GetDatabase

func (ks *Keystore) GetDatabase(bID ids.ID, username, password string) (database.Database, error)

GetDatabase ...

func (*Keystore) ImportUser

func (ks *Keystore) ImportUser(r *http.Request, args *ImportUserArgs, reply *api.SuccessResponse) error

ImportUser imports a serialized encoding of a user's information complete with encrypted database values, integrity checks the password, and adds it to the database

func (*Keystore) Initialize

func (ks *Keystore) Initialize(log logging.Logger, db database.Database) error

Initialize the keystore

func (*Keystore) ListUsers

func (ks *Keystore) ListUsers(_ *http.Request, args *struct{}, reply *ListUsersReply) error

ListUsers lists all the registered usernames

func (*Keystore) NewBlockchainKeyStore

func (ks *Keystore) NewBlockchainKeyStore(blockchainID ids.ID) *BlockchainKeystore

NewBlockchainKeyStore ...

type ListUsersReply

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

ListUsersReply is the reply from ListUsers

type UserDB

type UserDB struct {
	password.Hash `serialize:"true"`
	Data          []KeyValuePair `serialize:"true"`
}

UserDB describes the full content of a user

Jump to

Keyboard shortcuts

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