Documentation
¶
Index ¶
- Variables
- func DetermineCurveType(curveStr string) string
- func GenerateRandomPassword(length int) (string, error)
- func GetSigningSchemeForCurveType(curveType string) (signing.SigningScheme, error)
- func SaveToKeystoreWithCurveType(privateKey signing.PrivateKey, filePath, password, curveType string, ...) error
- func TestKeystore(filePath, password string, scheme signing.SigningScheme) error
- type LegacyKeystore
- type Options
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidKeystoreFile = errors.New("invalid keystore file")
Functions ¶
func DetermineCurveType ¶
DetermineCurveType attempts to determine the curve type based on the private key This is a best-effort function that uses the curveStr path in the keygen operation
func GenerateRandomPassword ¶
GenerateRandomPassword generates a cryptographically secure random password
func GetSigningSchemeForCurveType ¶
func GetSigningSchemeForCurveType(curveType string) (signing.SigningScheme, error)
GetSigningSchemeForCurveType returns the appropriate signing scheme based on curve type
func SaveToKeystoreWithCurveType ¶
func SaveToKeystoreWithCurveType(privateKey signing.PrivateKey, filePath, password, curveType string, opts *Options) error
SaveToKeystoreWithCurveType saves a private key to a keystore file using the Web3 Secret Storage format and includes the curve type in the keystore file
func TestKeystore ¶
func TestKeystore(filePath, password string, scheme signing.SigningScheme) error
TestKeystore tests a keystore by signing a test message
Types ¶
type LegacyKeystore ¶
type LegacyKeystore struct {
PublicKey string `json:"publicKey"`
Crypto keystore.CryptoJSON `json:"crypto"`
UUID string `json:"uuid"`
Version int `json:"version"`
CurveType string `json:"curveType"` // Either "bls381" or "bn254"
}
LegacyKeystore represents a private key encrypted using keystore V4 format
func LoadKeystoreFile ¶
func LoadKeystoreFile(filePath string) (*LegacyKeystore, error)
LoadKeystoreFile loads a keystore from a file and returns the parsed LegacyKeystore struct
func ParseKeystoreJSON ¶
func ParseKeystoreJSON(keystoreJSON string) (*LegacyKeystore, error)
ParseKeystoreJSON takes a string representation of the keystore JSON and returns the LegacyKeystore struct
func (*LegacyKeystore) GetBN254PrivateKey ¶
func (k *LegacyKeystore) GetBN254PrivateKey(password string) (*bn254.PrivateKey, error)
func (*LegacyKeystore) GetPrivateKey ¶
func (k *LegacyKeystore) GetPrivateKey(password string, scheme signing.SigningScheme) (signing.PrivateKey, error)
GetPrivateKey decrypts and returns the private key from the keystore