{"_id":"@adityaghag/cert-verifier-js","_rev":"9-1930d6355b7de66eea0e95cf49f88d1c","name":"@adityaghag/cert-verifier-js","dist-tags":{"latest":"1.2.1"},"versions":{"1.1.0":{"name":"@adityaghag/cert-verifier-js","version":"1.1.0","author":{"name":"Adi ghag"},"license":"MIT","_id":"@adityaghag/cert-verifier-js@1.1.0","maintainers":[{"name":"adityaghag","email":"aditya.ghag94@gmail.com"}],"homepage":"https://github.com/adi-ghag/cert-verifier-js#readme","bugs":{"url":"https://github.com/adi-ghag/cert-verifier-js/issues"},"dist":{"shasum":"b95f01b9549954849ccc744d776fd7a073856fa6","tarball":"https://registry.npmjs.org/@adityaghag/cert-verifier-js/-/cert-verifier-js-1.1.0.tgz","fileCount":265,"integrity":"sha512-NM6AFsVpZqwy7CY0PydrnW5OXc/zMt3iA+RgB9svcEn6wC87Bdz3UeViAtbOZk6TCilPA5KELlx8xKB7OINlRg==","signatures":[{"sig":"MEQCIEr2Xz4I1YaNyyO5iDz+OeMp/R9fqLfz5LYWk757xtYsAiAxjpUUb0NwkIf/zHPA01owsxVohxRoityVV4ZMzW7bYw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23062863},"main":"dist/verifier/index.js","node":"dist/verifier-node/index.js","module":"dist/verifier-es/index.js","gitHead":"42f695044fc79cf043de175f7812d8b60bfaa582","scripts":{"lint":"eslint . --ext .ts","test":"vitest run","build":"rimraf dist && npm run build:esm && npm run build:iife && npm run build:node && npm run dts:bundle && npm run test:build","prepare":"husky install","build:esm":"rollup -c","build:iife":"rollup -c rollup.iife.config.mjs","build:node":"rollup -c rollup.node.config.mjs","dts:bundle":"dts-bundle-generator -o ./dist/index.d.ts --project tsconfig.json --no-banner src/index.ts","test:build":"npm run test:manual:node:server& npm run test:build:esm && npm run test:build:cjs && npm run test:build:node && npm run test:build:iife && kill -9 $(lsof -t -i:4000)","test:watch":"vitest","clean:lib:ts":"rimraf lib/\"**\"/*.ts","test:coverage":"vitest run --silent --coverage.enabled","test:build:cjs":"vitest run --dir test/build -c test/build/vitest.config.build.cjs.ts --silent","test:build:esm":"vitest run --dir test/build -c test/build/vitest.config.build.esm.ts --silent","test:build:iife":"karma start --single-run","test:build:node":"vitest run --dir test/build -c test/build/vitest.config.build.node.ts --silent","semantic-release":"HUSKY=0 semantic-release","test:manual:browser":"rollup -c test/manual-testing/browser/rollup.config.mjs","test:coverage:report":"codecov","transpile:mocks:iife":"rollup -c test/build/scripts/rollup.mocks.config.mjs","test:manual:node:server":"node test/manual-testing/node/server.js","test:manual:node:verify":"node test/manual-testing/node/request.mjs","test:manual:node:server:watch":"nodemon test/manual-testing/node/server.js"},"typings":"dist/index.d.ts","_npmUser":{"name":"adityaghag","email":"aditya.ghag94@gmail.com"},"repository":{"url":"git+https://github.com/adi-ghag/cert-verifier-js.git","type":"git"},"_npmVersion":"10.9.2","description":"Javascript library for verifying Blockcerts","directories":{},"_nodeVersion":"22.13.0","dependencies":{"bs58":"^6.0.0","buffer":"^6.0.3","jsonld":"^8.3.2","sha256":"^0.2.0","secp256k1":"^5.0.0","@trust/keyto":"^1.0.1","jsonld-checker":"npm:@blockcerts/jsonld-checker@^0.1.9","lodash.clonedeep":"^4.5.0","jsonld-signatures":"^11.5.0","@exodus/schemasafe":"^1.3.0","@blockcerts/schemas":"^3.9.0","base64url-universal":"^2.0.0","@did-core/did-ld-json":"npm:@blockcerts/did-ld-json@^0.1.2","@transmute/did-key-ed25519":"^0.3.0-unstable.10","@adityaghag/explorer-lookup":"1.2.1","@transmute/ed25519-key-pair":"^0.7.0-unstable.63","@transmute/did-key-secp256k1":"^0.3.0-unstable.10","@blockcerts/hashlink-verifier":"^2.0.0","@digitalbazaar/data-integrity":"^2.1.0","@digitalbazaar/ed25519-multikey":"^1.3.1","@digitalbazaar/vc-revocation-list":"github:blockchain-certificates/vc-revocation-list#fix/memory-leak","@digitalbazaar/ed25519-signature-2020":"^5.2.0","@digitalbazaar/ecdsa-sd-2023-cryptosuite":"github:blockchain-certificates/ecdsa-sd-2023-cryptosuite#chore/secp256k1-with-multikey-fork","@blockcerts/ecdsa-secp256k1-signature-2019":"^0.1.8","@digitalbazaar/eddsa-rdfc-2022-cryptosuite":"^1.2.0","@digitalbazaar/ed25519-verification-key-2020":"^4.1.0","@adityaghag/jsonld-signatures-merkleproof2019":"1.2.2","@blockcerts/ecdsa-secp256k1-verification-key-2019":"^0.1.9"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"brfs":"^2.0.2","husky":"^9.1.7","jsdom":"^27.0.0","karma":"^6.4.2","sinon":"^21.0.0","tslib":"^2.4.0","crypto":"^1.0.1","eslint":"^9.24.0","rimraf":"^6.0.1","rollup":"^4.22.4","snazzy":"^9.0.0","vitest":"^3.1.1","codecov":"^3.0.4","express":"^5.1.0","nodemon":"^3.1.9","ts-node":"^10.9.2","@eslint/js":"^9.24.0","commitlint":"^19.8.0","node-fetch":"^3.3.2","typescript":"^5.8.3","@types/node":"^24.0.13","body-parser":"^2.2.0","@types/sinon":"^17.0.1","jasmine-core":"^5.1.0","karma-jasmine":"^5.1.0","xmlhttprequest":"^1.8.0","@commitlint/cli":"^20.1.0","semantic-release":"^24.1.2","typescript-eslint":"^8.29.1","@rollup/plugin-json":"^6.0.1","rollup-plugin-serve":"^1.1.0","dts-bundle-generator":"^9.0.0","rollup-plugin-terser":"^7.0.0","karma-chrome-launcher":"^3.2.0","karma-firefox-launcher":"^2.1.2","@rollup/plugin-commonjs":"^28.0.0","rollup-plugin-livereload":"^2.0.0","rollup-plugin-visualizer":"^6.0.1","@rollup/plugin-typescript":"^12.1.2","@vitest/coverage-istanbul":"^3.1.1","@rollup/plugin-multi-entry":"^6.0.1","rollup-plugin-node-globals":"github:blockchain-certificates/rollup-plugin-node-globals","@rollup/plugin-node-resolve":"^16.0.1","rollup-plugin-node-builtins":"^2.1.2","rollup-plugin-polyfill-node":"^0.13.0","@commitlint/config-conventional":"^19.2.2","@decentralized-identity/did-common-typescript":"^0.1.19"},"_npmOperationalInternal":{"tmp":"tmp/cert-verifier-js_1.1.0_1760515324209_0.44554870983214223","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@adityaghag/cert-verifier-js","version":"1.2.1","description":"Javascript library for verifying Blockcerts","repository":{"type":"git","url":"git+https://github.com/adi-ghag/cert-verifier-js.git"},"main":"dist/verifier/index.js","module":"dist/verifier-es/index.js","node":"dist/verifier-node/index.js","typings":"dist/index.d.ts","scripts":{"dts:bundle":"dts-bundle-generator -o ./dist/index.d.ts --project tsconfig.json --no-banner src/index.ts","test":"vitest run","test:build":"npm run test:manual:node:server& npm run test:build:esm && npm run test:build:cjs && npm run test:build:node && npm run test:build:iife && kill -9 $(lsof -t -i:4000)","test:build:node":"vitest run --dir test/build -c test/build/vitest.config.build.node.ts --silent","test:build:cjs":"vitest run --dir test/build -c test/build/vitest.config.build.cjs.ts --silent","test:build:esm":"vitest run --dir test/build -c test/build/vitest.config.build.esm.ts --silent","test:build:iife":"karma start --single-run","test:manual:browser":"rollup -c test/manual-testing/browser/rollup.config.mjs","test:manual:node:server":"node test/manual-testing/node/server.js","test:manual:node:server:watch":"nodemon test/manual-testing/node/server.js","test:manual:node:verify":"node test/manual-testing/node/request.mjs","test:watch":"vitest","test:coverage":"vitest run --silent --coverage.enabled","test:coverage:report":"codecov","build":"rimraf dist && npm run build:esm && npm run build:iife && npm run build:node && npm run dts:bundle && npm run test:build","build:esm":"rollup -c","build:iife":"rollup -c rollup.iife.config.mjs","build:node":"rollup -c rollup.node.config.mjs","transpile:mocks:iife":"rollup -c test/build/scripts/rollup.mocks.config.mjs","clean:lib:ts":"rimraf lib/\"**\"/*.ts","lint":"eslint . --ext .ts","semantic-release":"HUSKY=0 semantic-release","prepare":"husky install"},"publishConfig":{"access":"public"},"author":{"name":"Adi ghag"},"license":"MIT","dependencies":{"@blockcerts/ecdsa-secp256k1-signature-2019":"^0.1.8","@blockcerts/ecdsa-secp256k1-verification-key-2019":"^0.1.9","@adityaghag/explorer-lookup":"1.2.1","@blockcerts/hashlink-verifier":"^2.0.0","@blockcerts/schemas":"^3.9.0","@did-core/did-ld-json":"npm:@blockcerts/did-ld-json@^0.1.2","@digitalbazaar/data-integrity":"^2.1.0","@digitalbazaar/ecdsa-sd-2023-cryptosuite":"github:blockchain-certificates/ecdsa-sd-2023-cryptosuite#chore/secp256k1-with-multikey-fork","@digitalbazaar/ed25519-multikey":"^1.3.1","@digitalbazaar/ed25519-signature-2020":"^5.2.0","@digitalbazaar/ed25519-verification-key-2020":"^4.1.0","@digitalbazaar/eddsa-rdfc-2022-cryptosuite":"^1.2.0","@digitalbazaar/vc-revocation-list":"github:blockchain-certificates/vc-revocation-list#fix/memory-leak","@exodus/schemasafe":"^1.3.0","@transmute/did-key-ed25519":"^0.3.0-unstable.10","@transmute/did-key-secp256k1":"^0.3.0-unstable.10","@transmute/ed25519-key-pair":"^0.7.0-unstable.63","@trust/keyto":"^1.0.1","base64url-universal":"^2.0.0","bs58":"^6.0.0","buffer":"^6.0.3","jsonld":"^8.3.2","jsonld-checker":"npm:@blockcerts/jsonld-checker@^0.1.9","jsonld-signatures":"^11.5.0","@adityaghag/jsonld-signatures-merkleproof2019":"1.2.2","lodash.clonedeep":"^4.5.0","secp256k1":"^5.0.0","sha256":"^0.2.0"},"devDependencies":{"@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^19.2.2","@decentralized-identity/did-common-typescript":"^0.1.19","@eslint/js":"^9.24.0","@rollup/plugin-commonjs":"^28.0.0","@rollup/plugin-json":"^6.0.1","@rollup/plugin-multi-entry":"^6.0.1","@rollup/plugin-node-resolve":"^16.0.1","@rollup/plugin-typescript":"^12.1.2","@types/node":"^24.0.13","@types/sinon":"^17.0.1","@vitest/coverage-istanbul":"^3.1.1","body-parser":"^2.2.0","brfs":"^2.0.2","codecov":"^3.0.4","commitlint":"^19.8.0","crypto":"^1.0.1","dts-bundle-generator":"^9.0.0","eslint":"^9.24.0","express":"^5.1.0","husky":"^9.1.7","jasmine-core":"^5.1.0","jsdom":"^27.0.0","karma":"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","node-fetch":"^3.3.2","nodemon":"^3.1.9","rimraf":"^6.0.1","rollup":"^4.22.4","rollup-plugin-livereload":"^2.0.0","rollup-plugin-node-builtins":"^2.1.2","rollup-plugin-node-globals":"github:blockchain-certificates/rollup-plugin-node-globals","rollup-plugin-polyfill-node":"^0.13.0","rollup-plugin-serve":"^1.1.0","rollup-plugin-terser":"^7.0.0","rollup-plugin-visualizer":"^6.0.1","semantic-release":"^24.1.2","sinon":"^21.0.0","snazzy":"^9.0.0","ts-node":"^10.9.2","tslib":"^2.4.0","typescript":"^5.8.3","typescript-eslint":"^8.29.1","vitest":"^3.1.1","xmlhttprequest":"^1.8.0"},"_id":"@adityaghag/cert-verifier-js@1.2.1","gitHead":"5dca09072b36f5e603fda1aeb28de756b3650017","bugs":{"url":"https://github.com/adi-ghag/cert-verifier-js/issues"},"homepage":"https://github.com/adi-ghag/cert-verifier-js#readme","_nodeVersion":"22.13.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-krGCkc8UmRwK4cqeFLB446qnhjAndM7eVXCjuiP4Ni8gs9vAEOCLRTneKgGoqoV5sN2/hQe9zI780ChWqms10A==","shasum":"d52794a22ff2c2e37cf1f4e0309493672f94f7f3","tarball":"https://registry.npmjs.org/@adityaghag/cert-verifier-js/-/cert-verifier-js-1.2.1.tgz","fileCount":265,"unpackedSize":23063047,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDdanoayF7w8P5DspQ+y78c5hxMsfV90Kxiy/VcWdHy9gIgAV9e9qyy9KItO5IDcrjhtHjuu43iiA3JqqcHrY71c30="}]},"_npmUser":{"name":"adityaghag","email":"aditya.ghag94@gmail.com"},"directories":{},"maintainers":[{"name":"adityaghag","email":"aditya.ghag94@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cert-verifier-js_1.2.1_1760522342076_0.5701824377195328"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-15T08:02:04.099Z","modified":"2025-10-15T09:59:02.688Z","1.0.0":"2025-09-13T17:00:14.502Z","1.2.0":"2025-09-14T20:05:25.827Z","1.0.1":"2025-10-07T13:15:35.255Z","1.0.2":"2025-10-07T19:47:16.265Z","1.1.0":"2025-10-15T08:02:04.671Z","1.2.1":"2025-10-15T09:59:02.484Z"},"bugs":{"url":"https://github.com/adi-ghag/cert-verifier-js/issues"},"author":{"name":"Adi ghag"},"license":"MIT","homepage":"https://github.com/adi-ghag/cert-verifier-js#readme","repository":{"type":"git","url":"git+https://github.com/adi-ghag/cert-verifier-js.git"},"description":"Javascript library for verifying Blockcerts","maintainers":[{"name":"adityaghag","email":"aditya.ghag94@gmail.com"}],"readme":"[![Verifiable Credential V1 Compliance result](https://badgen.net/badge/Verifiable%20Credentials%20v1/compliant/green?icon=https://www.w3.org/Icons/WWW/w3c_home_nb-v.svg)](https://www.blockcerts.org/vc-compliance-report.html)\n[![Verifiable Credential V2 Compliance result](https://badgen.net/badge/Verifiable%20Credentials%20v2/compliant/green?icon=https://www.w3.org/Icons/WWW/w3c_home_nb-v.svg)](https://www.blockcerts.org/vc-v2-compliance-report.html)\n[![Data Integrity V1 Compliance result](https://badgen.net/badge/Data%20Integrity%20v1/compliant/green?icon=https://www.w3.org/Icons/WWW/w3c_home_nb-v.svg)](https://www.blockcerts.org/di-v1-compliance-report.html)\n[![codecov](https://codecov.io/gh/blockchain-certificates/cert-verifier-js/branch/master/graph/badge.svg)](https://codecov.io/gh/blockchain-certificates/cert-verifier-js)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n# @blockcerts/cert-verifier-js\n\nA library to parse and verify [Blockcerts](https://www.blockcerts.org/) certificates.\n\nIMPORTANT NOTE: as of version 5 of this library, v1 blockcerts are not supported anymore. Use https://www.npmjs.com/package/@blockcerts/cert-verifier-js-v1-legacy if needed.\n\n# Usage\n\n## Install\n\n```shell\n$ npm i @blockcerts/cert-verifier-js\n```\n\n## Import\n\n### From version 4\nInstantiation of the certificate now becomes asynchronous.\nWhile you would import the `Certificate` constructor and instantiate identically (see below), consumers now need to call the async function `init`. \n\nExample:\n```javascript\nimport { Certificate } from '@blockcerts/cert-verifier-js';\nlet certificate = new Certificate(certificateDefinition);\nawait certificate.init();\n```  \n\n\n#### Commonjs\nExposed by default:\n\n```javascript\nconst { Certificate } = require('@blockcerts/cert-verifier-js');\nvar certificate = new Certificate(certificateDefinition);\nawait certificate.init();\n```\n\n### Running in Nodejs\n```javascript\nconst { Certificate } = require('@blockcerts/cert-verifier-js/dist/verifier-node.js');\nvar certificate = new Certificate(certificateDefinition);\nawait certificate.init();\n```\n\n#### ES module\n```javascript\nimport { Certificate } from '@blockcerts/cert-verifier-js';\nlet certificate = new Certificate(certificateDefinition);\nawait certificate.init();\n```\n\n#### Script tag (iife)\n[Check an example here](https://github.com/blockchain-certificates/cert-verifier-js/blob/master/test/e2e/script-tag.html)\n```html\n<script src='node_modules/@blockcerts/cert-verifier-js/dist/verifier-iife.js'></script>\n<script>\n  var certificate = new Verifier.Certificate(certificateDefinition);\n  await certificate.init();\n</script>\n```\n\n## Examples\n\nYou can find more examples in the [test folder](./test/e2e/).\n\nIn the [manual testing folder](./test/manual-testing/) you will find examples of implementation both in nodejs and browser environments.\n\n### Discover version of a Blockcert Certificate without parsing it\n```\nimport { retrieveBlockcertsVersion } from '@blockcerts/cert-verifier-js';\nconst version = retrieveBlockcertsVersion(blockcertDocument['@context']);\n// return 1, 2 or 3 \n```\n\n### Parse a Blockcert certificate\n\n```javascript\nvar fs = require('fs');\n\nfs.readFile('./certificate.json', 'utf8', async function (err, data) {\n  if (err) {\n    console.log(err);\n  }\n\n  let certificate = new Certificate(data);\n  await certificate.init();\n  console.log(cert.name);\n});\n```\n\n### Verify a Blockcert certificate\n\n```javascript\nvar fs = require('fs');\n\nfs.readFile('./certificate.json', 'utf8', async function (err, data) {\n  if (err) {\n    console.log(err);\n  }\n\n  let certificate = new Certificate(data);\n  await certificate.init();\n  const verificationResult = await certificate.verify(({code, label, status, errorMessage}) => {\n    console.log('Code:', code, label, ' - Status:', status);\n    if (errorMessage) {\n      console.log(`The step ${code} fails with the error: ${errorMessage}`);\n    }\n  });\n\n  if (verificationResult.status === 'failure') {\n    console.log(`The certificate is not valid. Error: ${verificationResult.errorMessage}`);\n  }\n});\n```\n\n# API\n\n## `Certificate`\n\n### `new Certificate(certificateDefinition, options)`\n```javascript\nconst certificate = new Certificate(certificateDefinition);\n```\nThe constructor automatically parses a certificate. Call `certificate.init()` to handle initial required set up.\n\n#### Parameter\n- `certificateDefinition` (`String|Object`): the certificate definition. Can either be a string or a JSON object.\n- `options`: (`Object`): an object of options. The following properties are used:\n    - locale: (`String`): language code used to set the language used by the verifier. Default: `en-US`. If set to `auto` it will use the user's browser language if available, or default to `en-US`. See the [dedicated section](#i18n) for more information.\n    - explorerAPIs: (`[Object]`): As of v4.1.0 it is possible to provide a custom service API for the transaction explorer. This enables customers to select a potentially more reliable/private explorer to retrieve the blockchain transaction bound to a Blockcert. See the [dedicated section](#explorerAPIs) for more information.\n    - didResolverUrl: (`String`): pass this option to specify your own did resolver url. By default this library uses the DIF universal resolver which is not recommended for production use.\n\n#### Returns\nThe certificate instance has the following properties:\n- `certificateImage`: `String`. Raw data of the certificate image\n- `certificateJson`: `Object`. Certificate JSON object\n- `description`: `String`. Description of the certificate\n- `expires`: `String|null`. Expiration date\n- `id`: `String`. Certificate's ID\n- `isFormatValid`: `Boolean`. Indicates whether or not the certificate has a valid format\n- `issuedOn`: `String`. Datetime of issuance (ISO-8601)\n- `issuer`: `Object`. Certificate issuer\n- `locale`: `String`. Language code used by the verifier\n- `metadataJson`: `Object|null `. Certificate metadata object\n- `name`: `String`. Name of the certificate\n- `recipientFullName`: `String`. Full name of recipient\n- `recordLink`: `String`. Link to the certificate record\n- `revocationKey`: `String|null`. Revocation key (if any)\n- `sealImage`: `String`. Raw data of the seal's image;\n- `signature`: `String|null`. Certificate's signature\n- `signatureImage`: [`SignatureImage[]`][signatureLineModel]. Array of certificate [signature lines][signatureLineModel].\n- `signers`: Signers[]. An object which exposes some information related to the signature(s) of the Blockcerts. Contains:\n  * `chain`?: `IBlockchainObject`.\n  * `issuerName`?: `string`. Chain the signature was issued on\n  * `issuerProfileDomain`?: `string`.\n  * `issuerProfileUrl`?: `string`.\n  * `issuerPublicKey`: `string`. Current signer's public key.\n  * `rawTransactionLink`?: `string`. Link to raw transaction data (JSON)\n  * `signatureSuiteType`: `string`.\n  * `signingDate`: `string`.\n  * `transactionId`?: `string`.\n  * `transactionLink`?: `string`. Browser link to Transaction details\n- `subtitle`: `String|null`. Subtitle of the certificate\n- `version`: `CertificateVersion`. [Version of the certificate](https://github.com/blockchain-certificates/cert-verifier-js/blob/master/src/constants/certificateVersions.js)\n\n[signatureLineModel]: src/models/signatureImage.js\n\n### `verify(stepCallback)`\nThis will run the verification of a certificate. The function is asynchronous.\n\n```javascript\nconst certificateVerification = await certificate.verify(({code, label, status, errorMessage}) => {\n    console.log('Sub step update:', code, label, status);\n}));\nconsole.log(`Verification was a ${certificateVerification.status}:`, certificateVerification.message);\n```\n\n#### Parameters\n- `({code, label, status, errorMessage}) => {}` (`Function`): callback function called whenever a substep status has changed. The callback parameter has 4 properties:\n  - `code`: substep code\n  - `label`: readable label of the substep\n  - `status`: substep status (`success`, `failure`, `starting`)\n  - `errorMessage`: error message (optional)\n\n#### Returns\nThe final verification status:\n```javascript\n{ code, status, message }\n```\n- `code`: code of the final step (`final`)\n- `status`: final verification status (`success`, `failure`)\n- `message` string | Object: status message. It is internationalized and in case of failure it returns the error message of the failed step. When an object, it takes the following shape:\n  - `label`: Main label of the final step\n  - `description`: further details about the issuance\n  - `linkText`: translation provided for a link text towards the transaction\n\n**Note:** Exposes: `verificationSteps` is generated according to the nature of the certificate. The full steps array is provided ahead of verification in order to give more flexibility to the consumer. For example, you might want to pre-render the verification steps for animation, or render a count of steps and/or sub-steps.\n\n`VerificationStep` has the following shape:\n```javascript\n{\n    code: 'formatValidation',\n    label: 'Format validation',\n    labelPending: 'Validating format',\n    subSteps: [\n      {\n        code: 'getTransactionId',\n        label: 'Get transaction ID',\n        labelPending: 'Getting transaction ID',\n        parentStep: 'formatValidation'\n      },\n      ...\n    ]\n}\n```\n\nShape of the returned object can be checked here: https://github.com/blockchain-certificates/cert-verifier-js/blob/master/src/data/i18n.json#L41\n\n### Constants\nSeveral constants are being exposed:\n```javascript\nimport { BLOCKCHAINS, STEPS, CERTIFICATE_VERSIONS, VERIFICATION_STATUSES } from '@blockcerts/cert-verifier-js';\n```\n- [`BLOCKCHAINS`](https://github.com/blockchain-certificates/explorer-lookup/blob/master/src/constants/blockchains.ts): descriptive object of all blockchains supported by the library\n- [`STEPS`](https://github.com/blockchain-certificates/cert-verifier-js/blob/master/src/constants/verificationSteps.js): descriptive object of all verification steps (top level)\n- [`CERTIFICATE_VERSIONS`](https://github.com/blockchain-certificates/cert-verifier-js/blob/master/src/constants/certificateVersions.js): list of all certificate versions\n- [`VERIFICATION_STATUSES`](https://github.com/blockchain-certificates/cert-verifier-js/blob/master/src/constants/verificationStatuses.js)\n\n### i18n\nThe exposed function `getSupportedLanguages()` returns an array of language codes supported by the library.\n```javascript\nimport { getSupportedLanguages } from '@blockcerts/cert-verifier-js';\ngetSupportedLanguages(); // ['en-US', 'es-ES', 'mt', ...]\n```\nYou can use the codes for the `locale` option.\n\nPlease note that while we are working to add new languages, any new translation is welcome through forking & PR.\n\n## explorerAPIs\nAs of v4.1.0, customers of this library have the ability to provide a set of blockchain explorers that will be used to retrieve the transaction data used for storing a Blockerts on a blockchain, through the `explorerAPIs` option key.\n\nNOTE: With the addition of Typescript to this library, some types are now exposed for consumers.\n\nThe property is set as part of the `options` parameter of the `Certificate` constructor, as follows:\n\n```javascript\nconst certificate = new Certificate(definition, options);\n```\n\nThe expected shape of the object is as follows:\n```javascript\n  key?: string;\n  keyPropertyName?: string;\n  serviceName?: TRANSACTION_APIS; \n  serviceURL: string | ExplorerURLs;\n  priority: 0 | 1 | -1; // 0 means the custom API will be ran before the public APIs listed, 1 after, -1 is reserved for default explorers\n  parsingFunction: TExplorerParsingFunction;\n```\n\nMore information on each item:\n- `serviceName`: when a consumer wants to overwrite some information of the default explorer APIs provided (for instance provide their own keys to the service API), they should match the name of that API service with this property.\n- `key`: the explorer service API key value.\n- `keyPropertyName`: the expected parameter name to hold the key value. Depends on each service. (ie: Etherscan: \"apiKey\", etc). Required when a key is passed. \n- `serviceURL`: when set to `string` will be assumed to be set for the `mainnet` of the Blockchain.\nWhen set to an object, the customer will be able to provide a service url for the `mainnet` and for the `testnet` versions of the blockchain.\nThe object is then shaped as such:\n```javascript\n{\n  main: 'url',\n  test: 'url'\n}\n```\n\n- `priority`: this option allows the customer to decide if they wish to see their custom explorers to be executed before/after the default ones provided by the library (see the constants/api file for a list of default explorers). If the option is set to `0`, custom explorers will be called first. If set to `1` they   will be called after the default ones. `-1` value is reserved for default explorers.\n\n- `parsingFunction (response: Object, chain?: SupportedChains, key?: string, keyPropertyName?: string)`: this function is required to parse the data (server response) as returned from the API, into the `TransactionData` shape that will be used by the library.\nArguments:\n  - `response`: the response object as returned by the explorer service that was called.\n  - `chain`: (optional) the blockchain which to lookup. Mostly used to identify if it is a test chain or a main chain.\n  - `key`: (optional) when further calls need to be made to the same API, the API key is injected again to the parsing function for convenience.\n  - `keyPropertyName`: (optional) when further calls need to be made to the same API, the API key is injected again to the parsing function for reference.\nThe expected output shape is as follows:\n\n```\ninterface TransactionData {\n  remoteHash: string;\n  issuingAddress: string;\n  time: string | Date;\n  revokedAddresses: string[];\n}\n```\n\nThe consumer needs to write their own function for each service used.\n\n## Revocation\nThe `assertionId` is appended to the `revocationList` URL request as query parameter, to allow the filtering of the\n `revokedAssertions` by the provider: `{revocationList}?assertionId={assertionIdValue}` \n More details here [in this ticket](https://github.com/blockchain-certificates/cert-verifier-js/issues/715).\n\n## Contribute\n\n### Run the tests\n```shell\n$ npm run test\n```\n\n### Manual testing\nYou can test the build output (`npm run build`) in the browser and/or in nodejs to ensure you get satisfactory results with low overhead.\n\n#### Browser\nTo test the browser build simply run `npm run test:manual:browser`. This will open an HTML page if your default browser which will test the fixtures for each version.\n\nNOTE V1: At the time of writing this, it is expected that the v1 certificate will fail on retrieving the issuer profile due to a mixed content block from your browser.\nTo circumvent the issue you can either modify the v1 certificate to set the issuer profile to HTTPS. This means tempring with the certificate and will yield a hash mismatch error.\nYou may also change the settings of your browser to disable the Mixed Content Block filter. The certificate still does not validate since it's been revoked.\nWe are looking for a working v1 example.\n\nNOTE V3: The certificate does not validate as it's been revoked. This does still prove the code works.\n\n#### Nodejs\nTo test the node build you will first need to start the server:\n     `npm run test:manual:node:server`\n     \nThen in a separate console window run:\n    `npm run test:manual:node:verify`\n    \nNOTE V1: v1 validation does not go through as the issuer profile retrieval is denied. We are looking for a working v1 example.\nNOTE V3: The certificate does not validate as it's been revoked. This does still prove the code works.\n\n### Build\n```shell\n$ npm run build\n```\nThe build files are in the `dist` folder.\n\n## Verification process\nIf you want more details about the verification process, please check out the [documentation](https://github.com/blockchain-certificates/cert-verifier-js/blob/master/docs/verification-process.md).\n\n# Contact\n\nContact us at [the Blockcerts community forum](http://community.blockcerts.org/).\n","readmeFilename":"README.md"}