Skip to content

Commit

Permalink
Merge pull request #121 from identity-com/handle-alias-ucas
Browse files Browse the repository at this point in the history
Test claim conversion for alias UCAs
  • Loading branch information
lucmir authored Jul 12, 2019
2 parents 45ba0f9 + 8684220 commit ad5215b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 39 deletions.
22 changes: 22 additions & 0 deletions __test__/claim/Claim.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,26 @@ describe('Claim Constructions tests', () => {
expect(dateOfBirthClaim.value.day).toBeDefined();
expect(dateOfBirthClaim.value.day.value).toBe(20);
});

test('Transforming alias UCA to Claim', () => {
const identifier = 'cvc:Document:evidences';
const aliasIdentifier = 'cvc:Validation:evidences';
const value = {
idDocumentFront: { algorithm: 'sha256', data: 'sha256(idDocumentFront)' },
idDocumentBack: { algorithm: 'sha256', data: 'sha256(idDocumentBack)' },
selfie: { algorithm: 'sha256', data: 'sha256(selfie)' },
};

const evidencesUCA = new UserCollectableAttribute(identifier, value);
const evidencesAliasUCA = new UserCollectableAttribute(aliasIdentifier, value);

// converting UCAs to Claims
const evidencesClaim = new Claim(identifier, evidencesUCA.getPlainValue());
const evidencesClaimForAliasUCA = new Claim(identifier, evidencesAliasUCA.getPlainValue());

// should map to the same claim
expect(evidencesClaimForAliasUCA.identifier).toEqual(evidencesClaim.identifier);
expect(evidencesClaimForAliasUCA.getPlainValue()).toEqual(evidencesClaim.getPlainValue());
expect(evidencesClaim.identifier).toBe('claim-cvc:Document.evidences-v1');
});
});
50 changes: 13 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@identity.com/credential-commons",
"version": "1.0.21",
"version": "1.0.22",
"author": "Identity.com Community",
"license": "MIT",
"description": "Verifiable Credential and Attestation Library",
Expand Down Expand Up @@ -60,7 +60,7 @@
"rimraf": "^2.6.2"
},
"dependencies": {
"@identity.com/uca": "1.0.12",
"@identity.com/uca": "1.0.13",
"ajv": "^6.10.0",
"babel-runtime": "^6.26.0",
"bitcoinjs-lib": "git+https://github.com/dabura667/bitcoinjs-lib.git#bcash330",
Expand Down

0 comments on commit ad5215b

Please sign in to comment.