def to_str_dict(self): return { 'c_hash': str(self.cHash), 'c_list': [intToArrayBytes(v) for v in self.CList if isCryptoInteger(v)] }
def testIntToArrayBytes(): val = cmod.integer(1606507817390189252221968804450207070282033) res = [ 18, 113, 26, 39, 35, 240, 231, 239, 92, 226, 84, 46, 230, 174, 230, 41, 225, 49 ] assert res == intToArrayBytes(val)
def get_proof_libsovrin_msg(link, proof_req, proof, uuid, schema_seq_no): eqProof = proof.proofs[str(uuid)].proof.primaryProof.eqProof return ({ 'type': 'PROOF', 'nonce': '{}'.format(link.request_nonce), 'proof_request': proof_req.to_str_dict(), 'proof': { 'proofs': { uuid: { 'proof': { 'primary_proof': { 'eq_proof': { 'revealed_attrs': { k: str(v) for k, v in eqProof.revealedAttrs.items() }, 'a_prime': '{}'.format(crypto_int_to_str(eqProof.Aprime)), 'e': '{}'.format(crypto_int_to_str(eqProof.e)), 'v': '{}'.format(crypto_int_to_str(eqProof.v)), 'm': { k: str(crypto_int_to_str(v)) for k, v in eqProof.m.items() }, 'm1': '{}'.format(crypto_int_to_str(eqProof.m1)), 'm2': '{}'.format(crypto_int_to_str(eqProof.m2)) }, 'ge_proofs': {} }, 'non_revoc_proof': None }, 'issuer_did': 'FuN98eH2eZybECWkofW6A9BKJxxnTatBCopfUiNxo6ZB', 'schema_seq_no': schema_seq_no, 'revoc_reg_seq_no': None } }, 'aggregated_proof': { 'c_hash': '{}'.format(str(proof.aggregatedProof.cHash)), 'c_list': [ intToArrayBytes(v) for v in proof.aggregatedProof.CList if isCryptoInteger(v) ] }, 'requested_proof': { 'revealed_attrs': proof.requestedProof.revealed_attrs, 'unrevealed_attrs': proof.requestedProof.unrevealed_attrs, 'self_attested_attrs': proof.requestedProof.self_attested_attrs, 'predicates': proof.requestedProof.predicates } } })
def get_proof_libindy_msg(link, proof_req, proof, uuid, schema_seq_no): eqProof = proof.proofs[str(uuid)].proof.primaryProof.eqProof return ({'type': 'PROOF', 'nonce': '{}'.format(link.request_nonce), 'proof_request': proof_req.to_str_dict(), 'proof': { 'proofs': { uuid: { 'proof': { 'primary_proof': { 'eq_proof': { 'revealed_attrs': {k: str(v) for k, v in eqProof.revealedAttrs.items()}, 'a_prime': '{}'.format(crypto_int_to_str(eqProof.Aprime)), 'e': '{}'.format(crypto_int_to_str(eqProof.e)), 'v': '{}'.format(crypto_int_to_str(eqProof.v)), 'm': {k: str(crypto_int_to_str(v)) for k, v in eqProof.m.items()}, 'm1': '{}'.format(crypto_int_to_str(eqProof.m1)), 'm2': '{}'.format(crypto_int_to_str(eqProof.m2)) }, 'ge_proofs': {} }, 'non_revoc_proof': None }, 'issuer_did': 'FuN98eH2eZybECWkofW6A9BKJxxnTatBCopfUiNxo6ZB', 'schema_seq_no': schema_seq_no, 'revoc_reg_seq_no': None } }, 'aggregated_proof': { 'c_hash': '{}'.format(str(proof.aggregatedProof.cHash)), 'c_list': [intToArrayBytes(v) for v in proof.aggregatedProof.CList if isCryptoInteger(v)] }, 'requested_proof': { 'revealed_attrs': proof.requestedProof.revealed_attrs, 'unrevealed_attrs': proof.requestedProof.unrevealed_attrs, 'self_attested_attrs': proof.requestedProof.self_attested_attrs, 'predicates': proof.requestedProof.predicates } }})
def testIntToArrayBytesAndBack(): val = cmod.integer(1606507817390189252221968804450207070282033) assert val == bytesToInt(intToArrayBytes(val))