Documentation
¶
Index ¶
- Variables
- func CheckKeyGenerate(newWalletRequest wallet.IWalletKeyManagerKeyGenerate, teeID common.Address) error
- func ExtractKeyExistence(b []byte, teeID common.Address, chainID uint64) (*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 ParseKeyDirectBackup(instructionData *instruction.DataFixed) (wallet.IWalletBackupManagerKeyDirectBackup, error)
- func ParseKeyDirectRestore(instructionData *instruction.DataFixed) (wallet.IWalletBackupManagerKeyDirectRestore, error)
- func ParseKeyGenerate(instructionData *instruction.DataFixed) (wallet.IWalletKeyManagerKeyGenerate, error)
- func ToECDSAUnsafe(sk []byte) *ecdsa.PrivateKey
- func ValidateWalletMemberCounts(adminCount, cosignerCount int) error
- func VerifySignature(msg, signature, publicKey []byte, signingAlgo common.Hash) error
- type KeyDataProviderRestoreResultStatus
- type KeyIDPair
- type SignedKeyExistenceProof
- type Signer
- 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 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, chainID uint64) (*wallet.IWalletKeyManagerKeyExistence, error)
ExtractKeyExistence parses a signed existence proof from bytes and verifies the TEE signature against the canonical chain-bound preimage signing.Payload{TeeKeyExistenceTag, chainID, KeyExistenceDataHash(proof)}.Hash(). chainID must match the chain whose WalletKeyManagerFacet.confirmKey will recover the signer.
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 ParseKeyDirectBackup ¶ added in v0.0.21
func ParseKeyDirectBackup(instructionData *instruction.DataFixed) (wallet.IWalletBackupManagerKeyDirectBackup, error)
ParseKeyDirectBackup decodes the key direct-backup instruction payload.
func ParseKeyDirectRestore ¶ added in v0.0.21
func ParseKeyDirectRestore(instructionData *instruction.DataFixed) (wallet.IWalletBackupManagerKeyDirectRestore, error)
ParseKeyDirectRestore decodes the key direct-restore 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.
func ValidateWalletMemberCounts ¶ added in v0.0.23
ValidateWalletMemberCounts enforces the maximum number of administrators and cosigners that may be associated with a wallet key.
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 TEEBackupResponse ¶
type TEEBackupResponse struct {
BackupID WalletBackupID `json:"backupId"`
WalletBackup []byte `json:"walletBackup"`
}
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.