keystore

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: BSD-3-Clause Imports: 19 Imported by: 0

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 CreateUserArgs

type CreateUserArgs struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

CreateUserArgs are arguments for passing into CreateUser requests

type CreateUserReply

type CreateUserReply struct {
	Success bool `json:"success"`
}

CreateUserReply is the response from calling CreateUser

type ExportUserArgs

type ExportUserArgs struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

ExportUserArgs are the arguments to ExportUser

type ExportUserReply

type ExportUserReply struct {
	User formatting.CB58 `json:"user"`
}

ExportUserReply is the reply from ExportUser

type ImportUserArgs

type ImportUserArgs struct {
	Username string          `json:"username"`
	Password string          `json:"password"`
	User     formatting.CB58 `json:"user"`
}

ImportUserArgs are arguments for ImportUser

type ImportUserReply

type ImportUserReply struct {
	Success bool `json:"success"`
}

ImportUserReply is the response 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 (*Keystore) CreateHandler

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

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

func (*Keystore) CreateUser

func (ks *Keystore) CreateUser(_ *http.Request, args *CreateUserArgs, reply *CreateUserReply) error

CreateUser creates an empty 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 *ImportUserReply) 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)

Initialize the keystore

func (*Keystore) ListUsers

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

ListUsers lists all the registered usernames

func (*Keystore) NewBlockchainKeyStore

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

NewBlockchainKeyStore ...

type ListUsersArgs

type ListUsersArgs struct{}

ListUsersArgs are the arguments to ListUsers

type ListUsersReply

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

ListUsersReply is the reply from ListUsers

type User

type User struct {
	Password [32]byte `serialize:"true"` // The salted, hashed password
	Salt     [16]byte `serialize:"true"` // The salt
}

User describes a user of the keystore

func (*User) CheckPassword

func (usr *User) CheckPassword(password string) bool

CheckPassword ...

func (*User) Initialize

func (usr *User) Initialize(password string) error

Initialize ...

type UserDB

type UserDB struct {
	User `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