SDK Contents

Identities

Identities Client

class factom_sdk.client.identities_client.IdentitiesClient(base_url: str, app_id: str, app_key: str)

Bases: object

create(names: list, keys: list = None, callback_url: str = '', callback_stages: list = None)

Creates a new Identity chain.

Args:
names (list): The names array for your identity must be unique. keys (list, optional): An array of public key strings in base58 idpub format, ordered from the highest to the lowest priority. callback_url (str, optional): The URL where you would like to receive the callback from Connect. callback_stages (list, optional): The immutability stages you would like to be notified about. This list can include any or all of the three stages: replicated, factom, and anchored.
Returns:
Identity chain created object.
get(identity_chain_id: str)

Gets a summary of the identity chain’s current state.

Args:
identity_chain_id (str): The unique identifier for the identity chain being requested.
Returns:
Identity chain object.

Chains

Chains Client

class factom_sdk.client.chains_client.ChainsClient(base_url: str, app_id: str, app_key: str, automatic_signing: bool)

Bases: object

create(content: str, external_ids: list = None, signer_private_key: str = '', signer_chain_id: str = '', callback_url: str = '', callback_stages: list = None)

Creates a new chain

Args:
content (str): This is the data that will make up the first entry in your new chain. external_ids (list, optional): Tags that can be used to identify your chain. signer_private_key (str, optional): base58 string in Idsec format. This parameter is optional for creating an unsigned chain. signer_chain_id (str, optional): The chain id of the signer identity. This parameter is optional for creating an unsigned chain. callback_url (str, optional): The URL where you would like to receive the callback from Connect. callback_stages (list, optional): The immutability stages you would like to be notified about. This list can include any or all of the three stages: replicated, factom, and anchored.
Returns:
Chain created info object.
get(chain_id: str, signature_validation=None)

Gets information about a specific chain from Connect.

Args:
chain_id (str): The unique identifier created for each chain. signature_validation (bool | custom function)
Returns:
Chain object.
list(limit: int = -1, offset: int = -1, stages: list = None)

Gets all of the chains on Factom.

Args:
limit (int, optional): The number of items you would like to return back in each stage. offset (int, optional): The offset parameter allows you to select which item you would like to start from when a list is returned from Connect. stages (list, optional): The immutability stages you want to restrict results to. You can choose any from replicated, factom, and anchored.
Returns:
List chains object.
search(external_ids: factom_sdk.client.chains_client.ChainsClient.list, limit: int = -1, offset: int = -1)

Finds all of the chains with external_ids that match what you entered.

Args:
external_ids (list): A list of external IDs associated with the chains user would like to search by. limit (int, optional): The number of items you would like to return back in each stage. offset (int, optional): The offset parameter allows you to select which item you would like to start from when a list is returned from Connect.
Returns:
List chains object.

Entries

Entries Client

class factom_sdk.client.entries_client.EntriesClient(base_url: str, app_id: str, app_key: str, automatic_signing: bool)

Bases: object

create(chain_id: str, content: str, external_ids: list = None, signer_private_key: str = '', signer_chain_id: str = '', callback_url: str = '', callback_stages: list = None)

Creates a new entry for the selected chain.

Args:
chain_id (str): The chain identifier. content (str): This is the data that will be stored directly on the blockchain. external_ids (list, optional): Tags that can be used to identify your entry. signer_private_key (str, optional): base58 string in Idsec format. This parameter is optional for creating an unsigned entry. signer_chain_id (str, optional): The chain id of the signer identity. This parameter is optional for creating an unsigned entry. callback_url (str, optional): The URL where you would like to receive the callback from Connect. callback_stages (list, optional): The immutability stages you would like to be notified about. This list can include any or all of the three stages: replicated, factom, and anchored.
Returns:
Entry created object.
get(chain_id: str, entry_hash: str, signature_validation=None)

Gets information about a specific entry on Connect.

Args:
chain_id (str): The chain identifier. entry_hash (str): The SHA256 hash of the entry. signature_validation (bool | custom function)
Returns:
Entry object.
get_first(chain_id: str, signature_validation=None)

Retrieves the first entry that has been saved to this chain.

Args:
chain_id (str): The chain identifier. signature_validation (bool | custom function)
Returns:
Entry object.
get_last(chain_id: str, signature_validation=None)

Gets the last entry that has been saved to this chain.

Args:
chain_id (str): The chain identifier. signature_validation (bool | custom function)
Returns:
Entry object.
list(chain_id: str, limit: int = -1, offset: int = -1, stages: list = None)

Gets list of all entries contained on a specified chain.

Args:
chain_id (str): The chain identifier. limit (int, optional): The number of items you would like to return back in each stage. offset (int, optional): The offset parameter allows you to select which item you would like to start from when a list is returned from Connect. stages (list, optional): The immutability stages you want to restrict results to. You can choose any from replicated, factom, and anchored.
Returns:
List entry object.
search(chain_id: str, external_ids: factom_sdk.client.entries_client.EntriesClient.list, limit: int = -1, offset: int = -1)

Finds all of the entries with external_ids that match what you entered.

Args:
chain_id (str): The chain identifier. external_ids (list): A list of external IDs. limit (int, optional): The number of items you would like to return back in each stage. offset (int, optional): The offset parameter allows you to select which item you would like to start from when a list is returned from Connect.
Returns:
List entry object.

Utilities

Request Handler

class factom_sdk.request_handler.request_handler.RequestHandler(base_url: str, app_id: str, app_key: str)

Bases: object

get(endpoint: str = '', params: dict = None)
post(endpoint: str = '', data: dict = None)

Identity Key Utils

class factom_sdk.utils.identities.identities_key_util.IdentitiesKeyUtil(base_url: str, app_id: str, app_key: str)

Bases: object

get(identity_chain_id: str, key: str)

Gets information about a specific public key for a given Identity, including the heights at which the key was activated and retired if applicable.

Args:
identity_chain_id (str): The unique identifier for the Identity that the key belongs to. key (str): The public key string to get information, which must be in base58 idpub format.
Returns:
Identity key object.
list(identity_chain_id: str, limit: int = -1, offset: int = -1)

Returns all of the keys that were ever active for this Identity. Results are paginated.

Args:
identity_chain_id (str): The unique identifier of the identity chain whose keys are being requested. limit (int, optional): The maximum number of keys you would like to be returned. offset (int, optional): The key index (in number of keys from the first key) to start from in the list of all keys.
Returns:
List identity key object.
replace(identity_chain_id: str, old_public_key: str, signer_private_key: str, new_public_key: str = None, callback_url: str = '', callback_stages: factom_sdk.utils.identities.identities_key_util.IdentitiesKeyUtil.list = None)

Creates an entry in the Identity Chain for a key replacement.

Args:
identity_chain_id (str): The unique identifier of the identity chain being requested. old_public_key (str): base58 string in Idpub format. The public key to be retired and replaced. signer_private_key (str): base58 string in Idsec format. The private key to use to create the signature, which must be the same or higher priority than the public key to be replaced. new_public_key (str, optional): base58 string in Idpub format. The new public key to be activated and take its place. callback_url (str, optional): The URL you would like the callbacks to be sent to. callback_stages (list, optional): The immutability stages you’d like to be notified about. This list can include any or all of these three stages: replicated, factom, and anchored
Returns:
Replacement result object.

Common Utilities

class factom_sdk.utils.common_util.CommonUtil

Bases: object

static base64_encode(value)
static decode(name: str, data)
static decode_response(response: dict = None)

Key Utils

class factom_sdk.utils.key_common.KeyCommon

Bases: object

static create_key_pair()
static get_duplicate_keys(signer_keys: list)
static get_invalid_keys(signer_keys: list)
static get_key_bytes_from_key(signer_key: str)
static get_public_key_from_private_key(signer_private_key: str)
static sign_content(signer_private_key: str, message: str)
static validate_checksum(signer_key: str)
static validate_signature(signer_public_key: str, signature: str, message: str)

Utils

class factom_sdk.utils.utils.Utils

Bases: object

static generate_key_pair()

Creates a Public/Private Key Pair.

Returns:
A key pair object with Public and Private keys.
static to_military_timezone_str(dt)

Validate Signature

class factom_sdk.utils.validate_signature_util.ValidateSignatureUtil

Bases: object

static validate_signature(obj: dict, validate_for_chain: bool = True, request_handler=None)