Documentation
¶
Index ¶
- Constants
- func BackupWallet(wallet *wallets.Wallet, providerPubKeys []*ecdsa.PublicKey, ...) (*backup.WalletBackup, error)
- func CheckKeyShares(splits []*backup.KeySplit, backupMetaData *backup.WalletBackupMetaData) error
- func CombineShamirShares(field *backup.Field, shamirShares []backup.ShamirShare) ([]byte, error)
- func JoinKeyShares(field *backup.Field, splits []*backup.KeySplit, threshold uint64) ([]byte, error)
- func JoinSecret(field *backup.Field, parts ...[]byte) ([]byte, error)
- func RecoverWallet(keyShares []*backup.KeySplit, backupMetaData *backup.WalletBackupMetaData) (*wallets.Wallet, error)
- func SplitAndEncrypt(field *backup.Field, secret []byte, encryptionPubKeys []*ecdsa.PublicKey, ...) (*backup.EncryptedShares, error)
- func SplitSecret(field *backup.Field, secret []byte, n int) ([][]byte, error)
- func SplitToShamirShares(field *backup.Field, val []byte, numShares uint64, threshold uint64) ([]backup.ShamirShare, error)
Constants ¶
const DataProvidersThreshold = uint64(666)
const NormalizationConstant = 1000
Variables ¶
This section is empty.
Functions ¶
func BackupWallet ¶
func BackupWallet(wallet *wallets.Wallet, providerPubKeys []*ecdsa.PublicKey, signingPolicyWeights []uint16, rewardEpochID uint32, teeID common.Address, chainID uint64, normalizationParam uint16, dataProviderThreshold uint64) (*backup.WalletBackup, error)
BackupWallet packages the wallet state and encrypted key shares for admins and providers so it can be reconstructed later. The result is signed with the key that is split, but remains to be signed by the TEE.
func CheckKeyShares ¶
func CheckKeyShares(splits []*backup.KeySplit, backupMetaData *backup.WalletBackupMetaData) error
CheckKeyShares validates that the provided key shares belong to the expected wallet backup metadata and originate from authorized parties.
func CombineShamirShares ¶
CombineShamirShares joins shares assuming that the threshold is at exactly the length of the input. The share values are secret and are combined with constant-time arithmetic; the evaluation indices are public, so the Lagrange denominators are inverted in variable time.
func JoinKeyShares ¶
func JoinKeyShares(field *backup.Field, splits []*backup.KeySplit, threshold uint64) ([]byte, error)
JoinKeyShares joins key shares in a private key. It assumes that all the splits have the same backup id and the signatures have been verified.
func JoinSecret ¶ added in v0.0.26
JoinSecret recombines additive parts into the secret they were split from, returned in the field's fixed-width encoding.
func RecoverWallet ¶
func RecoverWallet( keyShares []*backup.KeySplit, backupMetaData *backup.WalletBackupMetaData, ) (*wallets.Wallet, error)
RecoverWallet rebuilds a wallet from key shares and backup metadata.
func SplitAndEncrypt ¶
func SplitAndEncrypt( field *backup.Field, secret []byte, encryptionPubKeys []*ecdsa.PublicKey, threshold uint64, weights []uint16, backupID wallets.WalletBackupID, signer wallets.Signer, isAdmin bool, chainID uint64, ) (*backup.EncryptedShares, error)
SplitAndEncrypt shards the provided secret over the given field, encrypts each share for its owner, and returns the encoded share bundle.
func SplitSecret ¶ added in v0.0.26
SplitSecret splits a secret into n additive parts over the field, such that the parts sum to the secret. Each part is returned in the field's fixed-width encoding. The secret must be smaller than the field modulus.
Every part is uniformly distributed, so any proper subset reveals nothing about the secret.
func SplitToShamirShares ¶
func SplitToShamirShares(field *backup.Field, val []byte, numShares uint64, threshold uint64) ([]backup.ShamirShare, error)
SplitToShamirShares generates Shamir secret shares for the provided value over the given field. The value must be smaller than the field modulus, which is what makes sharing injective; callers select the field from the key's metadata so this holds by construction.
Polynomial evaluation uses constant-time modular arithmetic, so neither the secret nor the sampled coefficients influence execution time.
Types ¶
This section is empty.