account

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2019 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeInvalidDBPtr = -1 - iota
	CodeInvalidWalletPtr
	CodeInvalidIndex
	CodeIOError
)
View Source
const (
	// max number of onload-dbs
	MXONLOADDB = 64
)

Variables

This section is empty.

Functions

func CloseDB

func CloseDB(dbptr Export_C_Int)

func MakeMsgHash

func MakeMsgHash(msg ...[]byte) []byte

func NewLevelDBHandler

func NewLevelDBHandler(dbpath *Export_C_Char) C.int

func NewWalletHandler

func NewWalletHandler(dbptr Export_C_Int, wltname *Export_C_Char) C.int

func NewWalletHandlerFromDB

func NewWalletHandlerFromDB(dbptr Export_C_Int, wltname *Export_C_Char) C.int

func PreCheckWallet

func PreCheckWallet(wltptr Export_C_Int) C.int

func WalletAddress

func WalletAddress(wltptr Export_C_Int, idx Export_C_Int) unsafe.Pointer

func WalletExist

func WalletExist(db *leveldb.DB, name string) (bool, error)

func WalletSign

func WalletSign(wltptr Export_C_Int, idx Export_C_Int, msg unsafe.Pointer, msgSize Export_C_Int) unsafe.Pointer

func WalletSignHash

func WalletSignHash(wltptr Export_C_Int, idx Export_C_Int, msgHash unsafe.Pointer) unsafe.Pointer

func WalletVerifyByHash

func WalletVerifyByHash(wltptr Export_C_Int, idx Export_C_Int, signature unsafe.Pointer, msgHash unsafe.Pointer) C.int

func WalletVerifyByRaw

func WalletVerifyByRaw(wltptr Export_C_Int, idx Export_C_Int, signature unsafe.Pointer, msg unsafe.Pointer, msgSize Export_C_Int) C.int

Types

type Account

type Account struct {
	PrivateKey eddsa.PrivateKey `json:"pri"`
	PublicKey  eddsa.PublicKey  `json:"pub"`
}

func NewAccount

func NewAccount(seeds ...[]byte) *Account

func ReadAccount

func ReadAccount(PrivateKey []byte) *Account

func (*Account) Sign

func (acc *Account) Sign(msg ...[]byte) []byte

func (*Account) SignHash

func (acc *Account) SignHash(msgHash []byte) []byte

func (*Account) VerifyByHash

func (acc *Account) VerifyByHash(signature []byte, msgHash []byte) bool

func (*Account) VerifyByRaw

func (acc *Account) VerifyByRaw(signature []byte, msg ...[]byte) bool

type Export_C_Char

type Export_C_Char C.char

type Export_C_Int

type Export_C_Int C.int

type Wallet

type Wallet struct {
	Acc []*Account `json:"accs"`
	// contains filtered or unexported fields
}

func NewWallet

func NewWallet(db *leveldb.DB, name string) *Wallet

func ReadWallet

func ReadWallet(db *leveldb.DB, name string) (*Wallet, error)

func (*Wallet) AppendAccount

func (wlt *Wallet) AppendAccount(acc *Account)

func (*Wallet) Save

func (wlt *Wallet) Save() error

func (*Wallet) Sign

func (wlt *Wallet) Sign(idx int, msg ...[]byte) []byte

func (*Wallet) SignHash

func (wlt *Wallet) SignHash(idx int, msgHash []byte) []byte

func (*Wallet) String

func (wlt *Wallet) String() string

func (*Wallet) VerifyByHash

func (wlt *Wallet) VerifyByHash(idx int, signature []byte, msgHash []byte) bool

func (*Wallet) VerifyByRaw

func (wlt *Wallet) VerifyByRaw(idx int, signature []byte, msg ...[]byte) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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