Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAddressFormat(address string) (bool, uint8)
- func CreateNewAccountWithMnemonic(language int, strength uint8, cryptography uint8) (*account.ECDSAAccount, error)
- func ExportNewAccount(path string, privateKey *ecdsa.PrivateKey) error
- func ExportNewAccountWithMnemonic(path string, language int, strength uint8, cryptography uint8) error
- func GenerateAccountByMnemonic(mnemonic string, language int) (*account.ECDSAAccount, error)
- func GetAddressFromPublicKey(pub *ecdsa.PublicKey) (string, error)
- func GetAddressFromPublicKeys(keys []*ecdsa.PublicKey) (string, error)
- func GetCryptoByteFromMnemonic(mnemonic string, language int) (uint8, error)
- func GetEcdsaPrivateKeyFromFile(filename string) (*ecdsa.PrivateKey, error)
- func GetEcdsaPrivateKeyFromJson(jsonContent []byte) (*ecdsa.PrivateKey, error)
- func GetEcdsaPrivateKeyJsonFormat(k *ecdsa.PrivateKey) (string, error)
- func GetEcdsaPublicKeyFromFile(filename string) (*ecdsa.PublicKey, error)
- func GetEcdsaPublicKeyFromJson(jsonContent []byte) (*ecdsa.PublicKey, error)
- func GetEcdsaPublicKeyJsonFormat(k *ecdsa.PrivateKey) (string, error)
- func GetEcdsaPublicKeyJsonFormatFromPublicKey(k *ecdsa.PublicKey) (string, error)
- func RetrievePrivateKeyByShares(strEncodeComplexShareGroup []string) (string, error)
- func SplitPrivateKey(jsonPrivKey string, totalShareNumber, minimumShareNumber int) ([]string, error)
- func VerifyAddressUsingPublicKey(address string, pub *ecdsa.PublicKey) (bool, uint8)
- func VerifyAddressUsingPublicKeys(address string, pubs []*ecdsa.PublicKey) (bool, uint8)
- type ECDSAPrivateKey
- type ECDSAPublicKey
- type PrivateKeyShare
- type ShareGroup
Constants ¶
View Source
const ( // 不同语言标准不一样,这里用const直接定义值还是好一些 // _ = iota // 低 StrengthEasy = 1 // 中 StrengthMiddle = 2 // 高 StrengthHard = 3 )
定义助记词的强度类型
View Source
const ( // 不同语言标准不一样,这里用const直接定义值还是好一些 // _ = iota // 美国Federal Information Processing Standards的椭圆曲线 EccFIPS = iota // 国密椭圆曲线 EccGM )
定义密码算法的类型
Variables ¶
View Source
var ( TooSmallNumOfkeysError = errors.New("The total num of keys should be greater than one") CurveParamNilError = errors.New("curve input param is nil") NotExactTheSameCurveInputError = errors.New("the curve is not same as curve of members") KeyParamNotMatchError = errors.New("key param not match") )
View Source
var ( // 1111 - 11个1,当一个大的bigint和它进行“And”比特运算的时候,就会获得大的bigint最右边4位的比特位 Last4BitsMask = big.NewInt(15) // 10000 - 乘以这个带有4个0的数等于左移4个比特位,除以这个带有4个0的数等于右移4个比特位, Shift4BitsFactor = big.NewInt(16) )
View Source
var ( // 助记词的强度暂未被支持 // Strength required for generating Mnemonic has not been supported yet. ErrStrengthNotSupported = fmt.Errorf("This strength has not been supported yet.") // 密码学算法暂未被支持 // Cryptography required for generating Mnemonic has not been supported yet. ErrCryptographyNotSupported = fmt.Errorf("This cryptography has not been supported yet.") // 语言暂未被支持 // ReservedType required for generating Mnemonic has not been supported yet. ErrReservedTypeNotSupported = fmt.Errorf("This ReservedType has not been supported yet.") )
Functions ¶
func CheckAddressFormat ¶
验证钱包地址是否是合法的格式 如果成功,返回true和对应的密码学标记位;如果失败,返回false和默认的密码学标记位0
func CreateNewAccountWithMnemonic ¶
func CreateNewAccountWithMnemonic(language int, strength uint8, cryptography uint8) (*account.ECDSAAccount, error)
参数字段:版本号、语言、强度 返回的字段:助记词、私钥的json、公钥的json、钱包地址、错误信息
func ExportNewAccount ¶
func ExportNewAccount(path string, privateKey *ecdsa.PrivateKey) error
func GenerateAccountByMnemonic ¶
func GenerateAccountByMnemonic(mnemonic string, language int) (*account.ECDSAAccount, error)
通过助记词来产生/恢复钱包账户
func GetAddressFromPublicKey ¶
返回33位长度的地址
func GetAddressFromPublicKeys ¶
generate address for multi-signature / ring-signature algorithm 为多个公钥生成地址,比如环签名地址,多重签名地址
func GetEcdsaPrivateKeyFromFile ¶
func GetEcdsaPrivateKeyFromFile(filename string) (*ecdsa.PrivateKey, error)
func GetEcdsaPrivateKeyFromJson ¶
func GetEcdsaPrivateKeyFromJson(jsonContent []byte) (*ecdsa.PrivateKey, error)
func GetEcdsaPrivateKeyJsonFormat ¶
func GetEcdsaPrivateKeyJsonFormat(k *ecdsa.PrivateKey) (string, error)
获得私钥所对应的的json
func GetEcdsaPublicKeyJsonFormat ¶
func GetEcdsaPublicKeyJsonFormat(k *ecdsa.PrivateKey) (string, error)
获得公钥所对应的的json
func GetEcdsaPublicKeyJsonFormatFromPublicKey ¶
获得公钥所对应的的json
func RetrievePrivateKeyByShares ¶
RetrievePrivateKeyByShares 私钥恢复
func SplitPrivateKey ¶
func SplitPrivateKey(jsonPrivKey string, totalShareNumber, minimumShareNumber int) ([]string, error)
SplitPrivateKey 私钥分割
func VerifyAddressUsingPublicKey ¶
验证钱包地址是否和指定的公钥match 如果成功,返回true和对应的密码学标记位;如果失败,返回false和默认的密码学标记位0
Types ¶
type ECDSAPrivateKey ¶
通过这个数据结构来生成私钥的json
type ECDSAPublicKey ¶
通过这个数据结构来生成公钥的json
Click to show internal directories.
Click to hide internal directories.