{"id":19123279,"url":"https://github.com/digitalbazaar/data-integrity","last_synced_at":"2025-05-05T18:33:34.635Z","repository":{"id":58893169,"uuid":"533964770","full_name":"digitalbazaar/data-integrity","owner":"digitalbazaar","description":"Data Integrity Proof library for use with jsonld-signatures.","archived":false,"fork":false,"pushed_at":"2024-09-06T19:50:14.000Z","size":110,"stargazers_count":2,"open_issues_count":14,"forks_count":2,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-16T04:47:44.176Z","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":"2022-09-07T22:37:00.000Z","updated_at":"2024-09-06T19:50:18.000Z","dependencies_parsed_at":"2024-06-21T02:29:25.175Z","dependency_job_id":null,"html_url":"https://github.com/digitalbazaar/data-integrity","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.2142857142857143,"last_synced_commit":"010893f9c929f9d10361cdf0b6049e8fcd498f83"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fdata-integrity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fdata-integrity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fdata-integrity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fdata-integrity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalbazaar","download_url":"https://codeload.github.com/digitalbazaar/data-integrity/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252553087,"owners_count":21766825,"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:24:58.087Z","updated_at":"2025-05-05T18:33:34.611Z","avatar_url":"https://github.com/digitalbazaar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data Integrity library _(@digitalbazaar/data-integrity)_\n\n[![Build status](https://img.shields.io/github/actions/workflow/status/digitalbazaar/data-integrity/main.yml)](https://github.com/digitalbazaar/data-integrity/actions?query=workflow%3A%22Node.js+CI%22)\n[![Coverage status](https://img.shields.io/codecov/c/github/digitalbazaar/data-integrity)](https://codecov.io/gh/digitalbazaar/data-integrity)\n[![NPM Version](https://img.shields.io/npm/v/@digitalbazaar/data-integrity.svg)](https://npm.im/@digitalbazaar/data-integrity)\n\n\u003e DataIntegrity library for use with cryptosuites and jsonld-signatures.\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\nFor use with https://github.com/digitalbazaar/jsonld-signatures v11.0 and above.\n\nSee also related specs:\n\n* [Verifiable Credential Data Integrity](https://w3c.github.io/vc-data-integrity/)\n\n## Security\n\nTBD\n\n## Install\n\n- Browsers and Node.js 18+ are supported.\n\nTo install from NPM:\n\n```\nnpm install @digitalbazaar/data-integrity\n```\n\nTo install locally (for development):\n\n```\ngit clone https://github.com/digitalbazaar/data-integrity.git\ncd data-integrity\nnpm install\n```\n\n## Usage\n\nThe following code snippet provides a complete example of digitally signing\na verifiable credential using this library:\n\n```javascript\nimport * as Ed25519Multikey from '@digitalbazaar/ed25519-multikey';\nimport {DataIntegrityProof} from '@digitalbazaar/data-integrity';\nimport {cryptosuite as eddsa2022CryptoSuite} from\n  '@digitalbazaar/eddsa-2022-cryptosuite';\nimport jsigs from 'jsonld-signatures';\nconst {purposes: {AssertionProofPurpose}} = jsigs;\n\n\n// create the unsigned credential\nconst unsignedCredential = {\n  '@context': [\n    'https://www.w3.org/2018/credentials/v1',\n    {\n      AlumniCredential: 'https://schema.org#AlumniCredential',\n      alumniOf: 'https://schema.org#alumniOf'\n    }\n  ],\n  id: 'http://example.edu/credentials/1872',\n  type: [ 'VerifiableCredential', 'AlumniCredential' ],\n  issuer: 'https://example.edu/issuers/565049',\n  issuanceDate: '2010-01-01T19:23:24Z',\n  credentialSubject: {\n    id: 'https://example.edu/students/alice',\n    alumniOf: 'Example University'\n  }\n};\n\n// create the keypair to use when signing\nconst controller = 'https://example.edu/issuers/565049';\nconst keyPair = await Ed25519Multikey.from({\n  '@context': 'https://w3id.org/security/multikey/v1',\n  type: 'Multikey',\n  controller,\n  id: controller + '#z6MkwXG2WjeQnNxSoynSGYU8V9j3QzP3JSqhdmkHc6SaVWoT',\n  publicKeyMultibase: 'z6MkwXG2WjeQnNxSoynSGYU8V9j3QzP3JSqhdmkHc6SaVWoT',\n  secretKeyMultibase: 'zrv3rbPamVDGvrm7LkYPLWYJ35P9audujKKsWn3x29EUiGwwhdZQd' +\n    '1iHhrsmZidtVALBQmhX3j9E5Fvx6Kr29DPt6LH'\n});\n\n// export public key and add to document loader\nconst publicKey = await keyPair.export({publicKey: true, includeContext: true});\naddDocumentToLoader({url: publicKey.id, document: publicKey});\n\n// create key's controller document\nconst controllerDoc = {\n  '@context': [\n    'https://www.w3.org/ns/did/v1',\n    'https://w3id.org/security/multikey/v1'\n  ],\n  id: controller,\n  assertionMethod: [publicKey]\n};\naddDocumentToLoader({url: controllerDoc.id, document: controllerDoc});\n\n// create suite\nconst suite = new DataIntegrityProof({\n  signer: keyPair.signer(), cryptosuite: eddsa2022CryptoSuite\n});\n\n// create signed credential\nconst signedCredential = await jsigs.sign(unsignedCredential, {\n  suite,\n  purpose: new AssertionProofPurpose(),\n  documentLoader\n});\n\n// results in the following signed VC\n{\n  \"@context\": [\n    \"https://www.w3.org/2018/credentials/v1\",\n    {\n      \"AlumniCredential\": \"https://schema.org#AlumniCredential\",\n      \"alumniOf\": \"https://schema.org#alumniOf\"\n    },\n    \"https://w3id.org/security/data-integrity/v2\"\n  ],\n  \"id\": \"http://example.edu/credentials/1872\",\n  \"type\": [\n    \"VerifiableCredential\",\n    \"AlumniCredential\"\n  ],\n  \"issuer\": \"https://example.edu/issuers/565049\",\n  \"issuanceDate\": \"2010-01-01T19:23:24Z\",\n  \"credentialSubject\": {\n    \"id\": \"https://example.edu/students/alice\",\n    \"alumniOf\": \"Example University\"\n  },\n  \"proof\": {\n    \"type\": \"DataIntegrityProof\",\n    \"created\": \"2022-09-06T21:29:24Z\",\n    \"verificationMethod\": \"https://example.edu/issuers/565049#z6MkwXG2WjeQnNxSoynSGYU8V9j3QzP3JSqhdmkHc6SaVWoT\",\n    \"cryptosuite\": \"eddsa-2022\",\n    \"proofPurpose\": \"assertionMethod\",\n    \"proofValue\": \"zakT6XP6P7ZVAGJKjvnVi1YjC96RufyeasEEMkDQrCkvMnG3QeAqBuoVoWAWkEEd5w8FATEigPA5788ByuwnCZrd\"\n  }\n}\n```\n\nNote: To create or verify proofs using legacy draft data integrity suites, you\nmust pass `legacyContext: true` when creating a `DataIntegrityProof` instance;\nthis will cause the appropriate legacy data integrity context (\nhttps://w3id.org/security/data-integrity/v1) to be used.\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) © 2022 Digital Bazaar\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalbazaar%2Fdata-integrity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalbazaar%2Fdata-integrity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalbazaar%2Fdata-integrity/lists"}