async def fetch_credential_definition( self, credential_definition_id: str) -> dict: """ Get a credential definition from the ledger by id. Args: credential_definition_id: The cred def id of the cred def to fetch """ public_info = await self.get_wallet_public_did() public_did = public_info.did if public_info else None try: cred_def_req = ledger.build_get_cred_def_request( public_did, credential_definition_id) except VdrError as err: raise LedgerError( "Exception when building get-cred-def request") from err response = await self._submit(cred_def_req, sign_did=public_info) if not response["data"]: return None schema_id = str(response["ref"]) signature_type = response["signature_type"] tag = response.get("tag", "default") origin_did = response["origin"] # FIXME: issuer has a method to create a cred def ID # may need to qualify the DID cred_def_id = f"{origin_did}:3:{signature_type}:{schema_id}:{tag}" return { "ver": "1.0", "id": cred_def_id, "schemaId": schema_id, "type": signature_type, "tag": tag, "value": response["data"], }
async def get_cred_by_Id(pool: Pool, credId): req = build_get_cred_def_request(None, credId) return await pool.submit_request(req)
async def get_cred_by_Id(credId): req = build_get_cred_def_request(None, credId) return req.body
async def basic_test(transactions_path): pool = await open_pool(transactions_path=transactions_path) log(f"Created pool: {pool}") test_req = { "operation": { "data": 1, "ledgerId": 1, "type": "3" }, "protocolVersion": 2, "reqId": 123, "identifier": "LibindyDid111111111111" } req = build_custom_request(test_req) log("Custom request body:", req.body) # sig_in = req.signature_input log("Custom request signature input:", sig_in) req = build_get_txn_author_agreement_request() log(await pool.submit_request(req)) req = build_get_acceptance_mechanisms_request() log(await pool.submit_request(req)) acceptance = prepare_txn_author_agreement_acceptance("acceptance text", "1.1.1", None, mechanism="manual") req = build_get_txn_request(None, 1, 15) req.set_txn_author_agreement_acceptance(acceptance) req.set_endorser("V4SGRU86Z58d6TV7PBUe6f") log("Request with TAA acceptance and endorser:", req.body) # req = build_disable_all_txn_author_agreements_request("V4SGRU86Z58d6TV7PBUe6f") # log(await pool.submit_request(req)) txn = await get_txn(pool, 11) log(json.dumps(txn, indent=2)) req = build_get_schema_request( None, "6qnvgJtqwK44D8LFYnV5Yf:2:relationship.dflow:1.0.0") log("Get schema request:", req.body) req = build_get_cred_def_request(None, "A9Rsuu7FNquw8Ne2Smu5Nr:3:CL:15:tag") log("Get cred def request:", req.body) revoc_id = ("L5wx9FUxCDpFJEdFc23jcn:4:L5wx9FUxCDpFJEdFc23jcn:3:CL:1954:" "default:CL_ACCUM:c024e30d-f3eb-42c5-908a-ff885667588d") req = build_get_revoc_reg_def_request(None, revoc_id) log("Get revoc reg def request:", req.body) req = build_get_revoc_reg_request(None, revoc_id, timestamp=1) log("Get revoc reg request:", req.body) req = build_get_revoc_reg_delta_request(None, revoc_id, from_ts=None, to_ts=1) log("Get revoc reg delta request:", req.body)