aries_cloudagent.ledger.merkel_validation package
Submodules
aries_cloudagent.ledger.merkel_validation.constants module
Constants for State Proof and LeafHash Inclusion Verification.
aries_cloudagent.ledger.merkel_validation.domain_txn_handler module
Utilities for Processing Replies to Domain Read Requests.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.decode_state_value(encoded_value)[source]
Return val, lsn, lut from encoded state value.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.encode_state_value(value, seqNo, txnTime)[source]
Return encoded state value.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.extract_params_write_request(data)[source]
Return tree_size, leaf_index, audit_path, expected_root_hash from reply.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.get_proof_nodes(reply)[source]
Return proof_nodes from reply.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.hash_of(text) str [source]
Return 256 bit hexadecimal digest of text.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.make_state_path_for_attr(did, attr_name, attr_is_hash=False) bytes [source]
Return state_path for ATTR.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.make_state_path_for_claim_def(authors_did, schema_seq_no, signature_type, tag)[source]
Return state_path for CLAIM DEF.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.make_state_path_for_nym(did) bytes [source]
Return state_path for NYM.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.make_state_path_for_revoc_def(authors_did, cred_def_id, revoc_def_type, revoc_def_tag) bytes [source]
Return state_path for REVOC_DEF.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.make_state_path_for_revoc_reg_entry(revoc_reg_def_id) bytes [source]
Return state_path for REVOC_REG_ENTRY.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.make_state_path_for_revoc_reg_entry_accum(revoc_reg_def_id) bytes [source]
Return state_path for REVOC_REG_ENTRY_ACCUM.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.make_state_path_for_schema(authors_did, schema_name, schema_version) bytes [source]
Return state_path for SCHEMA.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.parse_attr_txn(txn_data)[source]
Process txn_data and parse attr_txn based on attr_type.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_attr_for_state(txn, path_only=False)[source]
Return key, value pair for state from ATTR.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_claim_def_for_state(txn, path_only=False)[source]
Return key-value pair for state from CLAIM_DEF.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_for_state_read(reply)[source]
Return state value from read requests reply.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_for_state_write(reply)[source]
Return state key, value pair from write requests reply.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_get_attr_for_state(reply)[source]
Return value for state from GET_ATTR.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_get_claim_def_for_state(reply)[source]
Return value for state from GET_CLAIM_DEF.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_get_nym_for_state(reply)[source]
Return value for state from GET_NYM.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_get_revoc_def_for_state(reply)[source]
Return value for state from GET_REVOC_DEF.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_get_revoc_reg_delta_for_state(reply)[source]
Return value for state from GET_REVOC_REG_DELTA.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_get_revoc_reg_entry_accum_for_state(reply)[source]
Return value for state from GET_REVOC_REG_ENTRY_ACCUM.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_get_revoc_reg_entry_for_state(reply)[source]
Return value for state from GET_REVOC_REG_ENTRY.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_get_schema_for_state(reply)[source]
Return value for state from GET_SCHEMA.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_nym_for_state(txn)[source]
Return encoded state path from NYM.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_revoc_def_for_state(txn, path_only=False)[source]
Return key-value pair for state from REVOC_DEF.
- aries_cloudagent.ledger.merkel_validation.domain_txn_handler.prepare_revoc_reg_entry_accum_for_state(txn)[source]
Return key-value pair for state from REVOC_REG_ENTRY_ACCUM.
aries_cloudagent.ledger.merkel_validation.hasher module
Merkle tree hasher for leaf and children nodes.
- class aries_cloudagent.ledger.merkel_validation.hasher.HexTreeHasher(hashfunc=<built-in function openssl_sha256>)[source]
Bases:
TreeHasher
Merkle tree hasher for hex data.
aries_cloudagent.ledger.merkel_validation.merkel_verifier module
Verify Leaf Inclusion.
- class aries_cloudagent.ledger.merkel_validation.merkel_verifier.MerkleVerifier(hasher=<aries_cloudagent.ledger.merkel_validation.hasher.TreeHasher object>)[source]
Bases:
object
Utility class for verifying leaf inclusion.
- async calculate_root_hash(leaf, leaf_index, audit_path, tree_size)[source]
Calculate root hash, used to verify Merkel AuditPath.
Reference: section 2.1.1 of RFC6962.
- Parameters
leaf – Leaf data.
leaf_index – Index of the leaf in the tree.
audit_path – A list of SHA-256 hashes representing the Merkle audit
path. –
tree_size – tree size
aries_cloudagent.ledger.merkel_validation.trie module
Validates State Proof.
- class aries_cloudagent.ledger.merkel_validation.trie.SubTrie(root_hash=None)[source]
Bases:
object
Utility class for SubTrie and State Proof validation.
- async static get_new_trie_with_proof_nodes(proof_nodes)[source]
Return SubTrie created from proof_nodes.
- property root_hash
Return 32 bytes string.
aries_cloudagent.ledger.merkel_validation.utils module
Merkel Validation Utils.
- aries_cloudagent.ledger.merkel_validation.utils.audit_path_length(index: int, tree_size: int)[source]
Return AuditPath length.
- Parameters
index – Leaf index
tree_size – Tree size
- aries_cloudagent.ledger.merkel_validation.utils.bin_to_nibbles(s)[source]
Convert string s to nibbles (half-bytes).