storage

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT, Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLocked          = errors.New("wallet locked")
	ErrPasswordEmpty   = errors.New("password not set")
	ErrInvalidPassword = errors.New("password mismatch")
	ErrPasswordExist   = errors.New("the password already exists")
	ErrAlreadyUnlocked = errors.New("wallet already unlocked")
	ErrAlreadyLocked   = errors.New("wallet already locked")
)
View Source
var (
	ErrKeyInfoNotFound = fmt.Errorf("key info not found")
	ErrKeyExists       = fmt.Errorf("key already exists")
)
View Source
var EmptyPassword []byte

Functions

This section is empty.

Types

type DecryptFunc

type DecryptFunc func(keyJson []byte, keyType types.KeyType) (crypto.PrivateKey, error)

type IRecorder added in v1.11.0

type IRecorder interface {
	Record(rcd *SignRecord) error
	QueryRecord(params *QueryParams) ([]SignRecord, error)
}

type KeyMiddleware

type KeyMiddleware interface {
	// Encrypt aes encrypt key
	Encrypt(password []byte, key crypto.PrivateKey) (*aes.EncryptedKey, error)
	// Decrypt aes decrypt key
	Decrypt(password []byte, key *aes.EncryptedKey) (crypto.PrivateKey, error)
	// Next Check the password has been set and the wallet is locked
	Next() error
	// CheckToken check if the `strategy` token has all permissions
	CheckToken(ctx context.Context) error
	walletAPI.IWalletLock
}

KeyMiddleware the middleware bridging strategy and wallet

func NewKeyMiddleware

func NewKeyMiddleware(cnf *config.CryptoFactor) KeyMiddleware

type KeyMixLayer

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

func (*KeyMixLayer) CheckToken

func (o *KeyMixLayer) CheckToken(ctx context.Context) error

func (*KeyMixLayer) Decrypt

func (o *KeyMixLayer) Decrypt(password []byte, key *aes.EncryptedKey) (crypto.PrivateKey, error)

func (*KeyMixLayer) Encrypt

func (o *KeyMixLayer) Encrypt(password []byte, key crypto.PrivateKey) (*aes.EncryptedKey, error)

func (*KeyMixLayer) Lock

func (o *KeyMixLayer) Lock(ctx context.Context, password string) error

func (*KeyMixLayer) LockState

func (o *KeyMixLayer) LockState(ctx context.Context) bool

func (*KeyMixLayer) Next

func (o *KeyMixLayer) Next() error

Next Check the password has been set and the wallet is locked

func (*KeyMixLayer) SetPassword

func (o *KeyMixLayer) SetPassword(ctx context.Context, password string) error

func (*KeyMixLayer) Unlock

func (o *KeyMixLayer) Unlock(ctx context.Context, password string) error

func (*KeyMixLayer) VerifyPassword added in v1.2.1

func (o *KeyMixLayer) VerifyPassword(_ context.Context, password string) error

type KeyStore

type KeyStore interface {
	// Put saves a key info
	Put(key *aes.EncryptedKey) error
	// Get gets a key out of keystore and returns PrivateKey corresponding to key address
	Get(addr address.Address) (*aes.EncryptedKey, error)
	// Has check the PrivateKey exist in the KeyStore
	Has(addr address.Address) (bool, error)
	// List lists all the keys stored in the KeyStore
	List() ([]address.Address, error)
	// Delete removes a key from keystore
	Delete(addr address.Address) error
}

Constraint database implementation has: sqlite

type QueryParams added in v1.11.0

type QueryParams = types.QuerySignRecordParams

type SignRecord added in v1.11.0

type SignRecord = types.SignRecord

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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