{"versions":{"0.0.4":{"name":"curve25519-js","version":"0.0.4","description":"Javascript implementation of Curve25519","main":"lib/index.js","scripts":{"build":"tsc","format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"tslint -p tsconfig.json"},"repository":{"type":"git","url":"git+https://github.com/harveyconnor/curve25519-js.git"},"author":{"name":"Harvey Connor","email":"harvey@smartguide.com.au"},"license":"MIT","bugs":{"url":"https://github.com/harveyconnor/curve25519-js/issues"},"homepage":"https://github.com/harveyconnor/curve25519-js#readme","keywords":["sign","curve25519","x25519","ed25519"],"devDependencies":{"@types/node":"^12.6.9","prettier":"^1.18.2","tslint":"^5.18.0","tslint-config-prettier":"^1.18.0","typescript":"^3.5.3"},"gitHead":"3bda844715120ae42b5da0d9002c1a9d2dd10fc7","_id":"curve25519-js@0.0.4","_nodeVersion":"10.15.0","_npmVersion":"6.10.2","dist":{"shasum":"e6ad967e8cd284590d657bbfc90d8b50e49ba060","size":11968,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/curve25519-js/-/curve25519-js-0.0.4.tgz","integrity":"sha512-axn2UMEnkhyDUPWOwVKBMVIzSQy2ejH2xRGy1wq81dqRwApXfIzfbE3hIX0ZRFBIihf/KDqK158DLwESu4AK1w=="},"maintainers":[{"name":"anonymous","email":"harveyconnor97@gmail.com"}],"_npmUser":{"name":"anonymous","email":"harveyconnor97@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/curve25519-js_0.0.4_1564725452966_0.4753635693922946"},"_hasShrinkwrap":false,"publish_time":1564725453151,"_cnpm_publish_time":1564725453151,"_cnpmcore_publish_time":"2021-12-16T16:08:24.950Z","contributors":[]},"0.0.3":{"name":"curve25519-js","version":"0.0.3","description":"Javascript implementation of Curve25519","main":"lib/index.js","scripts":{"build":"tsc","format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"tslint -p tsconfig.json"},"repository":{"type":"git","url":"git+https://github.com/harveyconnor/curve25519-js.git"},"author":{"name":"Harvey Connor","email":"harvey@smartguide.com.au"},"license":"MIT","bugs":{"url":"https://github.com/harveyconnor/curve25519-js/issues"},"homepage":"https://github.com/harveyconnor/curve25519-js#readme","keywords":["sign","curve25519","x25519","ed25519"],"devDependencies":{"@types/node":"^12.6.9","prettier":"^1.18.2","tslint":"^5.18.0","tslint-config-prettier":"^1.18.0","typescript":"^3.5.3"},"gitHead":"4d151eb99a4e95dfd0244df5b6cc20a30c7c5c2e","_id":"curve25519-js@0.0.3","_nodeVersion":"10.15.0","_npmVersion":"6.10.2","dist":{"shasum":"f74234536db9d28107fe8fe9d075850875b642d3","size":11963,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/curve25519-js/-/curve25519-js-0.0.3.tgz","integrity":"sha512-tLkLG5kPXNTRfFZIM7WI5QKLkQkemVDKRfqkMvKI0NHpJZlds7okQT83v9Vs9Z31csaMssY6uLjU5ht2XfCqNQ=="},"maintainers":[{"name":"anonymous","email":"harveyconnor97@gmail.com"}],"_npmUser":{"name":"anonymous","email":"harveyconnor97@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/curve25519-js_0.0.3_1564722695036_0.14037915345678487"},"_hasShrinkwrap":false,"publish_time":1564722695240,"_cnpm_publish_time":1564722695240,"_cnpmcore_publish_time":"2021-12-16T16:08:25.189Z","contributors":[]},"0.0.2":{"name":"curve25519-js","version":"0.0.2","description":"Javascript implementation of Curve25519","main":"lib/index.js","scripts":{"build":"tsc","format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"tslint -p tsconfig.json"},"repository":{"type":"git","url":"git+https://github.com/harveyconnor/curve25519-js.git"},"author":{"name":"Harvey Connor","email":"harvey@smartguide.com.au"},"license":"MIT","bugs":{"url":"https://github.com/harveyconnor/curve25519-js/issues"},"homepage":"https://github.com/harveyconnor/curve25519-js#readme","keywords":["sign","curve25519","x25519","ed25519"],"devDependencies":{"@types/node":"^12.6.9","prettier":"^1.18.2","tslint":"^5.18.0","tslint-config-prettier":"^1.18.0","typescript":"^3.5.3"},"gitHead":"c983325fd5e01042b0ded5458a74b6af77ac1d77","_id":"curve25519-js@0.0.2","_nodeVersion":"10.15.0","_npmVersion":"6.10.2","dist":{"shasum":"3f73aef7a92c318edcc6f2d6557dea54b0735bfd","size":11965,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/curve25519-js/-/curve25519-js-0.0.2.tgz","integrity":"sha512-KnJXQ1rJJBmKK1tdp+CrtQxLLLKTBSz1P5JRdPHPJQCFnhBOY8fJ8PyPpppZ2d7Gh9HHswKVWMU4+9/jU4DfcQ=="},"maintainers":[{"name":"anonymous","email":"harveyconnor97@gmail.com"}],"_npmUser":{"name":"anonymous","email":"harveyconnor97@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/curve25519-js_0.0.2_1564722226866_0.26245364443928376"},"_hasShrinkwrap":false,"publish_time":1564722227052,"_cnpm_publish_time":1564722227052,"_cnpmcore_publish_time":"2021-12-16T16:08:25.435Z","contributors":[]},"0.0.1":{"name":"curve25519-js","version":"0.0.1","description":"Javascript implementation of Curve25519","main":"lib/index.js","scripts":{"build":"tsc","format":"prettier --write \"src/**/*.ts\" \"src/**/*.js\"","lint":"tslint -p tsconfig.json"},"repository":{"type":"git","url":"git+https://github.com/harveyconnor/curve25519-js.git"},"author":{"name":"Harvey Connor","email":"harvey@smartguide.com.au"},"license":"MIT","bugs":{"url":"https://github.com/harveyconnor/curve25519-js/issues"},"homepage":"https://github.com/harveyconnor/curve25519-js#readme","keywords":["sign","curve25519","x25519","ed25519"],"devDependencies":{"@types/node":"^12.6.9","prettier":"^1.18.2","tslint":"^5.18.0","tslint-config-prettier":"^1.18.0","typescript":"^3.5.3"},"gitHead":"657c5130364662fb12c3f6de962f0b13dfa94d1c","_id":"curve25519-js@0.0.1","_nodeVersion":"10.15.0","_npmVersion":"6.10.2","dist":{"shasum":"db5b744387e05293ac72bdf8f93abed5ea10faff","size":11965,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/curve25519-js/-/curve25519-js-0.0.1.tgz","integrity":"sha512-VDj+EQQP5paFZGTGrjmtEQ4gPxf+eovk4vZOlmFpvxwZ9EZM25LNNdIe1aXy9aCBU7lctbrsv2JBKdWfivO7Jw=="},"maintainers":[{"name":"anonymous","email":"harveyconnor97@gmail.com"}],"_npmUser":{"name":"anonymous","email":"harveyconnor97@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/curve25519-js_0.0.1_1564721434656_0.13302293645061924"},"_hasShrinkwrap":false,"publish_time":1564721434825,"_cnpm_publish_time":1564721434825,"_cnpmcore_publish_time":"2021-12-16T16:08:25.670Z","contributors":[]}},"dist-tags":{"latest":"0.0.4"},"name":"curve25519-js","time":{"created":"2022-01-27T18:51:14.271Z","modified":"2023-08-04T17:38:24.734Z","0.0.4":"2019-08-02T05:57:33.151Z","0.0.3":"2019-08-02T05:11:35.240Z","0.0.2":"2019-08-02T05:03:47.052Z","0.0.1":"2019-08-02T04:50:34.825Z"},"readme":"# curve25519-js\n\nCurve25519 signatures with X25519 keys.\n\n\n## Installation\n\n```\nnpm i curve25519-js\n```\n\n## Usage\n\n```js\nimport { sharedKey } from 'curve25519-js';\n\nconst ALICE_PRIV = '77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a';\nconst BOB_PUB = 'de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f';\n\nconst alicePriv = Uint8Array.from(Buffer.from(ALICE_PRIV, 'hex'));\n\nconst bobPub = Uint8Array.from(Buffer.from(BOB_PUB, 'hex'));\n\nconst secret = sharedKey(alicePriv, bobPub);\n\nconsole.log('Secret:', Buffer.from(secret).toString('hex'))\n```\n\n## Functions\n\n### generateKeyPair\nGenerates a new key pair from the given 32-byte secret seed (which should be generated with a CSPRNG) and returns it as object:\n```ts\ngenerateKeyPair(seed: Uint8Array(32)): { \n  private: Uint8Array(32);\n  public: Uint8Array(32);\n}\n```\nThe returned keys can be used for signing and key agreement.\n\n### sign\n\nSigns the given message using the private key and returns signature.\n\n```ts\nsign(secretKey: Uint8Array(32), message: any, [random: Uint8Array(64)]): Uint8Array(64)\n```\n\nOptional random data argument (which must have 64 random bytes) turns on\nhash separation and randomization to make signatures non-deterministic.\n\n### verify\n\nVerifies the given signature for the message using the given private key.\nReturns `true` if the signature is valid, `false` otherwise.\n\n```ts\nverify(publicKey: Uint8Array(32), message: any, signature: Uint8Array(64)): boolean\n```\n\n### signMessage\n\nSigns the given message using the private key and returns\na signed message (signature concatenated with the message copy).\n\n```ts\nsignMessage(secretKey: Uint8Array(32), message: any, [random: Uint8Array(64)]): any\n```\n\nOptional random data argument (which must have 64 random bytes) turns on\nhash separation and randomization to make signatures non-deterministic.\n\n### openMessage\n\nVerifies signed message with the public key and returns the original message\nwithout signature if it's correct or `null` if verification fails.\n\n```ts\nopenMessage(publicKey: Uint8Array(32), signedMessage: any): Message | null\n```\n\n\n### sharedKey\nReturns a raw shared key between own private key and peer's public key (in other words, this is an ECC Diffie-Hellman function X25519, performing scalar multiplication).\n\nThe result should not be used directly as a key, but should be processed with a one-way function (e.g. HSalsa20 as in NaCl, or any secure cryptographic hash function, such as SHA-256, or key derivation function, such as HKDF).\n```ts\nsharedKey(privateKey: Uint8Array(32), publicKey: Uint8Array(32)): Uint8Array(32)\n```\n\n## How is it different from Ed25519?\nAxlsign allows calculating key agreement and signing using just a single X25519 key instead of two different X25519 and Ed25519 keys.\n\nIt uses keys in X25519 format (Montgomery), while Ed25519 uses keys in a different representation (Twisted Edwards). Internally, it converts keys to the correct format, but since such conversion would lose a sign bit, it also embeds the sign bit from public key into signature during signing, and puts it back into the key during verification.\n\nNote: if signing and performing key agreement with a single key is needed, but using keys in X25519 format is not a requrement, a better choice is to use Ed25519 keys, and then convert them to X25519 keys for key agreement (e.g. using <https://github.com/dchest/ed2curve-js>). This allows using only an external conversion functions without changing signature algorithms and formats.\n\n## Credits\n\nRe-written in 2019 with TypeScript support by Harvey Connor.\n\nWritten in 2016 by Dmitry Chestnykh.\nYou can use it under MIT or CC0 license.\n\nCurve25519 signatures idea and math by Trevor Perrin\n<https://moderncrypto.org/mail-archive/curves/2014/000205.html>\n\nDerived from TweetNaCl.js <https://tweetnacl.js.org>.\nPorted in 2014 by Dmitry Chestnykh and Devi Mandiri. Public domain.\nImplementation derived from TweetNaCl version 20140427\n<http://tweetnacl.cr.yp.to>","users":{}}