wallet

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CryptoKeyLen = 32 // 256 bits
	ScryptN      = 1024
)
View Source
const BMailAddrPrefix = "BM"
View Source
const (
	BMailPrefix = "BM"
)

Variables

This section is empty.

Functions

func DecodePubKey

func DecodePubKey(pubKeyStr string) ([]byte, error)

func DecryptAes

func DecryptAes(data *CipherData, password string) (string, error)

func DecryptByKey added in v1.0.3

func DecryptByKey(data string, key []byte) (string, error)

func Ed2CurvePriKey

func Ed2CurvePriKey(privateKey []byte) []byte

func Ed2CurvePubKey

func Ed2CurvePubKey(edPub []byte) []byte

func EncryptByKey added in v1.0.3

func EncryptByKey(plainTxt string, key []byte) (string, error)

func VerifySig

func VerifySig(obj any, sig, peerAddr string) error

Types

type CipherData

type CipherData struct {
	CipherTxt  string `json:"cipher_txt"`
	Iv         string `json:"iv"`
	Salt       string `json:"salt"`
	KeySize    int    `json:"key_size"`
	Iterations int    `json:"iterations"`
}

func EncryptAes

func EncryptAes(plainTxt, password string) (*CipherData, error)

type MailAddr

type MailAddr struct {
	BmailAddress string `json:"bmail_address"`
	EthAddress   string `json:"eth_address"`
}

func (*MailAddr) Equal

func (ma *MailAddr) Equal(ma2 *MailAddr) bool

func (*MailAddr) String

func (ma *MailAddr) String() string

type MailKey

type MailKey struct {
	Address *MailAddr
	// contains filtered or unexported fields
}

func NewMailKey

func NewMailKey() *MailKey

func NewMailKeyFromSeed

func NewMailKeyFromSeed(seed []byte) *MailKey

func (*MailKey) SignMessage

func (mk *MailKey) SignMessage(msg []byte) string

func (*MailKey) ToWallet

func (mk *MailKey) ToWallet(pwd string) (*Wallet, error)

type Wallet

type Wallet struct {
	Address    *MailAddr   `json:"address"`
	CipherData *CipherData `json:"cipher_data"`
	Version    int         `json:"version"`
	// contains filtered or unexported fields
}

func LoadWallet

func LoadWallet(jsonStr string) (*Wallet, error)

func ParseWallet

func ParseWallet(jsonStr, pwd string) (*Wallet, error)

func (*Wallet) DecryptData added in v1.0.3

func (w *Wallet) DecryptData(peerAddr, msg string) (string, error)

func (*Wallet) EncryptData added in v1.0.3

func (w *Wallet) EncryptData(peerAddr, msg string) (string, error)

func (*Wallet) KeyFromPeerAddr added in v1.0.3

func (w *Wallet) KeyFromPeerAddr(addr string) ([]byte, error)

func (*Wallet) OpenWallet

func (w *Wallet) OpenWallet(pwd string) bool

func (*Wallet) SignMessage added in v1.0.3

func (w *Wallet) SignMessage(msg []byte) (string, error)

func (*Wallet) String

func (w *Wallet) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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