Documentation ¶
Index ¶
- Variables
- type DecryptFunc
- type IRecorder
- type KeyMiddleware
- type KeyMixLayer
- func (o *KeyMixLayer) CheckToken(ctx context.Context) error
- func (o *KeyMixLayer) Decrypt(password []byte, key *aes.EncryptedKey) (crypto.PrivateKey, error)
- func (o *KeyMixLayer) Encrypt(password []byte, key crypto.PrivateKey) (*aes.EncryptedKey, error)
- func (o *KeyMixLayer) Lock(ctx context.Context, password string) error
- func (o *KeyMixLayer) LockState(ctx context.Context) bool
- func (o *KeyMixLayer) Next() error
- func (o *KeyMixLayer) SetPassword(ctx context.Context, password string) error
- func (o *KeyMixLayer) Unlock(ctx context.Context, password string) error
- func (o *KeyMixLayer) VerifyPassword(_ context.Context, password string) error
- type KeyStore
- type QueryParams
- type SignRecord
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 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) 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
Click to show internal directories.
Click to hide internal directories.