Documentation
¶
Index ¶
- Constants
- Variables
- func AddressFromPub(pubkeyeth []byte) []byte
- func CRCAddressFromPub(pubkeyeth []byte) string
- func CRCAddressString(addr []byte) (adstr string)
- func CalcCREATE2Address(address, codehash, salt []byte) ([]byte, error)
- func CalcCREATEAddress(address []byte, nonce uint) ([]byte, error)
- func Decrypt(kf *Keyfile, key []byte) (plaintext []byte, err error)
- func DecryptAESCTR(kf *Keyfile, key []byte) (privkey []byte, err error)
- func DecryptAESGCM(kf *Keyfile, key []byte) (plaintext []byte, err error)
- func DeriveChildKey(key *bip32.Key, path []uint32) (*bip32.Key, error)
- func EncryptAES(kf *Keyfile, plaintext []byte, password []byte) error
- func FlateData(data []byte) ([]byte, error)
- func GenerateVanityKey(vanity string, caseSensitive bool, done *bool) vanityResult
- func GetPasswordHint() (string, error)
- func GunzipData(data []byte) ([]byte, error)
- func GzipData(data []byte) ([]byte, error)
- func Keccak256(data ...[]byte) []byte
- func KeyFromPassPbkdf2(password []byte, params KdfPbkdf2params) ([]byte, error)
- func KeyFromPassScrypt(password []byte, params KdfScryptparams) ([]byte, error)
- func MasterKeyFromMnemonic(mnemonic string, passphrase string) (*bip32.Key, error)
- func MasterKeyFromSeed(seed []byte, passphrase string) (*bip32.Key, error)
- func NormalizeMnemonic(mnm *string)
- func Pad(data []byte, length int) []byte
- func ParseHexString(hexstring string) ([]byte, error)
- func PathToUint32(path string) ([]uint32, error)
- func ReadPassword(prompt string) ([]byte, error)
- func ReadString(prompt string) (string, error)
- func RootKeyFromKey(key, chainCode []byte) (*bip32.Key, error)
- func Scalar2Pub(ethkey []byte) (pubkeyeth []byte)
- func SeedToMnemonic(seed []byte) (string, error)
- func SetPassword(prompt string) ([]byte, error)
- func SplitBytesToFiles(secret []byte, fpattern string, numshares, threshold int, ...)
- func TimeConstraindedVanityKey(vanity string, caseSensitive bool, timeout int) ([]byte, string, error, int, time.Duration)
- func UnflateData(data []byte) ([]byte, error)
- func WriteKeyfile(kf *Keyfile, filename string) error
- type KdfPbkdf2params
- type KdfScryptparams
- type Keyfile
- func BIP32KeyFromMnemonic(mnemonic, password, keypass string, derpath ...uint32) (kf *Keyfile, err error)
- func GenerateAndWrapNewKey(pass []byte, kdf string, encalg string, priv []byte, vanity string, ...) (kf *Keyfile, err error, tries int, span time.Duration)
- func ReadAndProcessKeyfile(filename string) (keyfile *Keyfile, err error)
- func ReadKeyfile(filename string) (*Keyfile, error)
- func WrapNSecrets(filenameptrn string, idptrn *Uuid, plaintexts [][]byte, ...) ([]*Keyfile, error)
- func WrapSecret(filename string, id string, plaintext []byte, encalg, kdf, addressText string, ...) (*Keyfile, error)
- func (kf *Keyfile) Decrypt(pass []byte) (err error)
- func (kf *Keyfile) Deserialize(jsonbytes []byte) (err error)
- func (kf *Keyfile) GetPrivAsMnemonic() (mnemonic string, err error)
- func (keyfile *Keyfile) KeyFromPass(pass []byte) (key []byte, err error)
- func (kf *Keyfile) Serialize() (jsonbytes []byte, err error)
- func (kf *Keyfile) UnmarshalKdfJSON() (err error)
- func (keyfile *Keyfile) VerifyMAC(key []byte) error
- type Uuid
Constants ¶
const BIP32 = "BIP32"
const Bip32MasterPass = "Bitcoin seed"
const EthPath = "m/44'/60'/0'/0/0"
const SHARE = "SHARE"
Variables ¶
var FlateHeader = []byte{0xF1, 0xA7, 0xE0}
Should be a constant
var Verbose bool
Functions ¶
func AddressFromPub ¶
func CRCAddressFromPub ¶
func CRCAddressString ¶
func CalcCREATE2Address ¶
func DeriveChildKey ¶ added in v1.5.0
Derive child key from parent key according to path (bip32)
func GenerateVanityKey ¶
func GetPasswordHint ¶ added in v1.5.0
PRompt for a password hint
func GunzipData ¶ added in v1.5.1
func KeyFromPassPbkdf2 ¶
func KeyFromPassPbkdf2(password []byte, params KdfPbkdf2params) ([]byte, error)
Recoveres the encryption key from password
func KeyFromPassScrypt ¶
func KeyFromPassScrypt(password []byte, params KdfScryptparams) ([]byte, error)
Recoveres the encryption key from password
func MasterKeyFromMnemonic ¶ added in v1.5.3
func MasterKeyFromSeed ¶ added in v1.5.3
Create bip32 key (root) from mnemonic with custom passphrase
func NormalizeMnemonic ¶ added in v1.5.3
func NormalizeMnemonic(mnm *string)
func ParseHexString ¶
func PathToUint32 ¶ added in v1.5.0
Translate bip32 path to uint32 array
func ReadPassword ¶
Reading a password on a CLI without echoing it
func ReadString ¶ added in v1.5.0
func RootKeyFromKey ¶ added in v1.5.0
Create bip32 key (root) from eth key and additional entropy (chaincode)
func Scalar2Pub ¶
func SeedToMnemonic ¶ added in v1.5.3
func SetPassword ¶
func SplitBytesToFiles ¶ added in v1.5.1
func UnflateData ¶ added in v1.5.1
func WriteKeyfile ¶ added in v1.5.0
Types ¶
type KdfPbkdf2params ¶
type KdfPbkdf2params struct {
C int `json:"c"`
Dklen int `json:"dklen"`
Prf string `json:"prf"`
Salt string `json:"salt"`
}
func StdPbkdf2Params ¶ added in v1.5.0
func StdPbkdf2Params() *KdfPbkdf2params
function returning stadard pbkdf2 parameters as KdfPbkdf2params struct
type KdfScryptparams ¶
type KdfScryptparams struct {
Dklen int `json:"dklen"`
Salt string `json:"salt"`
N int `json:"n"`
R int `json:"r"`
P int `json:"p"`
}
func StdScryptParams ¶ added in v1.5.0
func StdScryptParams() *KdfScryptparams
function returning stadard scryp parameters as KdfScryptparams struct
type Keyfile ¶
type Keyfile struct {
Version int `json:"version"`
ID string `json:"id"`
Address string `json:"address"`
Crypto struct {
Ciphertext string `json:"ciphertext"`
ExtendedCiphertext string `json:"extendedciphertext,omitempty"`
Cipherparams struct {
Iv string `json:"iv"`
} `json:"cipherparams"`
Cipher string `json:"cipher"`
Kdf string `json:"kdf"`
KdfparamsPack json.RawMessage `json:"kdfparams,omitempty"`
KdfScryptParams KdfScryptparams `json:"-"`
KdfPbkdf2params KdfPbkdf2params `json:"-"`
Mac string `json:"mac"`
} `json:"crypto"`
Plaintext []byte `json:"-"`
PrivKey []byte `json:"-"`
ChainCode []byte `json:"-"`
PubKey string `json:"-"`
Hint string `json:"hint,omitempty"`
Filename string `json:"-"`
}
func BIP32KeyFromMnemonic ¶ added in v1.5.3
func GenerateAndWrapNewKey ¶ added in v1.5.0
func GenerateAndWrapNewKey(pass []byte, kdf string, encalg string, priv []byte, vanity string, caseSensitive bool, timeout int) (kf *Keyfile, err error, tries int, span time.Duration)
Need to revive this function for external use
func ReadAndProcessKeyfile ¶
func ReadKeyfile ¶
Reads and parses a json from a file
func WrapNSecrets ¶ added in v1.5.1
func WrapSecret ¶ added in v1.5.1
func (*Keyfile) Deserialize ¶ added in v1.5.0
func (*Keyfile) GetPrivAsMnemonic ¶ added in v1.5.3
Not exactly compliant with BIP39
func (*Keyfile) KeyFromPass ¶
func (*Keyfile) UnmarshalKdfJSON ¶
type Uuid ¶ added in v1.5.0
type Uuid struct {
// contains filtered or unexported fields
}
func (*Uuid) GetWithLeadingX ¶ added in v1.5.3
Returns a string with n leading X characters
func (*Uuid) GetWithPattern ¶ added in v1.5.3
Returns a string with n leading prefix characters The prefix must be plain ASCII