Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WalletFromKeyDirectBackupPayload ¶ added in v0.0.21
func WalletFromKeyDirectBackupPayload(p *KeyDirectBackupPayload, privateKey []byte) (*wallets.Wallet, error)
WalletFromKeyDirectBackupPayload reconstructs a wallets.Wallet from a direct-backup payload. The caller decrypts EncryptedPrivateKey out-of-band (typically with the destination TEE's ECIES key) and passes the plaintext private-key bytes in. The decrypted public key must match BackupID.PublicKey. The resulting wallet is marked Restored with a zero status.
Types ¶
type EncryptedShares ¶
type EncryptedShares struct {
}
func (*EncryptedShares) Check ¶
func (e *EncryptedShares) Check() error
Check ensures the encrypted shares meet threshold and weighting requirements.
type KeyDirectBackupPayload ¶ added in v0.0.21
type KeyDirectBackupPayload struct {
BackupID wallets.WalletBackupID `json:"backupId"`
// EncryptedPrivateKey is ECIES(destinationPub, w.PrivateKey).
EncryptedPrivateKey hexutil.Bytes `json:"encryptedPrivateKey"`
AdminPublicKeys []types.PublicKey `json:"adminPublicKeys"`
AdminsThreshold uint64 `json:"adminsThreshold"`
Cosigners []common.Address `json:"cosigners"`
CosignersThreshold uint64 `json:"cosignersThreshold"`
SettingsVersion common.Hash `json:"settingsVersion"`
Settings hexutil.Bytes `json:"settings"`
Status wallets.WalletStatus `json:"status"`
}
KeyDirectBackupPayload is the JSON-serializable form of a wallet produced by KEY_DIRECT_BACKUP. BackupID identifies the wallet+key and binds it to the source TEE, the reward epoch, and a per-backup random nonce. EncryptedPrivateKey is ECIES under the destination's public key; the remaining wallet-configuration fields are plaintext and are covered by the source TEE's signature over the payload.
func NewKeyDirectBackupPayload ¶ added in v0.0.21
func NewKeyDirectBackupPayload( w *wallets.Wallet, sourceTeeID common.Address, encryptedPrivateKey hexutil.Bytes, rewardEpochID uint32, randomNonce common.Hash, ) (*KeyDirectBackupPayload, error)
NewKeyDirectBackupPayload assembles the wire-format direct-backup payload. The caller supplies encryptedPrivateKey (typically ECIES of w.PrivateKey under the destination's public key); the helper derives the secp256k1 public key for BackupID, copies slices defensively, and stamps the freshness markers. Only signing algorithms in wallets.Algos are supported.
type KeySplit ¶
type KeySplit struct {
KeySplitData
Signature []byte
}
func DecryptSplit ¶
func DecryptSplit(encryptedShare []byte, privKeyECDSA *ecdsa.PrivateKey, chainID uint64) (*KeySplit, error)
DecryptSplit decrypts an encrypted key split and verifies its integrity.
func (*KeySplit) VerifySignature ¶
VerifySignature checks that the key split signature matches the owner key.
type KeySplitData ¶
type KeySplitData struct {
PartialWalletBackupID
OwnerPublicKey types.PublicKey
}
func (*KeySplitData) HashForSigning ¶
func (ksd *KeySplitData) HashForSigning() (common.Hash, error)
HashForSigning computes the hash used when signing the key split data.
type PartialWalletBackupID ¶
type PartialWalletBackupID struct {
wallets.WalletBackupID
PartialPubKey hexutil.Bytes
IsAdmin bool
}
func (*PartialWalletBackupID) Equal ¶
func (pwid *PartialWalletBackupID) Equal(w *PartialWalletBackupID) bool
type ShamirShare ¶
type ShamirShare struct {
}
func (*ShamirShare) ID ¶
func (s *ShamirShare) ID() string
ID returns the string identifier for the Shamir share.
type WalletBackup ¶
type WalletBackup struct {
WalletBackupMetaData
AdminEncryptedParts *EncryptedShares
ProviderEncryptedParts *EncryptedShares
Signature hexutil.Bytes
TEESignature hexutil.Bytes
}
func (*WalletBackup) Check ¶
func (wb *WalletBackup) Check(chainID uint64) error
Check validates the metadata and share alignment in the wallet backup.
func (*WalletBackup) HashForSigning ¶
func (wb *WalletBackup) HashForSigning() (common.Hash, error)
HashForSigning produces the hash over the wallet backup content.
func (*WalletBackup) OwnerSignHash ¶ added in v0.0.21
func (wb *WalletBackup) OwnerSignHash(chainID uint64) (common.Hash, error)
OwnerSignHash returns the domain-separated, chain-bound preimage signed by the wallet (owner) key over the backup: signing.Payload{csigning.PMWWalletBackup, chainID, HashForSigning()}.Hash().
func (*WalletBackup) TEESignHash ¶ added in v0.0.21
func (wb *WalletBackup) TEESignHash(chainID uint64) (common.Hash, error)
TEESignHash returns the domain-separated, chain-bound preimage signed by the TEE identity key over the backup: signing.Payload{csigning.TEEWalletBackup, chainID, HashForSigning()}.Hash().