Documentation ¶
Index ¶
- Constants
- Variables
- func AESKey(salt []byte, password string) ([]byte, error)
- func CheckID(address string) bool
- func Decrypt(key []byte, cipherTxt []byte) ([]byte, error)
- func Encrypt(key []byte, plainTxt []byte) ([]byte, error)
- func EncryptWithIV(key, iv, plainTxt []byte) ([]byte, error)
- func GenerateAesKey(aesKey *PipeCryptKey, peerPub []byte, key ed25519.PrivateKey) 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 Account
- type ID
- type Key
- type PWallet
- func (pw *PWallet) Close()
- func (pw *PWallet) CryptKey() ed25519.PrivateKey
- func (pw *PWallet) ExportEth(auth, eAuth, path string) error
- func (pw *PWallet) IsOpen() bool
- func (pw *PWallet) MainAddress() common.Address
- func (pw *PWallet) Open(auth string) error
- func (pw *PWallet) SaveToPath(wPath string) error
- func (pw *PWallet) Sign(v []byte) ([]byte, error)
- func (pw *PWallet) SignJSONSub(v interface{}) []byte
- func (pw *PWallet) SignJson(v interface{}) ([]byte, error)
- func (pw *PWallet) SignKey() *ecdsa.PrivateKey
- func (pw *PWallet) SignSub(v []byte) []byte
- func (pw *PWallet) String() string
- func (pw *PWallet) SubAddress() ID
- func (pw *PWallet) VerifySig(message, signature []byte) bool
- type PeerID
- type PipeCryptKey
- type SafeAccount
- type Wallet
- type WalletKey
Constants ¶
View Source
const ( AccPrefix = "SV" AccIDLen = 40 SocketPortInit = 23000 SocketPortRange = 8888 )
View Source
const ServeNodeSep = "@"
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")
)
View Source
var ErrInvalidID = fmt.Errorf("invalid node id")
Functions ¶
func EncryptWithIV ¶
func GenerateAesKey ¶
func GenerateAesKey(aesKey *PipeCryptKey, peerPub []byte, key ed25519.PrivateKey) error
func PrivateKeyToCurve25519 ¶
func PublicKeyToCurve25519 ¶
func RecoverJson ¶
func VerifySubSig ¶
Types ¶
type Account ¶
func AccFromString ¶
func (*Account) CreateAesKey ¶
func (acc *Account) CreateAesKey(key *PipeCryptKey, peerAddr string) error
func (*Account) FormatShow ¶
type Key ¶
type Key struct { PriKey ed25519.PrivateKey `json:"-"` PubKey ed25519.PublicKey `json:"pubKey"` LockedKey []byte `json:"cipherTxt"` }
func GenerateKey ¶
func (*Key) GenerateAesKey ¶
func (k *Key) GenerateAesKey(aesKey *PipeCryptKey, peerPub []byte) error
type PWallet ¶
type PWallet 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 (*PWallet) CryptKey ¶
func (pw *PWallet) CryptKey() ed25519.PrivateKey
func (*PWallet) MainAddress ¶
func (*PWallet) SaveToPath ¶
func (*PWallet) SignJSONSub ¶
func (*PWallet) SignKey ¶
func (pw *PWallet) SignKey() *ecdsa.PrivateKey
func (*PWallet) SubAddress ¶
type PeerID ¶
func ConvertPID ¶
type PipeCryptKey ¶
type PipeCryptKey [32]byte
type SafeAccount ¶
type SafeAccount struct { Version string `json:"version"` Address ID `json:"address"` Cipher string `json:"cipher"` }
func (*SafeAccount) Unlock ¶
func (sa *SafeAccount) Unlock(auth string) (ed25519.PrivateKey, error)
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) VerifySig(message, signature []byte) bool 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 LoadWallet ¶
func LoadWalletByData ¶
type WalletKey ¶
type WalletKey struct { SubPriKey ed25519.PrivateKey MainPriKey *ecdsa.PrivateKey }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.