Documentation ¶
Index ¶
- Constants
- Variables
- func AESKey(salt []byte, password string) ([]byte, error)
- func Decrypt(key []byte, cipherTxt []byte) ([]byte, error)
- func DecryptAndIV(key []byte, cipherTxt []byte) (iv, plainTxt []byte, err error)
- func DecryptSubPriKey(pk ed25519.PublicKey, cpTxt, auth string) (ed25519.PrivateKey, error)
- func Encrypt(key []byte, plainTxt []byte) ([]byte, error)
- func EncryptSubPriKey(priKey ed25519.PrivateKey, pubKey ed25519.PublicKey, auth string) (string, error)
- func EncryptWithIV(key, iv, plainTxt []byte) ([]byte, error)
- func GenerateAesKey(peerPub []byte, key ed25519.PrivateKey) ([]byte, error)
- func LoadWallet(wPath string, wallet Wallet) error
- func LoadWalletFromJson(jsonStr string, wallet Wallet) error
- func PrivateKeyToCurve25519(curve25519Private *[32]byte, privateKey *[64]byte)
- func PublicKeyToCurve25519(curve25519Public *[32]byte, publicKey *[32]byte) bool
- func RecoverJson(sig []byte, v interface{}) common.Address
- func VerifyAbiSig(mainAddr common.Address, sig []byte, msg []byte) bool
- func VerifyJsonSig(mainAddr common.Address, sig []byte, v interface{}) bool
- func VerifySubSig(subAddr ID, sig []byte, v interface{}) bool
- type ID
- type PayableWallet
- func (pw *PayableWallet) Close()
- func (pw *PayableWallet) CryptKey() ed25519.PrivateKey
- func (pw *PayableWallet) ExportEth(auth, eAuth, path string) error
- func (pw *PayableWallet) IsOpen() bool
- func (pw *PayableWallet) MainAddress() common.Address
- func (pw *PayableWallet) Open(auth string) error
- func (pw *PayableWallet) SaveToPath(wPath string) error
- func (pw *PayableWallet) Sign(v []byte) ([]byte, error)
- func (pw *PayableWallet) SignJSONSub(v interface{}) []byte
- func (pw *PayableWallet) SignJson(v interface{}) ([]byte, error)
- func (pw *PayableWallet) SignKey() *ecdsa.PrivateKey
- func (pw *PayableWallet) SignSub(v []byte) []byte
- func (pw *PayableWallet) String() string
- func (pw *PayableWallet) SubAddress() ID
- type PipeCryptKey
- type Wallet
- type WalletKey
Constants ¶
View Source
const ( AccPrefix = "BM" AccIDLen = 40 SocketPortInit = 52000 SocketPortRange = 12000 )
View Source
const (
WalletVersion = 1
)
Variables ¶
View Source
var (
EConvertCurvePubKey = fmt.Errorf("convert ed25519 public key to curve25519 public key failed")
)
View Source
var (
EInvalidID = fmt.Errorf("invalid ID")
)
Functions ¶
func DecryptAndIV ¶
func DecryptSubPriKey ¶
func EncryptSubPriKey ¶
func EncryptWithIV ¶
func GenerateAesKey ¶
func GenerateAesKey(peerPub []byte, key ed25519.PrivateKey) ([]byte, error)
func LoadWallet ¶
func LoadWalletFromJson ¶
func PrivateKeyToCurve25519 ¶
func PublicKeyToCurve25519 ¶
func RecoverJson ¶
func VerifySubSig ¶
Types ¶
type PayableWallet ¶
type PayableWallet struct { Version int `json:"version"` MainAddr common.Address `json:"mainAddress"` Crypto keystore.CryptoJSON `json:"crypto"` SubAddr ID `json:"subAddress"` SubCipher string `json:"subCipher"` // contains filtered or unexported fields }
func (*PayableWallet) Close ¶
func (pw *PayableWallet) Close()
func (*PayableWallet) CryptKey ¶
func (pw *PayableWallet) CryptKey() ed25519.PrivateKey
func (*PayableWallet) ExportEth ¶
func (pw *PayableWallet) ExportEth(auth, eAuth, path string) error
func (*PayableWallet) IsOpen ¶
func (pw *PayableWallet) IsOpen() bool
func (*PayableWallet) MainAddress ¶
func (pw *PayableWallet) MainAddress() common.Address
func (*PayableWallet) Open ¶
func (pw *PayableWallet) Open(auth string) error
func (*PayableWallet) SaveToPath ¶
func (pw *PayableWallet) SaveToPath(wPath string) error
func (*PayableWallet) SignJSONSub ¶
func (pw *PayableWallet) SignJSONSub(v interface{}) []byte
func (*PayableWallet) SignJson ¶
func (pw *PayableWallet) SignJson(v interface{}) ([]byte, error)
func (*PayableWallet) SignKey ¶
func (pw *PayableWallet) SignKey() *ecdsa.PrivateKey
func (*PayableWallet) SignSub ¶
func (pw *PayableWallet) SignSub(v []byte) []byte
func (*PayableWallet) String ¶
func (pw *PayableWallet) String() string
func (*PayableWallet) SubAddress ¶
func (pw *PayableWallet) SubAddress() ID
type PipeCryptKey ¶
type PipeCryptKey [32]byte
type Wallet ¶
type Wallet interface { SignKey() *ecdsa.PrivateKey CryptKey() ed25519.PrivateKey MainAddress() common.Address SubAddress() ID SignJson(v interface{}) ([]byte, error) Sign(v []byte) ([]byte, error) SignJSONSub(v interface{}) []byte SignSub(v []byte) []byte Open(auth string) error IsOpen() bool SaveToPath(wPath string) error String() string Close() ExportEth(auth, eAuth, path string) error }
func NewPayableWallet ¶
type WalletKey ¶
type WalletKey struct { SubPriKey ed25519.PrivateKey MainPriKey *ecdsa.PrivateKey }
Click to show internal directories.
Click to hide internal directories.