key

package
v0.0.0-...-d9e9996 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAndSaveSecretKey

func CreateAndSaveSecretKey(path string, language int, strength uint8, password string, cryptography uint8) (*account.ECDSAInfo, error)

CreateAndSaveSecretKey 生成并保存私钥

func CreateAndSaveSecretKeyWithMnemonic

func CreateAndSaveSecretKeyWithMnemonic(path string, language int, mnemonic string, password string) (*account.ECDSAInfo, error)

CreateAndSaveSecretKeyWithMnemonic 通过助记词来恢复并保存私钥 这里不应该再需要知道指定曲线了,也不需要知道版本号了,这个功能应该由助记词中的标记位来判断

func DecryptByKey

func DecryptByKey(cipherInfo string, key string) (string, error)

DecryptByKey 解密

func EciesDecryptByJSONPrivateKey

func EciesDecryptByJSONPrivateKey(privateKey string, cipherInfo string) (string, error)

EciesDecryptByJSONPrivateKey 使用字符串私钥进行ecies解密

func EciesEncryptByJSONPublicKey

func EciesEncryptByJSONPublicKey(publicKey string, msg string) (string, error)

EciesEncryptByJSONPublicKey 使用字符串公钥进行ecies加密

func EncryptAccount

func EncryptAccount(info *account.ECDSAAccount, password string) (*account.ECDSAAccountToCloud, error)

EncryptAccount 使用支付密码加密账户信息

func EncryptByKey

func EncryptByKey(info string, key string) (string, error)

EncryptByKey 加密

func GetAccountFromLocal

func GetAccountFromLocal(path string) (*pb.ECDSAAccountFromCloud, error)

GetAccountFromLocal 读取本地文件获取账户信息, read account info from local file

func GetAccountFromServer

func GetAccountFromServer(bduss string) (*pb.ECDSAAccountFromCloud, error)

GetAccountFromServer 获取云端有支付密码的账户

func GetBinaryEcdsaPrivateKeyFromFile

func GetBinaryEcdsaPrivateKeyFromFile(path string, password string) ([]byte, error)

GetBinaryEcdsaPrivateKeyFromFile parse binary ecdsa private key from file

func GetBinaryEcdsaPrivateKeyFromString

func GetBinaryEcdsaPrivateKeyFromString(encryptPrivateKey string, password string) ([]byte, error)

GetBinaryEcdsaPrivateKeyFromString 通过二进制字符串获取真实私钥

func GetEcdsaPrivateKeyFromFile

func GetEcdsaPrivateKeyFromFile(path string, password string) (*ecdsa.PrivateKey, error)

GetEcdsaPrivateKeyFromFile parse ecdsa private key from file

func GetEcdsaPublicKeyFromJSON

func GetEcdsaPublicKeyFromJSON(jsonContent []byte) (*ecdsa.PublicKey, error)

GetEcdsaPublicKeyFromJSON parse ecdsa public key from json encoded string

func GetOriginalAccountFromServer

func GetOriginalAccountFromServer(bduss string) (*account.ECDSAAccount, error)

GetOriginalAccountFromServer 获取云端没有支付密码的账户

func GetPublicKeyByPrivateKey

func GetPublicKeyByPrivateKey(binaryPrivateKey string) (string, error)

GetPublicKeyByPrivateKey 通过私钥获取公钥

func SaveAccountFile

func SaveAccountFile(path string, address string, encryptPrivateKey []byte) error

SaveAccountFile 保存账户信息到文件,只需要保存address 和 privateKey

func SaveAccountToServer

func SaveAccountToServer(accountInfo *account.ECDSAAccountToCloud, bduss string) error

SaveAccountToServer 将账户信息保存到云端

Types

type AccountInfo

type AccountInfo struct {
	Address           string
	PrivateKey        []byte
	PublicKey         []byte
	Mnemonic          []byte
	EncryptPrivateKey []byte
	EncryptPublicKey  []byte
	EncryptMnemonic   []byte
}

AccountInfo describes the data struct for account information

Jump to

Keyboard shortcuts

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