mkey

package
v0.0.0-...-a7e7b69 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MPL-2.0 Imports: 24 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ACCOUNT_CHILD_DIR            = "/accounts"
	ACCOUNT_FILE_PREFIX          = "Account_Key"
	MARCONI_PRIVATE_KEY_FILENAME = "mpkey"
	MAX_MARCONI_PRIVATE_KEYS     = 16
	MARCONI_KEY_CHILD_DIR        = "/etc/marconid/keys"
	MARCONI_KEY_FILENAME_SUFFIX  = "_mpkeys"
	MARCONI_PUBLIC_KEY_FILE_EXT  = ".pub"
)
View Source
const (
	NODE_PREFIX = "Nx"
)

Variables

This section is empty.

Functions

func AddPrefixPubKeyHash

func AddPrefixPubKeyHash(pubkeyhash string) string

func Generate32BitKey

func Generate32BitKey(path string) (key []byte, e error)

func GenerateGoMarconiKey

func GenerateGoMarconiKey() (*keystore.Key, error)

Generate a new GoMarconi private key

func ListAccounts

func ListAccounts() []string

Returns the addresses of the Marconi accounts stored under the accounts directory

func StripPrefixPubKeyHash

func StripPrefixPubKeyHash(pubkeyhash string) string

Types

type EncryptedMarconiKeyJSON

type EncryptedMarconiKeyJSON struct {
	PublicKeyHash  string `json:"pubKeyHash"`
	EncryptedMPKey string `json:"encryptedMPkey"`
	Nonce          string `json:"nonce"`
	Salt           string `json:"salt"`
	N              int    `json:"n"`
	R              int    `json:"r"`
	P              int    `json:"p"`
	KeyLen         int    `json:"keylen"`
}

Struct equivalent of the JSON format used to store an Encrypted Marconi Node Private Key

type MarconiAccount

type MarconiAccount struct {
	GMrcKeystore keystore.EncryptedKeyJSONV3 `json:"gMrcKeystore"`
	MarconiKeys  []EncryptedMarconiKeyJSON   `json:"marconiKeys"`
	// contains filtered or unexported fields
}

MarconiAccount contains information for the GoMarconi Keystore and MarconiNode Keystores

func CreateAccount

func CreateAccount(password string) (*MarconiAccount, error)

Create a new account, encrypted with password

func GetAccountForAddress

func GetAccountForAddress(address string) (*MarconiAccount, error)

Returns the MarconiAccount associated with the provided address.

func LoadAccount

func LoadAccount(filename string) (*MarconiAccount, error)

Load a Marconi account from a specific Marconi account file

func NewAccount

func NewAccount(password string) (*MarconiAccount, error)

Generates a new Marconi account that will be encrypted with the given password

func (*MarconiAccount) ExportGoMarconiKeystore

func (m *MarconiAccount) ExportGoMarconiKeystore(path string) error

func (*MarconiAccount) ExportMarconiKeys

func (m *MarconiAccount) ExportMarconiKeys(password string) error

Exports MarconiKeys stored in the account to mpkey files in the keystore directory

func (*MarconiAccount) GenerateMarconiKey

func (m *MarconiAccount) GenerateMarconiKey(password string) (*EncryptedMarconiKeyJSON, error)

Generates a new MarconiKey and adds it to the account

func (*MarconiAccount) GetGoMarconiKey

func (m *MarconiAccount) GetGoMarconiKey(password string) (*keystore.Key, error)

Returns the GoMarconi key stored in the account

func (*MarconiAccount) UseMarconiKey

func (m *MarconiAccount) UseMarconiKey(mpkeyId string, password string) error

type MpkeyListItem

type MpkeyListItem struct {
	Idx        int
	Pubkeyhash string
}

func GetMPKeyHashesForAddress

func GetMPKeyHashesForAddress(address string) ([]MpkeyListItem, error)

Jump to

Keyboard shortcuts

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