Skip to content

Commit

Permalink
Fix browser compatibility and size reduction
Browse files Browse the repository at this point in the history
* Matched ajv and ajv-format versions to prevent pulling in unnecessary ajv version
* Replaced the winston logger with a console logger (fixing browser compatibility)
* Removed unnecessary use of TextEncoder (fixing browser compatibility)
* Lock NPM version during CI
* Audit advisory update
  • Loading branch information
william-brooks authored Feb 3, 2023
1 parent e0b2238 commit 8ba7d10
Show file tree
Hide file tree
Showing 117 changed files with 5,775 additions and 3,413 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}-{{checksum "package-lock.json"}}
- run: sudo npm install -g npm
- run: sudo npm install -g npm@6.14.13
- run: npm ci
- save_cache:
paths:
Expand Down
5 changes: 1 addition & 4 deletions __test__/lib/signerVerifier.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const nacl = require('tweetnacl');
const { TextEncoder } = require('util');
const signerVerifier = require('../../src/lib/signerVerifier');
const {
mockDids,
Expand All @@ -8,8 +7,6 @@ const {
keyPair,
} = require('./util/did');

const textEncoder = new TextEncoder();

const DUMMY_MERKLE_ROOT = 'aa4149dda8fd2fac435898372f1de399140f6c50dbc3d40585c913701ce902c4';

describe('signerVerifier', () => {
Expand Down Expand Up @@ -71,7 +68,7 @@ describe('signerVerifier', () => {

const customSigner = {
sign(proof) {
const encodedData = textEncoder.encode(proof.merkleRoot);
const encodedData = Buffer.from(proof.merkleRoot, 'hex');

const signature = nacl.sign.detached(encodedData, keypair.secretKey);

Expand Down
4 changes: 2 additions & 2 deletions audit-ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"low": true,
"package-manager": "auto",
"report": true,
"allowlist": [1067342, 1067524, 1068287, 1068310, 1070273, 1070274]
}
"allowlist": [1086436, 1088664, 1088730, 1088811, 1088828, 1088831, 1088948, 1089128, 1089129, 1089152, 1089185, 1089394, 1089513, 1090135, 1090146, 1090169, 1090170]
}
2 changes: 1 addition & 1 deletion dist/browser/AggregationHandler.js

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

2 changes: 1 addition & 1 deletion dist/browser/SecureRandom.js

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

2 changes: 1 addition & 1 deletion dist/browser/claim/Claim.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/browser/claim/__mocks__/definitions.js

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

2 changes: 1 addition & 1 deletion dist/browser/claim/definitions.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
'use strict';var _require=require("@identity.com/uca"),ucaDefinitions=_require.definitions,definitions=[{identifier:"claim-cvc:Email.domain-v1",version:"1",type:"cvc:Type:domain",credentialItem:!0},{identifier:"claim-cvc:Contact.email-v1",version:"1",type:"claim-cvc:Type.email-v1",credentialItem:!0},{identifier:"claim-cvc:User.id-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:User.realm-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Phone.countryCode-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Phone.number-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Phone.extension-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Phone.lineType-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:PhoneNumber.countryCode-v1",type:"claim-cvc:Phone.countryCode-v1",version:"1",credentialItem:!0},{identifier:"claim-cvc:PhoneNumber.number-v1",type:"claim-cvc:Phone.number-v1",version:"1",credentialItem:!0},{identifier:"claim-cvc:PhoneNumber.extension-v1",type:"claim-cvc:Phone.extension-v1",version:"1",credentialItem:!0},{identifier:"claim-cvc:PhoneNumber.lineType-v1",type:"claim-cvc:Phone.lineType-v1",version:"1",credentialItem:!0},{identifier:"claim-cvc:Contact.phoneNumber-v1",version:"1",type:"claim-cvc:Type.phoneNumber-v1",credentialItem:!0},{identifier:"claim-cvc:Name.givenNames-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Name.familyNames-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Name.otherNames-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Type.Name-v1",version:"1",type:{properties:[{name:"givenNames",type:"claim-cvc:Name.givenNames-v1"},{name:"familyNames",type:"claim-cvc:Name.familyNames-v1"},{name:"otherNames",type:"claim-cvc:Name.otherNames-v1"}],required:["givenNames"]},credentialItem:!0},{identifier:"claim-cvc:Document.name-v1",version:"1",type:"claim-cvc:Type.Name-v1",credentialItem:!0},{identifier:"claim-cvc:Identity.name-v1",version:"1",type:"claim-cvc:Type.Name-v1",credentialItem:!0},{identifier:"claim-cvc:Document.nationality-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Document.number-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Identity.dateOfBirth-v1",version:"1",type:"cvc:Type:date",credentialItem:!0},{identifier:"claim-cvc:Address.city-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Address.postalCode-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Address.state-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Address.county-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Address.country-v1",version:"1",type:"cvc:Type:country",credentialItem:!0},{identifier:"claim-cvc:Document.address-v1",version:"1",type:"claim-cvc:Type.address-v1",credentialItem:!0},{identifier:"claim-cvc:Identity.address-v1",version:"1",type:"claim-cvc:Type.address-v1",credentialItem:!0},{identifier:"claim-cvc:Document.dateOfIssue-v1",version:"1",type:"cvc:Type:date",credentialItem:!0},{identifier:"claim-cvc:Document.dateOfExpiry-v1",version:"1",type:"cvc:Type:date",credentialItem:!0},{identifier:"claim-cvc:Document.dateOfBirth-v1",version:"1",type:"cvc:Type:date",credentialItem:!0},{identifier:"claim-cvc:Document.enum-v1",version:"1",type:"String"},{identifier:"claim-cvc:Document.type-v1",version:"1",type:"cvc:Type:documentType",credentialItem:!0},{identifier:"claim-cvc:Document.gender-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Document.issueLocation-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Document.issueAuthority-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Document.issueCountry-v1",version:"1",type:"cvc:Type:country",credentialItem:!0},{identifier:"claim-cvc:Document.placeOfBirth-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Type.email-v1",version:"1",type:{properties:[{name:"username",type:"cvc:Email:username"},{name:"domain",type:"claim-cvc:Email.domain-v1"}]},credentialItem:!0},{identifier:"claim-cvc:Type.phoneNumber-v1",version:"1",type:{properties:[{name:"country",type:"claim-cvc:PhoneNumber.country-v1"},{name:"countryCode",type:"claim-cvc:PhoneNumber.countryCode-v1"},{name:"number",type:"claim-cvc:PhoneNumber.number-v1"},{name:"extension",type:"claim-cvc:PhoneNumber.extension-v1"},{name:"lineType",type:"claim-cvc:PhoneNumber.lineType-v1"}],required:["country","countryCode","number","lineType"]},credentialItem:!0},{identifier:"claim-cvc:PhoneNumber.country-v1",type:"cvc:Type:country",version:"1",credentialItem:!0},{identifier:"claim-cvc:Type.Name-v1",version:"1",type:{properties:[{name:"givenNames",type:"claim-cvc:Name.givenNames-v1"},{name:"familyNames",type:"claim-cvc:Name.familyNames-v1"},{name:"otherNames",type:"claim-cvc:Name.otherNames-v1"}],required:["givenNames"]},credentialItem:!0},{identifier:"claim-cvc:Type.address-v1",version:"1",type:{properties:[{name:"country",type:"claim-cvc:Address.country-v1"},{name:"county",type:"claim-cvc:Address.county-v1"},{name:"state",type:"claim-cvc:Address.state-v1"},{name:"street",type:"claim-cvc:Address.street-v1"},{name:"unit",type:"claim-cvc:Address.unit-v1"},{name:"city",type:"claim-cvc:Address.city-v1"},{name:"postalCode",type:"claim-cvc:Address.postalCode-v1"}],required:["street","city","state","country"]},credentialItem:!0},{identifier:"claim-cvc:Address.street-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Address.unit-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Document.properties-v1",version:"1",attestable:!0,type:{properties:[{name:"dateOfIssue",type:"claim-cvc:Document.dateOfIssue-v1"},{name:"dateOfExpiry",type:"claim-cvc:Document.dateOfExpiry-v1"}],required:["dateOfIssue"]},credentialItem:!0},{identifier:"claim-cvc:SocialSecurity.number-v1",version:"1",type:"cvc:Type:socialSecurityNumber",credentialItem:!0},{identifier:"claim-cvc:Validation:evidences.idDocumentFront-v1",version:"1",type:"cvc:Evidences:idDocumentFront",credentialItem:!0},{identifier:"claim-cvc:Validation:evidences.idDocumentBack-v1",version:"1",type:"cvc:Evidences:idDocumentBack",credentialItem:!0},{identifier:"claim-cvc:Validation:evidences.selfie-v1",version:"1",type:"cvc:Evidences:selfie",credentialItem:!0},{identifier:"claim-cvc:Document.evidences-v1",version:"1",attestable:!0,type:{properties:[{name:"idDocumentFront",type:"claim-cvc:Validation:evidences.idDocumentFront-v1"},{name:"idDocumentBack",type:"claim-cvc:Validation:evidences.idDocumentBack-v1"},{name:"selfie",type:"claim-cvc:Validation:evidences.selfie-v1"}]},credentialItem:!0},{identifier:"claim-cvc:Vaccination.date-v1",version:"1",type:"cvc:Type:timestamp",credentialItem:!1},{identifier:"claim-cvc:Test.date-v1",version:"1",type:"cvc:Type:timestamp",credentialItem:!1},{identifier:"claim-cvc:Vaccination.name-v1",version:"1",type:"String",credentialItem:!1},{identifier:"claim-cvc:Vaccination.recordDetail-v1",version:"1",type:{properties:[{name:"createdAt",type:"cvc:Type:date"},{name:"updatedAt",type:"cvc:Type:date"}]},required:["createdAt"],credentialItem:!1},{identifier:"claim-cvc:Type.organizationName-v1",version:"1",type:"String",credentialItem:!1},{identifier:"claim-cvc:Type.organizationId-v1",version:"1",type:"String",credentialItem:!1},{identifier:"claim-cvc:Type.organization-v1",version:"1",type:{properties:[{name:"name",type:"claim-cvc:Type.organizationName-v1"},{name:"id",type:"claim-cvc:Type.organizationId-v1"}]},required:["name"],credentialItem:!1},{identifier:"claim-cvc:Type.patient-v1",version:"1",type:{properties:[{name:"fullName",type:"cvc:Type:fullName"},{name:"dateOfBirth",type:"cvc:Type:date"}]},required:["name"],credentialItem:!0},{identifier:"claim-cvc:Medical.code-v1",version:"1",type:{properties:[{name:"name",type:"cvc:Code:name"},{name:"code",type:"cvc:Code:code"},{name:"codeSystem",type:"cvc:Code:codeSystem"},{name:"codeSystemName",type:"cvc:Code:codeSystemName"}]},required:["name","code"],credentialItem:!1},{identifier:"claim-cvc:Manufacturer.name-v1",version:"1",type:"String",credentialItem:!1},{identifier:"claim-cvc:Vaccination.manufacturer-v1",version:"1",type:{properties:[{name:"name",type:"claim-cvc:Manufacturer.name-v1"},{name:"code",type:"claim-cvc:Medical.code-v1"}],required:["name"]},credentialItem:!1},{identifier:"claim-cvc:Vaccination.id-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Medical.codes-v1",version:"1",type:"Array",items:{type:"claim-cvc:Medical.code-v1"},credentialItem:!1},{identifier:"claim-cvc:Codes.records-v1",version:"1",type:"Array",items:{type:"claim-cvc:Medical.code-v1"},credentialItem:!1},{identifier:"claim-cvc:Vaccination.record-v1",version:"1",type:{properties:[{name:"vaccinationId",type:"claim-cvc:Vaccination.id-v1"},{name:"dateOfAdministration",type:"claim-cvc:Vaccination.date-v1"},{name:"manufacturer",type:"claim-cvc:Vaccination.manufacturer-v1"},{name:"name",type:"claim-cvc:Vaccination.name-v1"},{name:"detail",type:"claim-cvc:Vaccination.recordDetail-v1"},{name:"organization",type:"cvc:Type:organization"},{name:"codes",type:"claim-cvc:Codes.records-v1"}],required:["vaccinationId","dateOfAdministration","name","organization"]},credentialItem:!0},{identifier:"claim-cvc:Vaccination.records-v1",version:"1",type:"Array",items:{type:"claim-cvc:Vaccination.record-v1"},credentialItem:!0},{identifier:"claim-cvc:Test.type-v1",version:"1",type:"String",credentialItem:!1},{identifier:"claim-cvc:Test.result-v1",version:"1",type:"String",credentialItem:!1},{identifier:"claim-cvc:Test.id-v1",version:"1",type:"String",credentialItem:!0},{identifier:"claim-cvc:Test.record-v1",version:"1",type:{properties:[{name:"testId",type:"claim-cvc:Test.id-v1"},{name:"testDate",type:"claim-cvc:Test.date-v1"},{name:"resultDate",type:"claim-cvc:Test.date-v1"},{name:"type",type:"claim-cvc:Test.type-v1"},{name:"result",type:"claim-cvc:Test.result-v1"},{name:"organization",type:"claim-cvc:Type.organization-v1"},{name:"codes",type:"claim-cvc:Codes.records-v1"}],required:["testId","testDate","type","result"]},credentialItem:!0},{identifier:"claim-cvc:Test.records-v1",version:"1",type:"Array",items:{type:"claim-cvc:Test.record-v1"},credentialItem:!0},{identifier:"claim-cvc:Medical.covid19-v1",version:"1",type:{properties:[{name:"vaccinations",type:"claim-cvc:Vaccination.records-v1"},{name:"tests",type:"claim-cvc:Test.records-v1"},{name:"patient",type:"claim-cvc:Type.patient-v1"}]},require:["patient"],credentialItem:!0}];function transformUcaIdToClaimId(a){var b=a.split(":");return"claim-cvc:"+b[1]+"."+b[2]+"-v1"}function isDefinitionEqual(a,b){return a.identifier===transformUcaIdToClaimId(b.identifier)||a.identifier===b.identifier}ucaDefinitions.forEach(function(a){var b=!1;definitions.some(function(c){return isDefinitionEqual(c,a)&&(b=!0),b}),b||definitions.push(a)}),module.exports=definitions;
"use strict";module.exports=[];
2 changes: 1 addition & 1 deletion dist/browser/constants/headers.js

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

2 changes: 1 addition & 1 deletion dist/browser/constants/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
'use strict';var headers=require("./headers");module.exports={headers:headers};
"use strict";var headers=require("./headers");module.exports={headers:headers};
Loading

0 comments on commit 8ba7d10

Please sign in to comment.