Documentation ¶
Index ¶
- Constants
- func BLSWithdrawalCredentialsHash(withdrawalPubKey []byte) []byte
- func ConvertPemToPrivateKey(skPem string) (*rsa.PrivateKey, error)
- func DepositData(masterSig, withdrawalPubKey, publicKey []byte, network e2m_core.Network, ...) (*phase0.DepositData, [32]byte, error)
- func DepositDataRoot(withdrawalPubKey []byte, publicKey *bls.PublicKey, network e2m_core.Network, ...) ([]byte, error)
- func ETH1WithdrawalCredentialsHash(withdrawalAddr []byte) []byte
- func EncodePublicKey(pk *rsa.PublicKey) ([]byte, error)
- func Encrypt(pk *rsa.PublicKey, plainText []byte) ([]byte, error)
- func EncryptPrivateKey(priv []byte, keyStorePassword string) ([]byte, error)
- func EncryptedPrivateKey(path, pass string) (*rsa.PrivateKey, error)
- func GenerateKeys() (*rsa.PrivateKey, *rsa.PublicKey, error)
- func GenerateSecurePassword() (string, error)
- func GetPubCommitsFromSharesData(reshare *wire.Reshare) ([]kyber.Point, error)
- func GetSecretShareFromSharesData(keyshares, initiatorPublicKey, ceremonySigs []byte, ...) (*share.PriShare, error)
- func KyberShareToBLSKey(privShare *share.PriShare) (*bls.SecretKey, error)
- func NewID() [24]byte
- func ParseRSAPubkey(pk []byte) (*rsa.PublicKey, error)
- func ReadEncryptedPrivateKey(keyData []byte, password string) (*rsa.PrivateKey, error)
- func ReadEncryptedRSAKey(privKeyPath, privKeyPassPath string) (*rsa.PrivateKey, error)
- func ReconstructSignatures(ids []uint64, signatures [][]byte) (*bls.Sign, error)
- func RecoverMasterSig(ids []uint64, sigDepositShares []*bls.Sign) (*bls.Sign, error)
- func RecoverValidatorPublicKey(ids []uint64, sharePks []*bls.PublicKey) (*bls.PublicKey, error)
- func ResultToShareSecretKey(result *drand_dkg.DistKeyShare) (*bls.SecretKey, error)
- func ResultToValidatorPK(result *drand_dkg.DistKeyShare, suite drand_dkg.Suite) (*bls.PublicKey, error)
- func SignDepositData(validationKey *bls.SecretKey, withdrawalPubKey []byte, ...) (*bls.Sign, []byte, error)
- func SignRSA(sk *rsa.PrivateKey, byts []byte) ([]byte, error)
- func VerifyDepositData(depositData *phase0.DepositData, network e2m_core.Network) (bool, error)
- func VerifyOwnerNonceSignature(sig []byte, owner common.Address, pubKey []byte, nonce uint16) error
- func VerifyPartialSigs(sigShares []*bls.Sign, sharePks []*bls.PublicKey, data []byte) error
- func VerifyRSA(pk *rsa.PublicKey, msg, signature []byte) error
- func VerifyReconstructedSignature(sig *bls.Sign, validatorPubKey, msg []byte) error
Constants ¶
const ( // b64 encrypted key length is 256 EncryptedKeyLength = 256 // Signature len SignatureLength = 256 // BLSWithdrawalPrefixByte is the BLS withdrawal prefix BLSWithdrawalPrefixByte = byte(0) ETH1WithdrawalPrefixByte = byte(1) )
Variables ¶
This section is empty.
Functions ¶
func BLSWithdrawalCredentialsHash ¶
withdrawalCredentialsHash forms a 32 byte hash of the withdrawal public address.
The specification is as follows:
withdrawal_credentials[:1] == BLS_WITHDRAWAL_PREFIX_BYTE withdrawal_credentials[1:] == hash(withdrawal_pubkey)[1:]
where withdrawal_credentials is of type bytes32.
func ConvertPemToPrivateKey ¶
func ConvertPemToPrivateKey(skPem string) (*rsa.PrivateKey, error)
ConvertPemToPrivateKey return rsa private key from secret key
func DepositData ¶
func DepositData(masterSig, withdrawalPubKey, publicKey []byte, network e2m_core.Network, amount phase0.Gwei) (*phase0.DepositData, [32]byte, error)
DepositData crates and signs a ETH2 deposit message
func DepositDataRoot ¶
func DepositDataRoot(withdrawalPubKey []byte, publicKey *bls.PublicKey, network e2m_core.Network, amount phase0.Gwei) ([]byte, error)
DepositDataRoot computes a deposit root used for ETH2 deposit message
func EncryptPrivateKey ¶ added in v1.1.0
func EncryptedPrivateKey ¶
func EncryptedPrivateKey(path, pass string) (*rsa.PrivateKey, error)
EncryptedPrivateKey reads an encoded RSA priv key from path encrypted with password
func GenerateKeys ¶
func GenerateKeys() (*rsa.PrivateKey, *rsa.PublicKey, error)
GenerateKeys creates a random RSA key pair
func GenerateSecurePassword ¶
GenerateSecurePassword randomly generates a password consisting of digits + english letters
func GetPubCommitsFromSharesData ¶ added in v1.2.0
func GetSecretShareFromSharesData ¶ added in v1.2.0
func KyberShareToBLSKey ¶ added in v1.0.0
KyberShareToBLSKey converts a kyber private share to github.com/herumi/bls-eth-go-binary/bls private key
func ParseRSAPubkey ¶
ParseRSAPubkey parses encoded to base64 x509 RSA public key
func ReadEncryptedPrivateKey ¶ added in v1.1.0
func ReadEncryptedPrivateKey(keyData []byte, password string) (*rsa.PrivateKey, error)
ReadEncryptedPrivateKey return rsa private key from secret key
func ReadEncryptedRSAKey ¶ added in v1.1.0
func ReadEncryptedRSAKey(privKeyPath, privKeyPassPath string) (*rsa.PrivateKey, error)
func ReconstructSignatures ¶ added in v1.0.0
ReconstructSignatures receives a map of user indexes and serialized bls.Sign. It then reconstructs the original threshold signature using lagrange interpolation
func RecoverMasterSig ¶
RecoverMasterSig recovers a BLS master signature from T-threshold partial signatures
func RecoverValidatorPublicKey ¶
RecoverValidatorPublicKey recovers a BLS master public key (validator pub key) from provided partial pub keys
func ResultToShareSecretKey ¶
func ResultToShareSecretKey(result *drand_dkg.DistKeyShare) (*bls.SecretKey, error)
ResultToShareSecretKey converts a private share at kyber DKG result to github.com/herumi/bls-eth-go-binary/bls private key
func ResultToValidatorPK ¶
func ResultToValidatorPK(result *drand_dkg.DistKeyShare, suite drand_dkg.Suite) (*bls.PublicKey, error)
ResultsToValidatorPK converts a public polynomial at kyber DKG result to github.com/herumi/bls-eth-go-binary/bls public key
func SignDepositData ¶
func SignDepositData(validationKey *bls.SecretKey, withdrawalPubKey []byte, validatorPublicKey *bls.PublicKey, network e2m_core.Network, amount phase0.Gwei) (*bls.Sign, []byte, error)
SignDepositData creates a BLS signature for ETH2 deposit message
func SignRSA ¶
func SignRSA(sk *rsa.PrivateKey, byts []byte) ([]byte, error)
SignRSA create a RSA signature for incoming bytes
func VerifyDepositData ¶
VerifyDepositData reconstructs and checks BLS signatures for ETH2 deposit message
func VerifyOwnerNonceSignature ¶ added in v1.1.0
VerifyOwnerNonceSignature check that owner + nonce correctly signed
func VerifyPartialSigs ¶
VerifyPartialSigs verifies provided partial BLS signatures
Types ¶
This section is empty.