client.updater module

class factom_did.client.updater.DIDUpdater(did)

Bases: object

Facilitates the creation of an update entry for an existing DID.

Provides support for adding and revoking management keys, DID keys and services.

did

The DID object to update

Type:client.did.DID
add_did_key(alias, purpose, key_type=<KeyType.EdDSA: 'Ed25519VerificationKey'>, controller=None, priority_requirement=None)

Adds a DID key to the DID object.

Parameters:
  • alias (str) –
  • purpose (did.enums.DIDKeyPurpose) –
  • key_type (KeyType, optional) –
  • controller (str, optional) –
  • priority_requirement (int, optional) –
add_management_key(alias, priority, key_type=<KeyType.EdDSA: 'Ed25519VerificationKey'>, controller=None, priority_requirement=None)

Adds a management key to the DID object.

Parameters:
  • alias (str) –
  • priority (int) –
  • key_type (KeyType, optional) –
  • controller (str, optional) –
  • priority_requirement (int, optional) –
add_service(alias, service_type, endpoint, priority_requirement=None)

Adds a service to the DID object.

Parameters:
  • alias (str) –
  • service_type (str) –
  • endpoint (str) –
  • priority_requirement (int, optional) –
static exists_management_key_with_priority_zero(active_management_keys, new_management_keys, management_keys_to_revoke)

Checks if a management key of priority zero would be present if the management keys will be updated according to the given parameters.

Parameters:
  • active_management_keys (set) – The currently active management keys
  • new_management_keys (set) – The management keys to be added
  • management_keys_to_revoke (set) – The management keys to be revoked
Returns:

Return type:

bool

export_entry_data()

Constructs a signed DIDUpdate entry ready for recording on-chain.

Returns:A dictionary with ExtIDs and content for the entry
Return type:dict
Raises:RuntimeError – If a management key of sufficient priority is not available to sign the update.
get_updated()
record_on_chain(factomd, walletd, ec_address, verbose=False)

Attempts to record the DIDUpdate entry on-chain.

Parameters:
  • factomd (obj) – Factomd instance, instantiated from the Python factom-api package.
  • walletd (obj) – Factom walletd instance, instantiated from the Python factom-api package.
  • ec_address (str) – EC address used to pay for the chain & entry creation.
  • verbose (bool, optional) – If true, display the contents of the entry that will be recorded on-chain.
Raises:

RuntimeError – If the entry cannot be recorded

revoke_did_key(alias)

Revokes a DID key from the DID object.

Parameters:alias (str) – The alias of the key to be revoked
revoke_did_key_purpose(alias, purpose)

Revokes a single purpose of a DID key from DID object.

Parameters:
  • alias (str) – The alias of the DID key
  • purpose (DIDKeyPurpose) – The purpose to revoke
revoke_management_key(alias)

Revokes a management key from the DID object.

Parameters:alias (str) – The alias of the key to be revoked
revoke_service(alias)

Revokes a service from the DID object.

Parameters:alias (str) – The alias of the service to be revoked
rotate_did_key(alias)

Rotates a DID key.

Parameters:alias (str) – The alias of the DID key to be rotated
rotate_management_key(alias)

Rotates a management key.

Parameters:alias (str) – The alias of the management key to be rotated