bittensor_wallet.keyfile

Contents

bittensor_wallet.keyfile#

ask_password(validation_required)

Prompts the user to enter a password for key encryption.

decrypt_keyfile_data(keyfile_data[, ...])

Decrypts the passed keyfile data using ansible vault.

deserialize_keypair_from_keyfile_data(...)

Deserializes Keypair object from passed keyfile data.

encrypt_keyfile_data(keyfile_data[, password])

Encrypts the passed keyfile data using ansible vault.

get_coldkey_password_from_environment(...)

get_password_from_environment(env_var_name)

Retrieves the cold key password from the environment variables.

keyfile_data_encryption_method(keyfile_data)

Returns type of encryption method as a string.

keyfile_data_is_encrypted(keyfile_data)

Returns true if the keyfile data is encrypted.

keyfile_data_is_encrypted_ansible(keyfile_data)

Returns true if the keyfile data is ansible encrypted.

keyfile_data_is_encrypted_legacy(keyfile_data)

Returns true if the keyfile data is legacy encrypted.

keyfile_data_is_encrypted_nacl(keyfile_data)

Returns true if the keyfile data is NaCl encrypted.

legacy_encrypt_keyfile_data(keyfile_data[, ...])

legacy_encrypt_keyfile_data.

serialized_keypair_to_keyfile_data(keypair)

Serializes keypair object into keyfile data.

validate_password(password)

Validates the password against a password policy.

Keyfile([path, name, should_save_to_env])

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 True if 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 True if the file under path is encrypted.

is_readable()

Returns True if the file under path is readable.

is_writable()

Returns True if 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 True if 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 True if the file under path is encrypted.

is_readable()

Returns True if the file under path is readable.

is_writable()

Returns True if 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 True if 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 True if the file under path is encrypted.

is_readable()

Returns True if the file under path is readable.

is_writable()

Returns True if 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.