Exemplo n.º 1
0
def get_claim_libsovrin_msg(signature, schema_seq_no):
    return ({
        'type': 'CLAIM',
        'refRequestId': 1498207862797639,
        'data': {
            'claim':
            '{'
            '"ssn": ["123-45-6789", "744326867119662813058574151710572260086480987778735990385444735594385781152"], '
            '"student_name": ["Alice Garcia", "42269428060847300013074105341288624461740820166347597208920185513943254001053"], '
            '"year": ["2015", "76155730627064255622230347398579434243999717245284701820698087443021519005597"],'
            '"status": ["graduated", "79954080701401061138041003494589205197191732193019334789897013390726508263804"], '
            '"degree": ["Bachelor of Science, Marketing", "111351644242834420607747624840774158853435703856237568018084128306949040580032"]}',
            'schema_seq_no':
            schema_seq_no,
            'revoc_reg_seq_no':
            None,
            'issuer_did':
            'FuN98eH2eZybECWkofW6A9BKJxxnTatBCopfUiNxo6ZB',
            'signature': {
                'non_revocation_claim': None,
                'primary_claim': {
                    'm2':
                    '{}'.format(crypto_int_to_str(signature.primaryClaim.m2)),
                    'e': '{}'.format(str(signature.primaryClaim.e)),
                    'v': '{}'.format(str(signature.primaryClaim.v)),
                    'a':
                    '{}'.format(crypto_int_to_str(signature.primaryClaim.A))
                }
            }
        },
        'reqId': 1498207879197729,
        'signature':
        '3v4CJnCpFv3on9DJKzourd9RfvX3gz5yXY1jkhxc8FktHVbvx1ghBJC7DUYMAJzApPUAYMyTzyMB6Dm8HEzhAtvM',
        'identifier': 'ULtgFQJe6bjiFbs7ke3NJD'
    }, ('Faber College', ('127.0.0.1', 6918)))
Exemplo n.º 2
0
 def to_str_dict(self):
     return {
         'm2': str(crypto_int_to_str(self.m2)),
         'a': str(crypto_int_to_str(self.A)),
         'e': str(self.e),
         'v': str(self.v)
     }
Exemplo n.º 3
0
def get_claim_libindy_msg(signature, schema_seq_no):
    return ({'type': 'CLAIM',
             'refRequestId': 1498207862797639,
             'data': {
                 'claim': '{'
                          '"ssn": ["123-45-6789", "744326867119662813058574151710572260086480987778735990385444735594385781152"], '
                          '"student_name": ["Alice Garcia", "42269428060847300013074105341288624461740820166347597208920185513943254001053"], '
                          '"year": ["2015", "76155730627064255622230347398579434243999717245284701820698087443021519005597"],'
                          '"status": ["graduated", "79954080701401061138041003494589205197191732193019334789897013390726508263804"], '
                          '"degree": ["Bachelor of Science, Marketing", "111351644242834420607747624840774158853435703856237568018084128306949040580032"]}',
                 'schema_seq_no': schema_seq_no,
                 'revoc_reg_seq_no': None,
                 'issuer_did': 'FuN98eH2eZybECWkofW6A9BKJxxnTatBCopfUiNxo6ZB',
                 'signature': {
                     'non_revocation_claim': None,
                     'primary_claim': {
                         'm2': '{}'.format(crypto_int_to_str(signature.primaryClaim.m2)),
                         'e': '{}'.format(str(signature.primaryClaim.e)),
                         'v': '{}'.format(str(signature.primaryClaim.v)),
                         'a': '{}'.format(crypto_int_to_str(signature.primaryClaim.A))}
                 }
             },
             'reqId': 1498207879197729,
             'signature': '3v4CJnCpFv3on9DJKzourd9RfvX3gz5yXY1jkhxc8FktHVbvx1ghBJC7DUYMAJzApPUAYMyTzyMB6Dm8HEzhAtvM',
             'identifier': 'ULtgFQJe6bjiFbs7ke3NJD'}, ('Faber College', ('127.0.0.1', 6918)))
Exemplo n.º 4
0
 def to_str_dict(self):
     return {
         'alpha': str(crypto_int_to_str(self.alpha)),
         'mj': str(crypto_int_to_str(self.mj)),
         'u': {k: str(crypto_int_to_str(v))
               for k, v in self.u.items()},
         'r': {k: str(crypto_int_to_str(v))
               for k, v in self.r.items()},
         't': {k: str(crypto_int_to_str(v))
               for k, v in self.T.items()},
         'predicate': self.predicate.to_str_dict()
     }
Exemplo n.º 5
0
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
            }
        }
    })
Exemplo n.º 6
0
def get_claim_request_libsovrin_msg(claim_req, schema_seq_no):
    return ({
        'type': 'CLAIM_REQUEST',
        'data': {
            'issuer_did': 'FuN98eH2eZybECWkofW6A9BKJxxnTatBCopfUiNxo6ZB',
            'blinded_ms': {
                'prover_did': 'b1134a647eb818069c089e7694f63e6d',
                'u': str(crypto_int_to_str(claim_req.U)),
                'ur': None
            },
            'schema_seq_no': schema_seq_no
        },
        'nonce': 'b1134a647eb818069c089e7694f63e6d',
    })
Exemplo n.º 7
0
def get_claim_request_libindy_msg(claim_req, schema_seq_no):
    return ({
        'type': 'CLAIM_REQUEST',
        'data': {
            'issuer_did': 'FuN98eH2eZybECWkofW6A9BKJxxnTatBCopfUiNxo6ZB',
            'blinded_ms': {
                'prover_did': 'b1134a647eb818069c089e7694f63e6d',
                'u': str(crypto_int_to_str(claim_req.U)),
                'ur': None
            },
            'schema_seq_no': schema_seq_no
        },
        'nonce': 'b1134a647eb818069c089e7694f63e6d',
    })
Exemplo n.º 8
0
    def to_str_dict(self):
        public_key = {
            'n': str(crypto_int_to_str(self.N)),
            's': str(crypto_int_to_str(self.S)),
            'rms': str(crypto_int_to_str(self.Rms)),
            'rctxt': str(crypto_int_to_str(self.Rctxt)),
            'z': str(crypto_int_to_str(self.Z)),
            'r': {k: str(crypto_int_to_str(v))
                  for k, v in self.R.items()}
        }

        return public_key
Exemplo n.º 9
0
 def to_str_dict(self):
     return {
         'e': str(crypto_int_to_str(self.e)),
         'v': str(crypto_int_to_str(self.v)),
         'm1': str(crypto_int_to_str(self.m1)),
         'm2': str(crypto_int_to_str(self.m2)),
         'm': {k: str(crypto_int_to_str(v))
               for k, v in self.m.items()},
         'revealed_attrs':
         {k: str(v)
          for k, v in self.revealedAttrs.items()},
         'a_prime': str(crypto_int_to_str(self.Aprime))
     }
    async def create_claim_init_data_and_send_msg():
        claimReq = await aliceAgent.prover.createClaimRequest(
            schemaId=ID(schemaKey),
            proverId='b1134a647eb818069c089e7694f63e6d',
            reqNonRevoc=False)

        assert claimReq

        msg = ({
            'issuer_did': 'FuN98eH2eZybECWkofW6A9BKJxxnTatBCopfUiNxo6ZB',
            'claim_def_seq_no': 14,
            'blinded_ms': {
                'prover_did': 'b1134a647eb818069c089e7694f63e6d',
                'u': str(crypto_int_to_str(claimReq.U)),
                'ur': None
            },
            'type': 'CLAIM_REQUEST',
            'schema_seq_no': 13,
            'nonce': 'b1134a647eb818069c089e7694f63e6d',
        })

        aliceAgent.signAndSendToLink(msg=msg, linkName=faberLink.name)
    async def create_claim_init_data_and_send_msg():
        claimReq = await aliceAgent.prover.createClaimRequest(
            schemaId=ID(schemaKey),
            proverId='b1134a647eb818069c089e7694f63e6d',
            reqNonRevoc=False)

        assert claimReq

        msg = (
            {
                'issuer_did': 'FuN98eH2eZybECWkofW6A9BKJxxnTatBCopfUiNxo6ZB',
                'claim_def_seq_no': 14,
                'blinded_ms': {
                    'prover_did': 'b1134a647eb818069c089e7694f63e6d',
                    'u': str(crypto_int_to_str(claimReq.U)),
                    'ur': None
                },
                'type': 'CLAIM_REQUEST',
                'schema_seq_no': 13,
                'nonce': 'b1134a647eb818069c089e7694f63e6d',
            }
        )

        aliceAgent.signAndSendToLink(msg=msg, linkName=faberLink.name)
Exemplo n.º 12
0
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
                 }
             }})
Exemplo n.º 13
0
 def to_str_dict(self):
     return {
         'prover_did': str(self.userId),
         'u': str(crypto_int_to_str(self.U)),
         'ur': self.Ur
     }