Documentation
¶
Index ¶
- Constants
- Variables
- func BackupWallet(wallet *wallets.Wallet, providerPubKeys []*ecdsa.PublicKey, ...) (*backup.WalletBackup, error)
- func CheckKeyShares(splits []*backup.KeySplit, backupMetaData *backup.WalletBackupMetaData) error
- func CombineShamirShares(shamirShares []backup.ShamirShare) (*big.Int, error)
- func JoinKeyShares(splits []*backup.KeySplit, threshold uint64) (*ecdsa.PrivateKey, error)
- func JoinPrivateKeys(privateKeys ...*ecdsa.PrivateKey) (*ecdsa.PrivateKey, error)
- func RecoverWallet(keyShares []*backup.KeySplit, backupMetaData *backup.WalletBackupMetaData) (*wallets.Wallet, error)
- func SplitAndEncrypt(key *ecdsa.PrivateKey, encryptionPubKeys []*ecdsa.PublicKey, threshold uint64, ...) (*backup.EncryptedShares, error)
- func SplitPrivateKey(privateKey *ecdsa.PrivateKey, n int) ([]*ecdsa.PrivateKey, error)
- func SplitToShamirShares(val *big.Int, numShares uint64, threshold uint64) ([]backup.ShamirShare, error)
Constants ¶
const DataProvidersThreshold = uint64(666)
const NormalizationConstant = 1000
Variables ¶
var P = secp256k1.S256().N
var Zero = big.NewInt(0)
Functions ¶
func BackupWallet ¶
func BackupWallet(wallet *wallets.Wallet, providerPubKeys []*ecdsa.PublicKey, signingPolicyWeights []uint16, rewardEpochID uint32, teeID common.Address, 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 ¶
func CombineShamirShares(shamirShares []backup.ShamirShare) (*big.Int, error)
CombineShamirShares joins shares assuming that the threshold is at exactly the length of the input.
func JoinKeyShares ¶
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 JoinPrivateKeys ¶
func JoinPrivateKeys(privateKeys ...*ecdsa.PrivateKey) (*ecdsa.PrivateKey, error)
JoinPrivateKeys recombines additive key shares back into a single key.
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( key *ecdsa.PrivateKey, encryptionPubKeys []*ecdsa.PublicKey, threshold uint64, weights []uint16, backupID wallets.WalletBackupID, signer wallets.Signer, isAdmin bool, ) (*backup.EncryptedShares, error)
SplitAndEncrypt shards the provided private key, encrypts each share for its owner, and returns the encoded share bundle.
func SplitPrivateKey ¶
func SplitPrivateKey(privateKey *ecdsa.PrivateKey, n int) ([]*ecdsa.PrivateKey, error)
SplitPrivateKey splits the private key into n additive shares in the curve field.
func SplitToShamirShares ¶
func SplitToShamirShares(val *big.Int, numShares uint64, threshold uint64) ([]backup.ShamirShare, error)
SplitToShamirShares generates Shamir secret shares for the provided value.
Types ¶
This section is empty.