ain.utils.v3keystore module
- class ain.utils.v3keystore.Cipherparams
Bases:
object
Class for the cipher params.
- iv: str
The initial vector of the cipher.
- class ain.utils.v3keystore.Crypto
Bases:
object
Class for the crypto.
- cipher: str
The name of the cipher.
- cipherparams: Cipherparams
The cipher params.
- ciphertext: str
The ciphertext.
- kdf: str
The name of the KDF(key derivation function). scrypt and pbkdf2 are supported.
- kdfparams: dict
The KDF params.
- mac: str
The MAC(message authentication code).
- class ain.utils.v3keystore.V3Keystore(version: int, id: str, address: str, ciphertext: str, iv: str, cipher: str, kdf: str, kdfparams: dict, mac: str)
Bases:
object
Class for the v3 keystore.
- classmethod fromJSON(v3KeystoreJSON: str)
Converts the stringified v3 keystore JSON into a v3 keystore object.
- Parameters:
v3KeystoreJSON (str) – The stringified v3 keystore JSON.
- classmethod fromPrivateKey(privateKey: bytes | str, password: str, options: ~ain.utils.v3keystore.V3KeystoreOptions = <ain.utils.v3keystore.V3KeystoreOptions object>)
Converts an account into a v3 Keystore and encrypts it with a password.
- Parameters:
privateKey (Union[bytes, str]) – The private key of an AIN blockchain account.
password (str) – The password of the v3 keystore.
options (V3KeystoreOptions) – The options for the v3 keystore. Defaults to no options.
- toPrivateKey(password: str) bytes
Returns a private key from a v3 Keystore.
- address: str
The AIN blockchain address of the keystore.
- id: str
The UUID of the keystore.
- version: int
The version of the keystore.
- class ain.utils.v3keystore.V3KeystoreOptions(cipher: str = None, iv: bytes = None, kdf: str = None, salt: bytes = None, dklen: int = None, n: int = None, r: int = None, p: int = None, c: int = None, uuid: bytes = None)
Bases:
object
Class for the v3 keystore options.
- c: int | None
The c option for the KDF pbkdf2
- cipher: str | None
The name of the cipher.
- dklen: int | None
The length of the desired key for KDF.
- iv: bytes | None
The initial vector of the cipher.
- kdf: str | None
The name of the KDF(key derivation function). scrypt and pbkdf2 are supported.
- n: int | None
The n option for the KDF scrypt
- p: int | None
The p option for the KDF scrypt
- r: int | None
The r option for the KDF scrypt
- salt: bytes | None
The salt for the KDF.
- uuid: bytes | None
The predetermined bytes of the UUID.