def sdk_add_attribute_and_check(looper, sdk_pool_handle, sdk_wallet_handle, attrib, dest=None, xhash=None, enc=None): _, s_did = sdk_wallet_handle t_did = dest or s_did attrib_req = looper.loop.run_until_complete( build_attrib_request(s_did, t_did, xhash, attrib, enc)) return sdk_send_and_check_req_json(looper, sdk_pool_handle, sdk_wallet_handle, attrib_req)
def sdk_build_attrib(self, identifier=None, sdk_wallet=None): sdk_wallet = sdk_wallet or self._wallet_steward identifier = identifier or sdk_wallet[1] request = self._looper.loop.run_until_complete( build_attrib_request(identifier, identifier, None, json.dumps({'answer': 42}), None)) return request
def execute_attrib_txn(looper, sdk_pool_handle, sdk_wallet_steward, xhash, raw, enc): _, identifier = sdk_wallet_steward request = looper.loop.run_until_complete( build_attrib_request(identifier, identifier, xhash, raw, enc)) return sdk_get_reply( looper, sdk_sign_and_submit_req(sdk_pool_handle, sdk_wallet_steward, request))[1]
def sdk_add_attribute_and_check(looper, sdk_pool_handle, sdk_wallet_handle, attrib, dest=None): _, s_did = sdk_wallet_handle t_did = dest or s_did attrib_req = looper.loop.run_until_complete( build_attrib_request(s_did, t_did, None, attrib, None)) request_couple = sdk_sign_and_send_prepared_request(looper, sdk_wallet_handle, sdk_pool_handle, attrib_req) sdk_get_and_check_replies(looper, [request_couple]) return request_couple
def sdk_add_attribute_and_check(looper, sdk_pool_handle, sdk_wallet_handle, attrib, dest=None): _, s_did = sdk_wallet_handle t_did = dest or s_did attrib_req = looper.loop.run_until_complete( build_attrib_request(s_did, t_did, None, attrib, None)) request_couple = sdk_sign_and_send_prepared_request(looper, sdk_wallet_handle, sdk_pool_handle, attrib_req) sdk_get_and_check_replies(looper, [request_couple]) return request_couple
def req_json(looper, sdk_wallet_steward): sdk_set_protocol_version(looper) wallet_handle, identifier = sdk_wallet_steward raw = json.dumps({'answer': 42}) return looper.loop.run_until_complete( build_attrib_request(identifier, identifier, raw=raw, xhash=None, enc=None))
def attrib_on_ledger(looper, sdk_pool_handle, sdk_wallet_steward, sdk_client_wallet): attrib_req_future = build_attrib_request(sdk_wallet_steward[1], sdk_client_wallet[1], None, "{}", None) attrib_req = looper.loop.run_until_complete(attrib_req_future) attrib_resp_future = sign_and_submit_request(sdk_pool_handle, sdk_wallet_steward[0], sdk_wallet_steward[1], attrib_req) attrib_resp = looper.loop.run_until_complete(attrib_resp_future) attrib = json.loads(attrib_resp) print(attrib) assert attrib["result"] assert attrib["result"][TXN_METADATA] assert attrib["result"][TXN_METADATA][TXN_METADATA_SEQ_NO] return attrib["result"][TXN_METADATA][TXN_METADATA_SEQ_NO]
def add_attribute(looper, sdk_wallet_handle, attrib, dest=None, xhash=None, enc=None): _, s_did = sdk_wallet_handle t_did = dest or s_did attrib_req = looper.loop.run_until_complete( build_attrib_request(s_did, t_did, xhash, attrib, enc)) return attrib_req
def req(request, looper, sdk_pool_handle, sdk_wallet_steward): wallet_handle, identifier = sdk_wallet_steward if request.param == "ATTRIB": raw = json.dumps({'answer': 42}) request_json = looper.loop.run_until_complete( build_attrib_request(identifier, identifier, raw=raw, xhash=None, enc=None)) elif request.param == "SCHEMA": _, schema_json = looper.loop.run_until_complete( issuer_create_schema(identifier, "name", "1.0", json.dumps(["first", "last"]))) request_json = looper.loop.run_until_complete( build_schema_request(identifier, schema_json)) elif request.param == "RS_SCHEMA": rs_schema = {'@id': "fakeId234e", '@type': "0od"} request_json = build_rs_schema_request(identifier, rs_schema, "ISO18023_Drivers_License", "1.1") elif request.param == "CLAIM_DEF": schema_json, _ = sdk_write_schema(looper, sdk_pool_handle, sdk_wallet_steward) schema_id = json.loads(schema_json)['id'] request = looper.loop.run_until_complete( build_get_schema_request(identifier, schema_id)) reply = sdk_get_reply( looper, sdk_sign_and_submit_req(sdk_pool_handle, sdk_wallet_steward, request))[1] _, schema_json = looper.loop.run_until_complete( parse_get_schema_response(json.dumps(reply))) _, definition_json = looper.loop.run_until_complete( issuer_create_and_store_credential_def( wallet_handle, identifier, schema_json, "some_tag", "CL", json.dumps({"support_revocation": True}))) request_json = looper.loop.run_until_complete( build_cred_def_request(identifier, definition_json)) elif request.param == "NYM": idr, verkey = createHalfKeyIdentifierAndAbbrevVerkey() request_json = looper.loop.run_until_complete( build_nym_request(identifier, idr, verkey, None, None)) req_signed = looper.loop.run_until_complete( sign_request(wallet_handle, identifier, request_json)) return Request(**json.loads(req_signed))