db

package
v0.0.0-...-40caaf7 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountTypeInvalid = AccountType(iota)
	AccountTypeNonCustodial
	AccountTypeCustodial
)
View Source
const (
	TypeCustodial    = Type("Custodial")
	TypeNonCustodial = Type("NonCustodial")
)
View Source
const MaxNumOfPasswdChars = 32
View Source
const (
	PathAccounts = `/accounts`
)
View Source
const (
	PathActiveAccount = `/activeAccount`
)

Variables

View Source
var (
	ErrInvalidCollectionPath = errors.New("collection path is not valid")
	ErrInvalidDocumentPath   = errors.New("document path is not valid")
)
View Source
var (
	ErrDBIsClosed          = errors.New("database is closed")
	ErrDBIsAlreadyOpen     = errors.New("database is already open")
	ErrPasswordMismatch    = errors.New("password mismatch")
	ErrPasswordInvalid     = errors.New("password invalid")
	ErrPasswordNotSet      = errors.New("password not set")
	ErrPasswdCannotBeEmpty = errors.New("password cannot be empty")
	ErrInvalidPathID       = errors.New("path id is invalid")
	ErrInvalidPath         = errors.New("invalid path")
	ErrInvalidAccount      = errors.New("invalid account")
)

Functions

func DecodeToStruct

func DecodeToStruct(strc interface{}, s []byte) (err error)

DecodeToStruct strc is a pointer to a struct

func EncodeToBytes

func EncodeToBytes(str interface{}) []byte

Ref https://gist.github.com/SteveBate/042960baa7a4795c3565

Types

type Accessor

type Accessor struct {
	// contains filtered or unexported fields
}

func (*Accessor) DatabaseExists

func (s *Accessor) DatabaseExists() bool

func (*Accessor) DatabasePath

func (s *Accessor) DatabasePath() string

func (*Accessor) IsDBOpen

func (s *Accessor) IsDBOpen() bool

func (*Accessor) OpenDB

func (s *Accessor) OpenDB(passwd string) error

func (*Accessor) VerifyPassword

func (s *Accessor) VerifyPassword(passwd string) error

VerifyPassword returns nil if password is correct else may return ErrPasswordMismatch or ErrPasswordInvalid or ErrPasswordNotSet

type Account

type Account struct {
	// contains filtered or unexported fields
}

func (*Account) PathID

func (a *Account) PathID() (pathID string)

func (*Account) Type

func (a *Account) Type() AccountType

type AccountType

type AccountType int

type Type

type Type string

type Wallet

type Wallet struct {
	// contains filtered or unexported fields
}

func Instance

func Instance() *Wallet

func (*Wallet) Accounts

func (d *Wallet) Accounts() ([]Account, error)

func (*Wallet) ActiveAccount

func (d *Wallet) ActiveAccount() (*Account, error)

func (*Wallet) AutoCreateEcdsaAccount

func (d *Wallet) AutoCreateEcdsaAccount() error

func (*Wallet) DBAccessor

func (d *Wallet) DBAccessor() *Accessor

func (*Wallet) DeleteActiveAccount

func (d *Wallet) DeleteActiveAccount() error

func (*Wallet) ImportECDSAAccount

func (d *Wallet) ImportECDSAAccount(pvtKeyStr string) error

func (*Wallet) SetActiveAccount

func (d *Wallet) SetActiveAccount(account Account) error

Jump to

Keyboard shortcuts

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