{"id":16718216,"url":"https://github.com/allouis/lamport-ots","last_synced_at":"2025-04-05T05:15:18.515Z","repository":{"id":33397818,"uuid":"157975430","full_name":"allouis/lamport-ots","owner":"allouis","description":"🔏  Lamport One-Time Signatures in JavaScript 🔏","archived":false,"fork":false,"pushed_at":"2022-02-11T12:52:33.000Z","size":211,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T13:13:19.882Z","etag":null,"topics":["cryptography","lamport","ots","signature"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allouis.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-11-17T10:53:50.000Z","updated_at":"2024-06-20T03:24:23.000Z","dependencies_parsed_at":"2022-08-07T21:15:14.467Z","dependency_job_id":null,"html_url":"https://github.com/allouis/lamport-ots","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allouis%2Flamport-ots","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allouis%2Flamport-ots/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allouis%2Flamport-ots/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allouis%2Flamport-ots/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allouis","download_url":"https://codeload.github.com/allouis/lamport-ots/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289431,"owners_count":20914464,"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":["cryptography","lamport","ots","signature"],"created_at":"2024-10-12T21:35:43.839Z","updated_at":"2025-04-05T05:15:18.495Z","avatar_url":"https://github.com/allouis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔏 Lamport One-Time Signatures 🔏\n\nLamport one-time signature scheme is a simple but effective mechanism for creating signatures built on top of hash functions.\nAny cryptograph hash function can be used to implement the scheme.\nSignatures using large hash functions are understood so far to be \"quantum resistant\"\n\n## ⚠ Warning ⚠\n\nThe lamport one-time signature scheme uses 50% of your **private** key as the signature, this is why they are for one time use only.\n\nDo not use a single private key to sign more than once piece of data.\n\n## Installation\n\n### With `npm`\n\n```shell\nnpm install --save lamport-ots\n```\n\n### With `yarn`\n\n```shell\nyarn add lamport-ots\n```\n\n## Usage\n\n### Basic usage with `SHA256` hash function\n\n```javascript\nconst lamportSHA256 = require('lamport')\n\nconst { publicKey, privateKey } = lamportSHA256.keys()\n\nconst message = 'Hello, world!'\nconst signature = lamportSHA256.sign(message, privateKey)\n\n// elsewhere...\n\nif (lamportSHA256.verify(message, signature, publicKey)) {\n  // Authenticity of message confirmed\n} else {\n  // Falsified signature, or tampered message\n}\n```\n\n### With a custom hash function\n\n```javascript\nconst lamport = require('lamport')\n\nconst lamportSomeHash = lamport(function (stringOrBuffer) {\n  return someHashFrom(stringOrBuffer)\n})\n\nconst { publicKey, privateKey } = lamportSomeHash.keys()\n\nconst message = 'Hello, world!'\nconst signature = lamportSomeHash.sign(message, privateKey)\n\n// elsewhere...\n\nif (lamportSomeHash.verify(message, signature, publicKey)) {\n  // Authenticity of message confirmed\n} else {\n  // Falsified signature, or tampered message\n}\n```\n\n## API\n\n### `lamport(hash)`\n\n`hash` must be a function that accepts either a String or a Buffer, and returns a Buffer of fixed length.\n\nReturns a lamport \"instance\" with the following methods\n\n  - `keys()`\n  - `sign(message, privateKey)`\n  - `verify(message, signature, publicKey)`\n\n#### `lamport(hash).keys`\n\nReturns an Object with a `publicKey` and `privateKey` property.\n\n#### `lamport(hash).sign(message, privateKey)`\n\n`message` must be either a String or a Buffer\n\n`privateKey` should be a privateKey returned from keys that **hasn't** been used before.\n\nReturns a Buffer representing the signature\n\n#### `lamport(hash).verify(message, signature, publicKey`\n\n`message` must be either a String or a Buffer\n\n`signature` must be a Buffer\n\n`publicKey` should be a publicKey returned from `keys()`\n\nReturns a Boolean representing the validity of the signature\n\n#### `lamport.keys`\n#### `lamport.sign`\n#### `lamport.verify`\n\nThe module exposes a lamport \"instance\" created with the sha256 hash function, which you can use directly.\n\n## Contributing\n\nContributions are welcome from *anyone* and _everyone_ and the collaboration model used is the [Collective Code Construction Contract](https://rfc.zeromq.org/spec:42/C4/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallouis%2Flamport-ots","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallouis%2Flamport-ots","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallouis%2Flamport-ots/lists"}