Documentation
¶
Index ¶
- Variables
- func CheckKeyGenerate(newWalletRequest wallet.IWalletKeyManagerKeyGenerate, teeID common.Address) error
- func ExtractKeyExistence(b []byte, teeID common.Address) (*wallet.IWalletKeyManagerKeyExistence, error)
- func GenerateKey(signingAlgo common.Hash) ([]byte, error)
- func ParseKeyDataProviderRestore(instructionData *instruction.DataFixed) (wallet.IWalletBackupManagerKeyDataProviderRestore, error)
- func ParseKeyDelete(instructionData *instruction.DataFixed) (wallet.IWalletKeyManagerKeyDelete, error)
- func ParseKeyGenerate(instructionData *instruction.DataFixed) (wallet.IWalletKeyManagerKeyGenerate, error)
- func ToECDSAUnsafe(sk []byte) *ecdsa.PrivateKey
- func VerifySignature(msg, signature, publicKey []byte, signingAlgo common.Hash) error
- type KeyDataProviderRestoreResultStatus
- type KeyIDPair
- type SignedKeyExistenceProof
- type Signer
- type Storage
- func (s *Storage) CheckNonce(idPair KeyIDPair, nonce uint64) error
- func (s *Storage) Get(idPair KeyIDPair) (*Wallet, error)
- func (s *Storage) GetWallets() []*Wallet
- func (s *Storage) Nonce(idPair KeyIDPair) (uint64, error)
- func (s *Storage) Remove(idPair KeyIDPair) bool
- func (s *Storage) Store(wallet *Wallet) error
- func (s *Storage) UpdateNonce(idPair KeyIDPair, nonce uint64)
- func (s *Storage) WalletExists(idPair KeyIDPair) bool
- func (s *Storage) WalletExistsPermanent(idPair KeyIDPair) bool
- type TEEBackupResponse
- type Wallet
- type WalletBackupID
- type WalletStatus
Constants ¶
This section is empty.
Variables ¶
var Algos = []common.Hash{EVMSignAlgo, XRPSignAlgo, VRFAlgo}
var EVMSignAlgo = utils.ToHash("keccak256-secp256k1-ecdsa")
var EVMType = utils.ToHash("EVM")
var ErrWalletNonExistent = errors.New("wallet non-existent")
var VRFAlgo = utils.ToHash("keccak256-secp256k1-vrf")
var XRPSignAlgo = utils.ToHash("sha512half-secp256k1-ecdsa")
var XRPType = utils.ToHash("XRP")
Functions ¶
func CheckKeyGenerate ¶
func CheckKeyGenerate(newWalletRequest wallet.IWalletKeyManagerKeyGenerate, teeID common.Address) error
CheckKeyGenerate performs basic validation on the key generation request.
func ExtractKeyExistence ¶
func ExtractKeyExistence(b []byte, teeID common.Address) (*wallet.IWalletKeyManagerKeyExistence, error)
ExtractKeyExistence parses a signed existence proof from bytes.
func GenerateKey ¶
GenerateKey creates a new private key for the signing algorithm.
func ParseKeyDataProviderRestore ¶
func ParseKeyDataProviderRestore(instructionData *instruction.DataFixed) (wallet.IWalletBackupManagerKeyDataProviderRestore, error)
ParseKeyDataProviderRestore decodes the key data provider restore payload.
func ParseKeyDelete ¶
func ParseKeyDelete(instructionData *instruction.DataFixed) (wallet.IWalletKeyManagerKeyDelete, error)
ParseKeyDelete decodes the key deletion instruction payload.
func ParseKeyGenerate ¶
func ParseKeyGenerate(instructionData *instruction.DataFixed) (wallet.IWalletKeyManagerKeyGenerate, error)
ParseKeyGenerate decodes the key generation instruction payload.
func ToECDSAUnsafe ¶
func ToECDSAUnsafe(sk []byte) *ecdsa.PrivateKey
ToECDSAUnsafe converts a private key from byte slice to *ecdsa.PrivateKey. Use only if you are sure that bytes represent a valid private key.
Based on go-ethereum's crypto.ToECDSAUnsafe.
Types ¶
type KeyDataProviderRestoreResultStatus ¶
func NewKeyDataProviderRestoreResultStatus ¶
func NewKeyDataProviderRestoreResultStatus() *KeyDataProviderRestoreResultStatus
NewKeyDataProviderRestoreResultStatus returns an empty restore result status tracker.
func (*KeyDataProviderRestoreResultStatus) AddError ¶
func (s *KeyDataProviderRestoreResultStatus) AddError(i int, err error)
AddError records a decryption or validation error at the given signer index.
func (*KeyDataProviderRestoreResultStatus) Empty ¶
func (s *KeyDataProviderRestoreResultStatus) Empty() bool
Empty reports whether no errors were recorded.
type SignedKeyExistenceProof ¶
type Storage ¶
func InitializeStorage ¶
func InitializeStorage() *Storage
InitializeStorage returns an empty wallet storage instance.
func (*Storage) CheckNonce ¶
CheckNonce ensures the provided nonce is newer than the stored one.
s.RWMutex RLock should be used when calling this method.
func (*Storage) Get ¶
Get retrieves a copy of the wallet or returns ErrWalletNonExistent.
s.RWMutex RLock should be used when calling this method.
func (*Storage) GetWallets ¶
GetWallets returns deep copies of all stored wallets.
s.RWMutex RLock should be used when calling this method.
func (*Storage) Nonce ¶
Nonce returns the stored nonce for the wallet.
s.RWMutex RLock should be used when calling this method.
func (*Storage) Remove ¶
Remove deletes the wallet entry for the given identifier pair.
s.RWMutex Lock should be used when calling this method.
func (*Storage) Store ¶
Store adds the wallet to storage while preserving status state.
s.RWMutex Lock should be used when calling this method.
func (*Storage) UpdateNonce ¶
UpdateNonce sets the wallet's nonce to the provided value.
s.RWMutex Lock should be used when calling this method.
func (*Storage) WalletExists ¶
WalletExists reports whether the wallet is present in storage.
s.RWMutex RLock should be used when calling this method.
func (*Storage) WalletExistsPermanent ¶
WalletExistsPermanent reports whether the wallet is present in permanent storage.
s.RWMutex RLock should be used when calling this method.
type TEEBackupResponse ¶
type TEEBackupResponse struct {
BackupID WalletBackupID
WalletBackup []byte
}
type Wallet ¶
type Wallet struct {
WalletID common.Hash
KeyID uint64
PrivateKey []byte
KeyType common.Hash
SigningAlgo common.Hash
Restored bool
AdminPublicKeys []*ecdsa.PublicKey
AdminsThreshold uint64
Cosigners []common.Address
CosignersThreshold uint64
SettingsVersion common.Hash
Settings hexutil.Bytes
Status *WalletStatus
}
Wallet is a struct carrying the private key of particular wallet. It should never be modified (apart from WalletStatus), after being created.
func GenerateNewKey ¶
func GenerateNewKey(kg wallet.IWalletKeyManagerKeyGenerate) (*Wallet, error)
GenerateNewKey creates a wallet from the key generate instruction payload.
func (*Wallet) Decrypt ¶
Decrypt decrypts an encrypted message using the supplied private key based on type of key.
func (*Wallet) KeyExistenceProof ¶
func (w *Wallet) KeyExistenceProof(teeID common.Address) *wallet.IWalletKeyManagerKeyExistence
KeyExistenceProof builds a key existence proof for the wallet.
type WalletBackupID ¶
type WalletBackupID struct {
TeeID common.Address `json:"teeId"`
WalletID common.Hash `json:"walletId"`
KeyID uint64 `json:"keyId"`
PublicKey hexutil.Bytes `json:"publicKey"`
KeyType common.Hash `json:"keyType"`
SigningAlgo common.Hash `json:"signingAlgo"`
RewardEpochID uint32 `json:"rewardEpochId"`
RandomNonce common.Hash `json:"randomNonce"`
}
func (*WalletBackupID) Equal ¶
func (wid *WalletBackupID) Equal(w *WalletBackupID) error
Equal checks if two wallet backup identifiers are equal.