def test_claim_def_reply_is_valid(looper, sdk_pool_handle, sdk_wallet_steward): wallet_handle, identifier = sdk_wallet_steward 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 = looper.loop.run_until_complete( build_cred_def_request(identifier, definition_json)) reply = sdk_get_reply( looper, sdk_sign_and_submit_req(sdk_pool_handle, sdk_wallet_steward, request))[1] validate_write_reply(reply) validate_claim_def_txn(reply['result']['txn'])
def get_schema_json(looper, sdk_pool_handle, sdk_wallet_trustee): wallet_handle, identifier = sdk_wallet_trustee schema_json, _ = sdk_write_schema(looper, sdk_pool_handle, sdk_wallet_trustee) 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_trustee, request))[1] _, schema_json = looper.loop.run_until_complete(parse_get_schema_response(json.dumps(reply))) return schema_json
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))
def large_schema_json(looper, sdk_pool_handle, sdk_wallet_trustee): wallet_handle, identifier = sdk_wallet_trustee attrs = [ randomString(size=NAME_FIELD_LIMIT) for _ in range(SCHEMA_ATTRIBUTES_LIMIT) ] schema_json, _ = sdk_write_schema(looper, sdk_pool_handle, sdk_wallet_trustee, multi_attribute=attrs, name="name_large", version="2.0") 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_trustee, request))[1] _, schema_json = looper.loop.run_until_complete( parse_get_schema_response(json.dumps(reply))) return schema_json