Documentation ¶
Index ¶
- Constants
- Variables
- func AESKey(salt []byte, password string) ([]byte, error)
- func Decrypt(key []byte, cipherTxt []byte) ([]byte, error)
- func Encrypt(key []byte, plainTxt []byte) ([]byte, error)
- func PrivateKeyToCurve25519(curve25519Private *[32]byte, privateKey *[64]byte)
- func RecoverPub(addr WalletAddr, suffix string) ([]byte, error)
- func VerifyStamp(stamp Stamp) error
- type CipherData
- type KeyParam
- type RawStamp
- func (r *RawStamp) GetMailID() string
- func (r *RawStamp) GetMailSender() string
- func (r *RawStamp) GetStampAddr() StampAddr
- func (r *RawStamp) GetWalletAddr() WalletAddr
- func (r *RawStamp) IsValidInitData() bool
- func (r *RawStamp) SetAddr(addr WalletAddr)
- func (r *RawStamp) SetEthAddr(addr common.Address)
- func (r *RawStamp) SetMsgID(id string)
- func (r *RawStamp) SetNo(no int)
- type SDataBase
- func (db *SDataBase) AppendString(key string, newV string) error
- func (db *SDataBase) Del(key []byte) error
- func (db *SDataBase) GetInt(key string) uint64
- func (db *SDataBase) GetJsonObj(key []byte, v interface{}) error
- func (db *SDataBase) GetString(key string) string
- func (db *SDataBase) SaveInt(key string, val uint64) error
- func (db *SDataBase) SaveJsonObj(key []byte, v interface{}) error
- func (db *SDataBase) SaveString(key string, val string) error
- func (db *SDataBase) TrimString(key string, trimV string) error
- type SimpleStamp
- type SimpleStampSig
- type SimpleWallet
- func (sw *SimpleWallet) Address() WalletAddr
- func (sw *SimpleWallet) Close()
- func (sw *SimpleWallet) EthAddr() common.Address
- func (sw *SimpleWallet) IsOpen() bool
- func (sw *SimpleWallet) Name() string
- func (sw *SimpleWallet) Open(auth string) error
- func (sw *SimpleWallet) SetName(newName string)
- func (sw *SimpleWallet) Sign(s StampData) StampSig
- func (sw *SimpleWallet) String() string
- func (sw *SimpleWallet) Verbose() string
- type Stamp
- type StampAddr
- type StampData
- type StampSig
- type Wallet
- type WalletAddr
Constants ¶
View Source
const ( AccPrefix = "BS" AccLen = 20 )
View Source
const (
WalletVersion = "1"
)
Variables ¶
View Source
var ( WOpenErr = errors.New("open wallet failed") WVerifyErr = errors.New("verify signature failed") WInvalidSig = errors.New("invalid signature data") )
View Source
var (
InvalidAddr = errors.New("invalid address")
)
View Source
var KP = KeyParam{
S: 8,
N: 1 << 15,
R: 8,
P: 1,
L: 32,
}
Functions ¶
func PrivateKeyToCurve25519 ¶
func RecoverPub ¶
func RecoverPub(addr WalletAddr, suffix string) ([]byte, error)
func VerifyStamp ¶
Types ¶
type CipherData ¶
type RawStamp ¶
type RawStamp struct { WAddr WalletAddr `json:"wallet_addr"` SAddr StampAddr `json:"stamp_addr"` EAddr common.Address `json:"eth_addr"` FromMailAddr string `json:"from_mail_addr"` MsgID string `json:"msg_id"` No int `json:"no"` Time int64 `json:"time"` }
func (*RawStamp) GetMailSender ¶
func (*RawStamp) GetStampAddr ¶
func (*RawStamp) GetWalletAddr ¶
func (r *RawStamp) GetWalletAddr() WalletAddr
func (*RawStamp) IsValidInitData ¶
func (*RawStamp) SetAddr ¶
func (r *RawStamp) SetAddr(addr WalletAddr)
func (*RawStamp) SetEthAddr ¶
type SimpleStamp ¶
type SimpleStamp struct { Data *RawStamp Sig *SimpleStampSig }
func (*SimpleStamp) RawData ¶
func (ss *SimpleStamp) RawData() StampData
func (*SimpleStamp) Serial ¶
func (ss *SimpleStamp) Serial() string
func (*SimpleStamp) SigData ¶
func (ss *SimpleStamp) SigData() StampSig
type SimpleStampSig ¶
func (*SimpleStampSig) Data ¶
func (sss *SimpleStampSig) Data() string
func (*SimpleStampSig) Suffix ¶
func (sss *SimpleStampSig) Suffix() string
type SimpleWallet ¶
type SimpleWallet struct { NickName string `json:"nick_name"` Version string `json:"version"` Addr WalletAddr `json:"address"` EAddr common.Address `json:"eth_addr"` Cipher *CipherData `json:"cipher"` // contains filtered or unexported fields }
func (*SimpleWallet) Address ¶
func (sw *SimpleWallet) Address() WalletAddr
func (*SimpleWallet) Close ¶
func (sw *SimpleWallet) Close()
func (*SimpleWallet) EthAddr ¶
func (sw *SimpleWallet) EthAddr() common.Address
func (*SimpleWallet) IsOpen ¶
func (sw *SimpleWallet) IsOpen() bool
func (*SimpleWallet) Name ¶ added in v1.0.2
func (sw *SimpleWallet) Name() string
func (*SimpleWallet) Open ¶
func (sw *SimpleWallet) Open(auth string) error
func (*SimpleWallet) SetName ¶ added in v1.0.2
func (sw *SimpleWallet) SetName(newName string)
func (*SimpleWallet) Sign ¶
func (sw *SimpleWallet) Sign(s StampData) StampSig
func (*SimpleWallet) String ¶
func (sw *SimpleWallet) String() string
func (*SimpleWallet) Verbose ¶
func (sw *SimpleWallet) Verbose() string
type StampData ¶
type StampData interface { SetMsgID(id string) GetMailSender() string SetNo(no int) GetWalletAddr() WalletAddr GetStampAddr() StampAddr GetMailID() string SetEthAddr(addr common.Address) SetAddr(addr WalletAddr) IsValidInitData() bool }
type Wallet ¶
type Wallet interface { Name() string SetName(nn string) Address() WalletAddr Open(auth string) error Verbose() string Close() Sign(s StampData) StampSig IsOpen() bool EthAddr() common.Address fmt.Stringer }
func CreateWallet ¶
func LoadByFile ¶
func LoadByJsonData ¶
type WalletAddr ¶
type WalletAddr string
func PubToAddr ¶
func PubToAddr(key []byte) (WalletAddr, string)
Click to show internal directories.
Click to hide internal directories.