configuration

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: ISC, ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save

func Save(filename string, configuration *Configuration) error

Save - update configuration file with current data

Types

type Configuration

type Configuration struct {
	DefaultIdentity string              `json:"default_identity"`
	TestNet         bool                `json:"testnet"`
	Connections     []string            `json:"connections"`
	Identities      map[string]Identity `json:"identities"`
}

Configuration - configuration file data format

func Load added in v0.11.0

func Load(filename string) (*Configuration, error)

Load - read the configuration

func (*Configuration) Account added in v0.11.0

func (config *Configuration) Account(name string) (*account.Account, error)

Account - find identity for a given name and convert to an account

func (*Configuration) AddIdentity added in v0.11.0

func (config *Configuration) AddIdentity(name string, description string, seed string, password string) error

AddIdentity - store encrypted identity

func (*Configuration) AddReceiveOnlyIdentity added in v0.11.0

func (config *Configuration) AddReceiveOnlyIdentity(name string, description string, acc string) error

AddReceiveOnlyIdentity - store public-only identity

func (*Configuration) Identity

func (config *Configuration) Identity(name string) (*Identity, error)

Identity - find identity for a given name

func (*Configuration) Private added in v0.11.0

func (config *Configuration) Private(password string, name string) (*Private, error)

Private - find identity decrypt all data for a given name

type Identity added in v0.11.0

type Identity struct {
	Description string `json:"description"`
	Account     string `json:"account"`
	Data        string `json:"data"`
	Salt        string `json:"salt"`
}

Identity - mix of plain and encrypted data

type Private added in v0.11.0

type Private struct {
	PrivateKey  *account.PrivateKey `json:"privateKey"`
	Seed        string              `json:"seed"`
	Description string              `json:"description"`
}

type Salt added in v0.11.0

type Salt [saltSize]byte

Salt - type to hold a salt value

func MakeSalt added in v0.11.0

func MakeSalt() (*Salt, error)

MakeSalt - create a salt using secure random number generator

func (Salt) Bytes added in v0.11.0

func (salt Salt) Bytes() []byte

Bytes - convert a binary salt to byte slice

func (*Salt) MarshalText added in v0.11.0

func (salt *Salt) MarshalText() []byte

MarshalText - convert salt to little endian hex text

***** possibly use NewEncoder and byte buffer to save copy

func (Salt) String added in v0.11.0

func (salt Salt) String() string

String - convert a binary salt to little endian hex string for use by the fmt package (for %s)

func (*Salt) UnmarshalText added in v0.11.0

func (salt *Salt) UnmarshalText(s []byte) error

UnmarshalText - convert little endian hex text into a salt

Jump to

Keyboard shortcuts

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