keykeeper

package
v0.0.0-...-aa73793 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCoinType        = 688
	DefaultBIP39Passphrase = ""
)
View Source
const AddrPrefix = "coinex1"
View Source
const (
	AesNonceLength = 12
)
View Source
const BatchCount = 200
View Source
const BigBatchCount = 10 * BatchCount

Variables

This section is empty.

Functions

func AddCachedPassphrase

func AddCachedPassphrase(addr, passphrase string) error

func AesGcmDecrypt

func AesGcmDecrypt(key, ciphertext, nonce []byte) (plaintext string)

AesGcmDecrypt takes an decryption key, a ciphertext and the corresponding nonce, and decrypts it with AES256 in GCM mode. Returns the plaintext string. len(key) must be 32, to select AES256

func AesGcmEncrypt

func AesGcmEncrypt(key []byte, plaintext string) (ciphertext, nonce []byte)

================================================ AesGcmEncrypt takes an encryption key and a plaintext string and encrypts it with AES256 in GCM mode, which provides authenticated encryption. Returns the ciphertext and the used nonce. len(key) must be 32, to select AES256

func ChangePassphrase

func ChangePassphrase(addr, oldPassphrase, newPassphrase string) error

func CheckValid

func CheckValid(str string) (string, bool)

func CloseKeybase

func CloseKeybase()

func DeleteAccount

func DeleteAccount(addr, passphrase string) error

func GenerateMnemonic

func GenerateMnemonic(prefix, suffix string, repFn func(uint64, float64), numCpu int) (string, string)

func GetCachedPassphrase

func GetCachedPassphrase(addr string) (res string, ok bool)

func GetMnemonic

func GetMnemonic(addr, passphrase string) (string, error)

func HasAccount

func HasAccount(addr string) bool

func KeybaseOpened

func KeybaseOpened() bool

func OpenKeybase

func OpenKeybase(fname string) error

func Sign

func Sign(name, passphrase string, msg []byte) (string, error)

Types

type AccountInfo

type AccountInfo struct {
	Memo              string `json:"memo"`
	Address           string `json:"address"`
	PassphraseCksum   []byte `json:"passphrase_cksum"`
	EncryptedMnemonic []byte `json:"encrypted_mnemonic"`
}

func CreateAccount

func CreateAccount(memo, mnemonic, passphrase string) (AccountInfo, error)

func NewAccountInfo

func NewAccountInfo(memo, mnemonic, passphrase string) AccountInfo

func (AccountInfo) CheckPassphrase

func (acc AccountInfo) CheckPassphrase(passphrase string) error

type MyKeyBase

type MyKeyBase struct {
	Accounts []AccountInfo
	// contains filtered or unexported fields
}
var KB MyKeyBase

================================================

func (*MyKeyBase) AddAccount

func (kb *MyKeyBase) AddAccount(accInfo AccountInfo)

func (*MyKeyBase) AddCachedPassphrase

func (kb *MyKeyBase) AddCachedPassphrase(addr, passphrase string) error

func (*MyKeyBase) ChangePassphrase

func (kb *MyKeyBase) ChangePassphrase(addr, oldPassphrase, newPassphrase string) error

func (*MyKeyBase) Close

func (kb *MyKeyBase) Close()

func (*MyKeyBase) DeleteAccount

func (kb *MyKeyBase) DeleteAccount(addr string)

func (*MyKeyBase) GetAccountInfo

func (kb *MyKeyBase) GetAccountInfo(addr string) (AccountInfo, bool)

func (*MyKeyBase) GetCachedPassphrase

func (kb *MyKeyBase) GetCachedPassphrase(addr string) (res string, ok bool)

func (*MyKeyBase) GetMnemonic

func (kb *MyKeyBase) GetMnemonic(addr, passphrase string) (string, error)

func (*MyKeyBase) GetStringItems

func (kb *MyKeyBase) GetStringItems() (items []string)

func (*MyKeyBase) Init

func (kb *MyKeyBase) Init(openedFile *os.File, accounts []AccountInfo)

func (*MyKeyBase) IsOpen

func (kb *MyKeyBase) IsOpen() bool

func (*MyKeyBase) Save

func (kb *MyKeyBase) Save() error

func (*MyKeyBase) Sign

func (kb *MyKeyBase) Sign(addr, passphrase string, msg []byte) (sig []byte, pubk secp256k1.PubKeySecp256k1, err error)

Jump to

Keyboard shortcuts

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