bittensor_wallet.keyfile#
|
Prompts the user to enter a password for key encryption. |
|
Decrypts the passed keyfile data using ansible vault. |
|
Deserializes Keypair object from passed keyfile data. |
|
Encrypts the passed keyfile data using ansible vault. |
|
|
|
Retrieves the cold key password from the environment variables. |
|
Returns type of encryption method as a string. |
|
Returns true if the keyfile data is encrypted. |
|
Returns true if the keyfile data is ansible encrypted. |
|
Returns true if the keyfile data is legacy encrypted. |
|
Returns true if the keyfile data is NaCl encrypted. |
|
legacy_encrypt_keyfile_data. |
|
Serializes keypair object into keyfile data. |
|
Validates the password against a password policy. |
|
Module Contents#
Functions Details
- class bittensor_wallet.keyfile.Keyfile(path=None, name=None, should_save_to_env=False)
Bases:
object- check_and_update_encryption(print_result=True, no_prompt=False)
Check the version of keyfile and update if needed.
- data
Returns the keyfile data under path.
- decrypt(password=None)
Decrypts the file under the path.
- encrypt(password=None)
Encrypts the file under the path.
- env_var_name()
Returns local environment variable key name based on Keyfile path.
- exists_on_device()
Returns
Trueif the file exists on the device.
- get_keypair(password=None)
Returns the keypair from path, decrypts data if the file is encrypted.
- is_encrypted()
Returns
Trueif the file under path is encrypted.
- is_readable()
Returns
Trueif the file under path is readable.
- is_writable()
Returns
Trueif the file under path is writable.
- keypair
Returns the keypair from path, decrypts data if the file is encrypted.
- make_dirs()
Creates directories for the path if they do not exist.
- path
- remove_password_from_env()
Removes the password associated with the Keyfile from the local environment.
- save_password_to_env(password=None)
Saves the key’s password to the associated local environment variable.
- set_keypair(keypair, encrypt=True, overwrite=False, password=None)
Writes the keypair to the file and optionally encrypts data.
- bittensor_wallet.keyfile.ask_password(validation_required)
Prompts the user to enter a password for key encryption.
- bittensor_wallet.keyfile.decrypt_keyfile_data(keyfile_data, password=None, password_env_var=None)
Decrypts the passed keyfile data using ansible vault.
- bittensor_wallet.keyfile.deserialize_keypair_from_keyfile_data(keyfile_data)
Deserializes Keypair object from passed keyfile data.
- bittensor_wallet.keyfile.encrypt_keyfile_data(keyfile_data, password=None)
Encrypts the passed keyfile data using ansible vault.
- bittensor_wallet.keyfile.get_coldkey_password_from_environment(env_var_name)
- bittensor_wallet.keyfile.get_password_from_environment(env_var_name)
Retrieves the cold key password from the environment variables.
- bittensor_wallet.keyfile.keyfile_data_encryption_method(keyfile_data)
Returns type of encryption method as a string.
- bittensor_wallet.keyfile.keyfile_data_is_encrypted(keyfile_data)
Returns true if the keyfile data is encrypted.
- bittensor_wallet.keyfile.keyfile_data_is_encrypted_ansible(keyfile_data)
Returns true if the keyfile data is ansible encrypted.
- bittensor_wallet.keyfile.keyfile_data_is_encrypted_legacy(keyfile_data)
Returns true if the keyfile data is legacy encrypted.
- bittensor_wallet.keyfile.keyfile_data_is_encrypted_nacl(keyfile_data)
Returns true if the keyfile data is NaCl encrypted.
- bittensor_wallet.keyfile.legacy_encrypt_keyfile_data(keyfile_data, password=None)
legacy_encrypt_keyfile_data.
- bittensor_wallet.keyfile.serialized_keypair_to_keyfile_data(keypair)
Serializes keypair object into keyfile data.
- bittensor_wallet.keyfile.validate_password(password)
Validates the password against a password policy.
Classes Details
- class bittensor_wallet.keyfile.Keyfile(path=None, name=None, should_save_to_env=False)
Bases:
object- check_and_update_encryption(print_result=True, no_prompt=False)
Check the version of keyfile and update if needed.
- decrypt(password=None)
Decrypts the file under the path.
- encrypt(password=None)
Encrypts the file under the path.
- env_var_name()
Returns local environment variable key name based on Keyfile path.
- exists_on_device()
Returns
Trueif the file exists on the device.
- get_keypair(password=None)
Returns the keypair from path, decrypts data if the file is encrypted.
- is_encrypted()
Returns
Trueif the file under path is encrypted.
- is_readable()
Returns
Trueif the file under path is readable.
- is_writable()
Returns
Trueif the file under path is writable.
- make_dirs()
Creates directories for the path if they do not exist.
- set_keypair(keypair, encrypt=True, overwrite=False, password=None)
Writes the keypair to the file and optionally encrypts data.
- data
Returns the keyfile data under path.
- check_and_update_encryption(print_result=True, no_prompt=False)
Check the version of keyfile and update if needed.
- data
Returns the keyfile data under path.
- decrypt(password=None)
Decrypts the file under the path.
- encrypt(password=None)
Encrypts the file under the path.
- env_var_name()
Returns local environment variable key name based on Keyfile path.
- exists_on_device()
Returns
Trueif the file exists on the device.
- get_keypair(password=None)
Returns the keypair from path, decrypts data if the file is encrypted.
- is_encrypted()
Returns
Trueif the file under path is encrypted.
- is_readable()
Returns
Trueif the file under path is readable.
- is_writable()
Returns
Trueif the file under path is writable.
- keypair
Returns the keypair from path, decrypts data if the file is encrypted.
- make_dirs()
Creates directories for the path if they do not exist.
- path
- remove_password_from_env()
Removes the password associated with the Keyfile from the local environment.
- save_password_to_env(password=None)
Saves the key’s password to the associated local environment variable.
- set_keypair(keypair, encrypt=True, overwrite=False, password=None)
Writes the keypair to the file and optionally encrypts data.