Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var KeyTypeChar = map[KeyType]string{ KeyTypeUser: "u", KeyTypePush: "p", }
KeyTypeChar maps key type to their respective file prefix
Functions ¶
This section is empty.
Types ¶
type KeyPayload ¶
type KeyPayload struct { Type int `json:"type" msgpack:"type"` FormatVersion string `json:"version" msgpack:"version"` SecretKey string `json:"secretKey" msgpack:"secretKey"` }
KeyPayload contains key data that will be stored on disk
type Keystore ¶
type Keystore interface { SetOutput(out io.Writer) AskForPassword(prompt ...string) (string, error) AskForPasswordOnce(prompt ...string) (string, error) UnlockKeyUI(addressOrIndex, passphrase, promptMsg string) (StoredKey, string, error) UpdateCmd(addressOrIndex, passphrase string) error GetCmd(addrOrIdx, pass string, showPrivKey bool) error ImportCmd(keyfile string, keyType KeyType, pass string) error Exist(address string) (bool, error) GetByIndex(i int) (StoredKey, error) GetByIndexOrAddress(idxOrAddr string) (StoredKey, error) GetByAddress(addr string) (StoredKey, error) CreateKey(key *ed25519.Key, keyType KeyType, passphrase string) error CreateCmd(keyType KeyType, seed int64, passphrase string, nopass bool) (*ed25519.Key, error) List() (accounts []StoredKey, err error) ListCmd(out io.Writer) error }
Keystore describes a module for managing keys
type StoredKey ¶
type StoredKey interface { GetMeta() StoredKeyMeta GetKey() *ed25519.Key GetPayload() *KeyPayload Unlock(passphrase string) error GetFilename() string GetUserAddress() string GetPushKeyAddress() string IsUnprotected() bool GetType() KeyType GetUnlockedData() []byte GetCreatedAt() time.Time }
StoredKey represents a locally persisted key
type StoredKeyMeta ¶
type StoredKeyMeta map[string]interface{}
StoredKeyMeta represents additional metadata of an account
func (StoredKeyMeta) HasKey ¶
func (sm StoredKeyMeta) HasKey(key string) bool
HasKey checks whether a key exist
func (StoredKeyMeta) Map ¶
func (sm StoredKeyMeta) Map() map[string]interface{}
Map returns base map
Click to show internal directories.
Click to hide internal directories.