{"id":19122937,"url":"https://github.com/digitalbazaar/vpqr","last_synced_at":"2025-05-05T18:27:42.004Z","repository":{"id":37829018,"uuid":"351152717","full_name":"digitalbazaar/vpqr","owner":"digitalbazaar","description":"Takes a Verifiable Presentation, compresses it via CBOR-LD, and turns it into a QR Code. For Node.js and browser.","archived":false,"fork":false,"pushed_at":"2025-04-24T18:44:13.000Z","size":79,"stargazers_count":8,"open_issues_count":4,"forks_count":2,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-24T18:52:53.420Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalbazaar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-24T16:38:32.000Z","updated_at":"2025-04-24T18:44:17.000Z","dependencies_parsed_at":"2024-06-19T05:15:29.325Z","dependency_job_id":"faad096b-2b6e-4bf4-af95-51ccb381b006","html_url":"https://github.com/digitalbazaar/vpqr","commit_stats":{"total_commits":79,"total_committers":4,"mean_commits":19.75,"dds":"0.45569620253164556","last_synced_commit":"1c0c79ae750f6462fc691818849bdfb595fe27e6"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fvpqr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fvpqr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fvpqr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fvpqr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalbazaar","download_url":"https://codeload.github.com/digitalbazaar/vpqr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252552365,"owners_count":21766681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T05:23:40.555Z","updated_at":"2025-05-05T18:27:41.961Z","avatar_url":"https://github.com/digitalbazaar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Verifiable Presentations to QR Code JS Lib _(@digitalbazaar/vpqr)_\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/digitalbazaar/vpqr/main.yml)](https://github.com/digitalbazaar/vpqr/actions/workflows/main.yml)\n[![Coverage Status](https://img.shields.io/codecov/c/github/digitalbazaar/vpqr)](https://codecov.io/gh/digitalbazaar/vpqr)\n[![NPM Version](https://img.shields.io/npm/v/@digitalbazaar/vpqr)](https://www.npmjs.com/package/@digitalbazaar/vpqr)\n\n\u003e An isomorphic JS (for Node.js and browser) library that takes a Verifiable Presentation, compresses it via CBOR-LD, and turns it into a QR Code.\n\n## Table of Contents\n\n- [Background](#background)\n- [Security](#security)\n- [Install](#install)\n- [Usage](#usage)\n- [Contribute](#contribute)\n- [Commercial Support](#commercial-support)\n- [License](#license)\n\n## Background\n\nTBD\n\n## Security\n\nTBD\n\n## Install\n\n- Browsers and Node.js 14+ are supported.\n\nTo install from NPM:\n\n```\nnpm install @digitalbazaar/vpqr\n```\n\nTo install locally (for development):\n\n```\ngit clone https://github.com/digitalbazaar/vpqr.git\ncd vpqr\nnpm install\n```\n\n## Usage\n\n### Encoding Verifiable Presentations as QR Code Images\n\n```js\nimport vpqr from '@digitalbazaar/vpqr';\n\nconst vp = {\n  \"@context\": \"https://www.w3.org/2018/credentials/v1\",\n  \"type\": \"VerifiablePresentation\",\n  \"verifiableCredential\": {\n    \"@context\": [\n      \"https://www.w3.org/2018/credentials/v1\",\n      \"https://w3id.org/cit/v1\",\n      \"https://w3id.org/security/suites/ed25519-2020/v1\"\n    ],\n    \"id\": \"urn:uuid:188e8450-269e-11eb-b545-d3692cf35398\",\n    \"type\": [\n      \"VerifiableCredential\",\n      \"ConcealedIdTokenCredential\"\n    ],\n    \"issuer\": \"did:key:z6Mku2yHBpMvm13KqtupN7MNEj7Y7AREUWsFfGBRhyP9YZf7\",\n    \"issuanceDate\": \"2021-03-24T20:03:03Z\",\n    \"expirationDate\": \"2021-06-24T20:03:03Z\",\n    \"credentialSubject\": {\n      \"concealedIdToken\": \"zo58FV8vqzY2ZqLT4fSaVhe7CsdBKsUikBMbKridqSyc7LceLmgWcNTeHm2gfvgjuNjrVif1G2A5EKx2eyNkSu5ZBc6gNnjF8ZkV3P8dPrX8o46SF\"\n    },\n    \"proof\": {\n      \"type\": \"Ed25519Signature2020\",\n      \"created\": \"2021-03-24T20:03:03Z\",\n      \"verificationMethod\": \"did:key:z6Mku2yHBpMvm13KqtupN7MNEj7Y7AREUWsFfGBRhyP9YZf7#z6Mku2yHBpMvm13KqtupN7MNEj7Y7AREUWsFfGBRhyP9YZf7\",\n      \"proofPurpose\": \"assertionMethod\",\n      \"proofValue\": \"z5Z33Pi9zWUWMHdxhG1Ko7ssgeHsuT3ocyg46pJTTjbwk1YjjtSCa4CQ5UyjnkQ6ar5ohY5Kv2mncWbfgEqWcVrTQ\"\n    }\n  }\n};\n\n// Set up your documentLoader\nconst documentLoader = {/*...*/};\nconst {imageDataUrl} = await vpqr.toQrCode({vp, documentLoader});\n// data:image/gif;base64,R0lGODdhqgCqAIAAAAAAAP///ywAAAAAqgCqAAAC/4yPqcvt...\n```\n\nWhen these QR Codes are scanned, they are read as Alphanumeric mode text,\n\n```\nVP1-R3ECQDIYBCEMDGEAYG2UADAYRCV4DA2DUORYHGOR...\n```\n\nin the format:\n\n```\n\u003cformat and version, 'VP1-'\u003e\u003cmultibase prefix, 'R'\u003e\u003cbase45 RFC9285 encoded CBOR-LD\u003e\n```\n\n### Decoding QR Code Text to Verifiable Presentation\n\n```js\n// Alphanumeric text from a QR Code Reader lib\nconst qrCodeText = 'VP1-R3ECQDIYBCEMDGEAYG2UADAYRCV4DA2DUORYHGOR...';\n\n// Set up your documentLoader\nconst documentLoader = {/*...*/};\n\nconst {vp} = await vqpr.fromQrCode({text: qrCodeText, documentLoader});\n// { \"@context\": \"https://www.w3.org/2018/credentials/v1\", ... }\n// becomes a JSON object with the VP in the example above.\n```\n\n### Encoding Options\n\n- `qrMultibaseEncoding`: Encoding for QR data. `B` for [RFC4648][] base32, `R`\n  for [RFC9285][] base45. base45 is more efficient. Defaults to base45.\n- `qrErrorCorrectionLevel`: Error correction level used in the QR code. 'L' Low\n  7%, 'M' Medium 15%, 'Q' Qartile 25%, 'H' High 30%. Defaults to 'L'.\n- `qrVersion`: QR version. 1-40 or 0 for auto. Defaults to auto.\n\n### Advanced Options\n\nMore advanced use cases can use extra options and the lower level APIs in\n`util`:\n- Encode and decode Verifiable Credentials.\n- Use custome encoding headers like `VP1-` and `VC1-`.\n- Access other related outputs.\n- Use options to control the output module size (the pixel size of the small\n  squares) and image quiet zone margin size.\n- Control QR options such as error correction level.\n- Provide a diagnostics function.\n- Pass in legacy `cborld` `appContextMap` or modern `registryEntryId`,\n  `typeTable`, and `typeTableLoader` options.\n\n```js\nimport {util} from '@digitalbazaar/vpqr';\n\nconst {toQrCode} = util;\n\n// setup options as needed\n\n// encode QR code\nconst {\n  version, payload, imageDataUrl, encodedCborld, rawCborldBytes\n} = await toQrCode({\n  header: 'VC1-',\n  jsondldDocument: verifiableCredential,\n  documentLoader,\n  registryEntryId: 2000,\n  typeTableLoader,\n  moduleSize: 4,\n  margin: 16,\n  qrErrorCorrectionLevel: 'H'\n});\n\n// decode QR code text\nconst {\n  jsondldDocument\n} = await fromQrCode({\n  expectedHeader = 'VC1-',\n  text,\n  decodeCborld: true,\n  documentLoader,\n  typeTableLoader\n});\n```\n\n## Contribute\n\nSee [the contribute file](https://github.com/digitalbazaar/bedrock/blob/master/CONTRIBUTING.md)!\n\nPRs accepted.\n\nIf editing the Readme, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## Commercial Support\n\nCommercial support for this library is available upon request from\nDigital Bazaar: support@digitalbazaar.com\n\n## License\n\n[New BSD License (3-clause)](LICENSE) © Digital Bazaar\n\n[RFC4648]: https://datatracker.ietf.org/doc/rfc4648/\n[RFC9285]: https://datatracker.ietf.org/doc/rfc9285/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalbazaar%2Fvpqr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalbazaar%2Fvpqr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalbazaar%2Fvpqr/lists"}