{"id":13612879,"url":"https://github.com/mattrglobal/node-bbs-signatures","last_synced_at":"2025-04-13T15:32:07.081Z","repository":{"id":36973447,"uuid":"252275916","full_name":"mattrglobal/node-bbs-signatures","owner":"mattrglobal","description":"An implementation of BBS+ signatures using rust and typescript for node.js","archived":false,"fork":false,"pushed_at":"2024-09-16T20:58:24.000Z","size":1295,"stargazers_count":58,"open_issues_count":4,"forks_count":26,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-09-17T02:51:44.093Z","etag":null,"topics":["assurance","cryptography","digital-signature","nucleus","zero-knowledge-proofs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattrglobal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-01T20:08:28.000Z","updated_at":"2024-09-16T20:57:36.000Z","dependencies_parsed_at":"2023-01-17T10:16:16.344Z","dependency_job_id":"728714de-ac44-4bf1-9cc4-12518e524f74","html_url":"https://github.com/mattrglobal/node-bbs-signatures","commit_stats":{"total_commits":163,"total_committers":20,"mean_commits":8.15,"dds":"0.35582822085889576","last_synced_commit":"4880c0eba32f932124450ac6c4acb637428110c3"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattrglobal%2Fnode-bbs-signatures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattrglobal%2Fnode-bbs-signatures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattrglobal%2Fnode-bbs-signatures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattrglobal%2Fnode-bbs-signatures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattrglobal","download_url":"https://codeload.github.com/mattrglobal/node-bbs-signatures/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223592316,"owners_count":17170475,"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":["assurance","cryptography","digital-signature","nucleus","zero-knowledge-proofs"],"created_at":"2024-08-01T20:00:35.837Z","updated_at":"2025-04-13T15:32:07.074Z","avatar_url":"https://github.com/mattrglobal.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Libraries"],"sub_categories":["Wrapped library"],"readme":"[![MATTR](./docs/assets/mattr-logo-square.svg)](https://github.com/mattrglobal)\n\n## Deprecation Notice\n\nThis library has been deprecated in favor of the [Pairing Cryptography](https://github.com/mattrglobal/pairing_crypto)\nlibrary which implements the more modern\n[BBS Signature Scheme](https://datatracker.ietf.org/doc/draft-irtf-cfrg-bbs-signatures/).\n\nWe recommend using the [WASM wrapper](https://github.com/mattrglobal/pairing_crypto/tree/master/wrappers/wasm). There is\nno direct replacement.\n\n# Node BBS Signatures\n\n![npm-version](https://badgen.net/npm/v/@mattrglobal/node-bbs-signatures)\n![npm-unstable-version](https://badgen.net/npm/v/@mattrglobal/node-bbs-signatures/unstable)\n![Master](https://github.com/mattrglobal/node-bbs-signatures/workflows/push-master/badge.svg)\n![Release](https://github.com/mattrglobal/node-bbs-signatures/workflows/push-release/badge.svg)\n![codecov](https://codecov.io/gh/mattrglobal/node-bbs-signatures/branch/master/graph/badge.svg)\n\nThis repository is the home to a performant multi-message digital signature algorithm implementation which supports\nderiving zero knowledge proofs that enable selective disclosure from the originally signed message set.\n\n[BBS+ Signatures](https://github.com/mattrglobal/bbs-signatures) are a digital signature algorithm originally born from\nthe work on [Short group signatures](https://crypto.stanford.edu/~xb/crypto04a/groupsigs.pdf) by Boneh, Boyen, and\nShachum which was later improved on in\n[Constant-Size Dynamic k-TAA](http://web.cs.iastate.edu/~wzhang/teach-552/ReadingList/552-14.pdf) as BBS+ and touched on\nagain in section 4.3 in\n[Anonymous Attestation Using the Strong Diffie Hellman Assumption Revisited ](https://www.researchgate.net/publication/306347781_Anonymous_Attestation_Using_the_Strong_Diffie_Hellman_Assumption_Revisited).\n\n[BBS+ Signatures](https://github.com/mattrglobal/bbs-signatures) require a\n[pairing-friendly curve](https://tools.ietf.org/html/draft-irtf-cfrg-pairing-friendly-curves-03), this library includes\nsupport for [BLS12-381](https://tools.ietf.org/html/draft-irtf-cfrg-pairing-friendly-curves-03#section-2.4).\n\n[BBS+ Signatures](https://github.com/mattrglobal/bbs-signatures) allow for multi-message signing whilst producing a\nsingle output signature. With a BBS signature, a [proof of knowledge](https://en.wikipedia.org/wiki/Proof_of_knowledge)\nbased proof can be produced where only some of the originally signed messages are revealed at the discretion of the\nprover.\n\n## Getting started\n\nTo use this package within your project simply run\n\n```\nnpm install @mattrglobal/node-bbs-signatures\n```\n\nOr with [Yarn](https://yarnpkg.com/)\n\n```\nyarn add @mattrglobal/node-bbs-signatures\n```\n\n## Usage\n\nSee the [sample](./sample) directory for a runnable demo.\n\nThe following is a short sample on how to use the API\n\n```typescript\nimport {\n  generateBls12381G2KeyPair,\n  blsSign,\n  blsVerify,\n  blsCreateProof,\n  blsVerifyProof,\n} from \"@mattrglobal/node-bbs-signatures\";\n\n//Generate a new key pair\nconst keyPair = await generateBls12381G2KeyPair();\n\n//Set of messages we wish to sign\nconst messages = [Uint8Array.from(Buffer.from(\"message1\", \"utf-8\")), Uint8Array.from(Buffer.from(\"message2\", \"utf-8\"))];\n\n//Create the signature\nconst signature = await blsSign({\n  keyPair,\n  messages: messages,\n});\n\n//Verify the signature\nconst isVerified = await blsVerify({\n  publicKey: keyPair.publicKey,\n  messages: messages,\n  signature,\n});\n\n//Derive a proof from the signature revealing the first message\nconst proof = await blsCreateProof({\n  signature,\n  publicKey: keyPair.publicKey,\n  messages,\n  nonce: Uint8Array.from(Buffer.from(\"nonce\", \"utf8\")),\n  revealed: [0],\n});\n\n//Verify the created proof\nconst isProofVerified = await blsVerifyProof({\n  proof,\n  publicKey: keyPair.publicKey,\n  messages: messages.slice(0, 1),\n  nonce: Uint8Array.from(Buffer.from(\"nonce\", \"utf8\")),\n});\n```\n\n## Element Size\n\nWithin a digital signature there are several elements for which it is useful to know the size, the following table\noutlines the general equation for calculating element sizes in relation to BBS+ signatures as it is dependent on the\npairing friendly curve used.\n\n| Element     | Size Equation                        |\n| ----------- | ------------------------------------ |\n| Private Key | F                                    |\n| Public Key  | G2                                   |\n| Signature   | G1 + 2\\*F                            |\n| Proof       | 5*G1 + (4 + no_of_hidden_messages)*F |\n\n- `F` A field element\n- `G1` A point in the field of G1\n- `G2` A point in the field of G2\n- `no_of_hidden_messages` The number of the hidden messages\n\nThis library includes specific support for BLS12-381 keys with BBS+ signatures and hence gives rise to the following\nconcrete sizes\n\n| Element     | Size with BLS12-381                     |\n| ----------- | --------------------------------------- |\n| Private Key | 32 Bytes                                |\n| Public Key  | 96 Bytes                                |\n| Signature   | 112 Bytes                               |\n| Proof       | 368 + (no_of_hidden_messages)\\*32 Bytes |\n\n## Getting started as a contributor\n\nThe following describes how to get started as a contributor to this project\n\n### Prerequisites\n\nThe following is a list of dependencies you must install to build and contribute to this project\n\n- [Yarn](https://yarnpkg.com/)\n- [Rust](https://www.rust-lang.org/)\n\nFor more details see our [contribution guidelines](./docs/CONTRIBUTING.md)\n\n#### Install\n\nTo install the package dependencies run:\n\n```\nyarn install --frozen-lockfile\n```\n\n#### Build\n\nTo build the project run:\n\n```\nyarn build\n```\n\n#### Test\n\nTo run the test in the project run:\n\n```\nyarn test\n```\n\n#### Benchmark\n\nTo benchmark the implementation locally run:\n\n```\nyarn benchmark\n```\n\n## Dependencies\n\nThis library uses the [bbs](https://crates.io/crates/bbs) rust crate for the implementation of BBS+ signatures and\nBLS12-381 which is then wrapped and exposed in javascript/typescript using\n[neon-bindings](https://github.com/neon-bindings/neon).\n\n## Security Policy\n\nPlease see our [security policy](./SECURITY.md) for additional details about responsible disclosure of security related\nissues.\n\n---\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://mattr.global\" target=\"_blank\"\u003e\u003cimg height=\"40px\" src =\"./docs/assets/mattr-logo-tm.svg\"\u003e\u003c/a\u003e\u003c/p\u003e\u003cp align=\"center\"\u003eCopyright © MATTR Limited. \u003ca href=\"./LICENSE\"\u003eSome rights reserved.\u003c/a\u003e\u003cbr/\u003e“MATTR” is a trademark of MATTR Limited, registered in New Zealand and other countries.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattrglobal%2Fnode-bbs-signatures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattrglobal%2Fnode-bbs-signatures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattrglobal%2Fnode-bbs-signatures/lists"}