Documentation ¶
Index ¶
- Constants
- func BLSWithdrawalCredentialsHash(withdrawalPubKey []byte) []byte
- func ConvertEncryptedPemToPrivateKey(pemData []byte, password string) (*rsa.PrivateKey, error)
- 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 EncryptedPrivateKey(path, pass string) (*rsa.PrivateKey, error)
- func ExtractPrivateKey(sk *rsa.PrivateKey) string
- func GenerateKeys() (*rsa.PrivateKey, *rsa.PublicKey, error)
- func GenerateSecurePassword() (string, error)
- func KyberShareToBLSKey(privShare *share.PriShare) (*bls.SecretKey, error)
- func NewID() [24]byte
- func ParseRSAPubkey(pk []byte) (*rsa.PublicKey, error)
- func PrivateKey(path string) (*rsa.PrivateKey, error)
- func ReconstructSignatures(signatures map[uint64][]byte) (*bls.Sign, error)
- func RecoverMasterSig(sigDepositShares map[uint64]*bls.Sign) (*bls.Sign, error)
- func RecoverValidatorPublicKey(sharePks map[uint64]*bls.PublicKey) (*bls.PublicKey, error)
- func ResultToShareSecretKey(result *drand_dkg.Result) (*bls.SecretKey, error)
- func ResultToValidatorPK(result *drand_dkg.Result, 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 VerifyOwnerNoceSignature(sig []byte, owner common.Address, pubKey []byte, nonce uint16) error
- func VerifyPartialSigs(sigShares map[uint64]*bls.Sign, sharePks map[uint64]*bls.PublicKey, ...) 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 // 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 ConvertEncryptedPemToPrivateKey ¶
func ConvertEncryptedPemToPrivateKey(pemData []byte, password string) (*rsa.PrivateKey, error)
ConvertEncryptedPemToPrivateKey return rsa private key from secret key
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 EncryptedPrivateKey ¶
func EncryptedPrivateKey(path, pass string) (*rsa.PrivateKey, error)
EncryptedPrivateKey reads an encoded RSA priv key from path encrypted with password
func ExtractPrivateKey ¶
func ExtractPrivateKey(sk *rsa.PrivateKey) string
ExtractPrivateKey gets private key and returns base64 encoded private key
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 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 PrivateKey ¶
func PrivateKey(path string) (*rsa.PrivateKey, error)
PrivateKey reads an encoded RSA priv key from path
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 ¶
ResultToShareSecretKey converts a private share at kyber DKG result to github.com/herumi/bls-eth-go-binary/bls private key
func ResultToValidatorPK ¶
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 VerifyPartialSigs ¶
func VerifyPartialSigs(sigShares map[uint64]*bls.Sign, sharePks map[uint64]*bls.PublicKey, data []byte) error
VerifyPartialSigs verifies provided partial BLS signatures
Types ¶
This section is empty.