{"id":19122928,"url":"https://github.com/digitalbazaar/ed25519-verification-key-2018","last_synced_at":"2025-05-05T18:27:55.469Z","repository":{"id":38849092,"uuid":"262464475","full_name":"digitalbazaar/ed25519-verification-key-2018","owner":"digitalbazaar","description":"Javascript library for generating and working with Ed25519 key pairs, for use with crypto-ld.","archived":false,"fork":false,"pushed_at":"2022-08-25T18:50:35.000Z","size":100,"stargazers_count":5,"open_issues_count":1,"forks_count":4,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-10-28T14:55:25.085Z","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}},"created_at":"2020-05-09T01:35:45.000Z","updated_at":"2022-02-15T17:40:49.000Z","dependencies_parsed_at":"2022-09-18T13:02:23.429Z","dependency_job_id":null,"html_url":"https://github.com/digitalbazaar/ed25519-verification-key-2018","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fed25519-verification-key-2018","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fed25519-verification-key-2018/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fed25519-verification-key-2018/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fed25519-verification-key-2018/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalbazaar","download_url":"https://codeload.github.com/digitalbazaar/ed25519-verification-key-2018/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223788232,"owners_count":17202935,"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:38.919Z","updated_at":"2024-11-09T05:23:39.474Z","avatar_url":"https://github.com/digitalbazaar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ed25519VerificationKey2018 Key Pair Library for Linked Data _(@digitalbazaar/ed25519-verification-key-2018)_\n\n[![Node.js CI](https://github.com/digitalbazaar/ed25519-verification-key-2018/workflows/Node.js%20CI/badge.svg)](https://github.com/digitalbazaar/ed25519-verification-key-2018/actions?query=workflow%3A%22Node.js+CI%22)\n\n\u003e Javascript library for generating and working with Ed25519VerificationKey2018 key pairs, for use with crypto-ld.\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\nSee also (related specs):\n\n* [Linked Data Cryptographic Suite Registry](https://w3c-ccg.github.io/ld-cryptosuite-registry/)\n\n## Security\n\nAs with most security- and cryptography-related tools, the overall security of\nyour system will largely depend on your design decisions.\n\n## Install\n\n- Node.js 14+ is required.\n\nTo install locally (for development):\n\n```\ngit clone https://github.com/digitalbazaar/ed25519-verification-key-2018.git\ncd ed25519-verification-key-2018\nnpm install\n```\n\n## Usage\n\n### Generating a new public/private key pair\n\nTo generate a new public/private key pair:\n\n* `{string} [controller]` Optional controller URI or DID to initialize the\n  generated key. (This will also init the key id.) \n* `{string} [seed]` Optional deterministic seed value from which to generate the \n  key.\n\n```js\nimport {Ed25519VerificationKey2018} from '@digitalbazaar/ed25519-verification-key-2018';\n\nconst edKeyPair = await Ed25519VerificationKey2018.generate();\n```\n\n### Importing a key pair from storage\n\nTo create an instance of a public/private key pair from data imported from\nstorage, use `.from()`:\n\n```js\nconst serializedKeyPair = { ... };\n\nconst keyPair = await Ed25519VerificationKey2018.from(serializedKeyPair);\n```\n\nNote that only installed key types are supported, if you try to create a\nkey pair via `from()` for an unsupported type, an error will be thrown.\n\n### Exporting the public key only\n\nTo export just the public key of a pair:\n\n```js\nawait keyPair.export({publicKey: true});\n// -\u003e\n{ \n  id: 'did:ex:123#z6MkumafR1duPR5FZgbVu8nzX3VyhULoXNpq9rpjhfaiMQmx',\n  controller: 'did:ex:123',\n  type: 'Ed25519VerificationKey2018',\n  publicKeyBase58: 'GKKcpmPU3sanTBkoDZq9fwwysu4x7VaUTquosPchSBza'\n}\n*/\n```\n\n### Exporting the full public-private key pair\n\nTo export the full key pair, including private key (warning: this should be a\ncarefully considered operation, best left to dedicated Key Management Systems):\n\n```js\nawait keyPair.export({publicKey: true, privateKey: true});\n// -\u003e\n{\n  id: 'did:ex:123#z6Mks8wJbzhWdmkQZgw7z2qHwaxPVnFsFmEZSXzGkLkvhMvL',\n  controller: 'did:ex:123',\n  type: 'Ed25519VerificationKey2018',\n  publicKeyBase58: 'DggG1kT5JEFwTC6RJTsT6VQPgCz1qszCkX5Lv4nun98x',\n  privateKeyBase58: 'sSicNq6YBSzafzYDAcuduRmdHtnrZRJ7CbvjzdQhC45ewwvQeuqbM2dNwS9RCf6buUJGu6N3rBy6oLSpMwha8tc'\n}\n```\n\n### Generating and verifying key fingerprint\n\nTo generate a fingerprint:\n\n```js\nkeyPair.fingerprint();\n// -\u003e\n'z6Mks8wJbzhWdmkQZgw7z2qHwaxPVnFsFmEZSXzGkLkvhMvL'\n```\n\nTo verify a fingerprint:\n\n```js\nconst fingerprint = 'z6Mks8wJbzhWdmkQZgw7z2qHwaxPVnFsFmEZSXzGkLkvhMvL';\nkeyPair.verifyFingerprint({fingerprint});\n// -\u003e\n{ valid: true }\n```\n\n### Creating a signer function\n\nIn order to perform a cryptographic signature, you need to create a `sign`\nfunction, and then invoke it.\n\n```js\nconst keyPair = Ed25519VerificationKey2018.generate();\n\nconst {sign} = keyPair.signer();\n\nconst data = 'test data to sign';\nconst signatureValue = await sign({data});\n```\n\n### Creating a verifier function\n\nIn order to verify a cryptographic signature, you need to create a `verify`\nfunction, and then invoke it (passing it the data to verify, and the signature).\n\n```js\nconst keyPair = Ed25519VerificationKey2018.generate();\n\nconst {verify} = keyPair.verifier();\n\nconst {valid} = await verify({data, signature});\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalbazaar%2Fed25519-verification-key-2018","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalbazaar%2Fed25519-verification-key-2018","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalbazaar%2Fed25519-verification-key-2018/lists"}