{"_id":"ed2curve-esm","_rev":"1-a54735e02fbbb0d26f6c197f64862722","name":"ed2curve-esm","dist-tags":{"latest":"0.3.0-alpha-1"},"versions":{"0.3.0-alpha-1":{"name":"ed2curve-esm","description":"ESM version of dchest/ed2curve Convert Ed25519 signing keys into Curve25519 Diffie-Hellman keys.","version":"0.3.0-alpha-1","license":"Unlicense","esnext":"dist-src/index.js","main":"dist-node/index.js","module":"dist-web/index.js","types":"dist-types/index.d.ts","pika":true,"sideEffects":false,"keywords":["ed25519","curve25519","djb","crypto","public","keys","edwards","montgomery","elliptic"],"homepage":"https://github.com/dchest/ed2curve-js","bugs":{"url":"https://github.com/dchest/ed2curve-js/issues"},"repository":{"type":"git","url":"git+https://github.com/pelle/ed2curve-esm.git"},"dependencies":{"tweetnacl":"^1.0.1"},"devDependencies":{"@pika/pack":"^0.3.6","@pika/plugin-build-node":"^0.3.14","@pika/plugin-build-types":"^0.3.14","@pika/plugin-build-web":"^0.3.14","@pika/plugin-standard-pkg":"^0.3.14","faucet":"0.x.x","tape":"^4.10.1","tweetnacl-util":"^0.15.0"},"_id":"ed2curve-esm@0.3.0-alpha-1","_nodeVersion":"11.12.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Ydrqcf0NwKUBT4gL0Nnxp8/O5NG8iatN+/zbEgs/7eMGjgSVbgfE1YfWld2qYnoNIxOQvSWOFy5uBoaL3jCanw==","shasum":"67a5722ea97976c3310aeaf0990a2b58ee383aef","tarball":"https://registry.npmjs.org/ed2curve-esm/-/ed2curve-esm-0.3.0-alpha-1.tgz","fileCount":7,"unpackedSize":23266,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcoRjLCRA9TVsSAnZWagAAuAkQAKNBcjgYaHeIHT+4XLDM\nTLjjtquXAoqo97+k3USl3a0jpkeZ5NJTU7TBT20Nz8w3RMVIqgHLiOn+uvxt\nrduZavewDfx4Yvx2nDyOBG9FocFcqv3AXkazsq6iMRWsIBtamcLvX15uBh2d\nDowkHyGoGIFxaoSWLDADm0u7gaH7RV7O5QURtO4HOCVzmmT5NOYcrKmtVAMb\nesmuId8PHcx/sd1i3laJqaNIgq4b6PYU2LZWK964+SJLuuo0sVNHuDmSt0Rc\nUuJP7qKcBrSeByLOb9LMFc1alv1TEtXUL6vcN1PhvP27T1P5pT7T9ceSgn4C\nDMv86rqNQJG+NPIIzv+6feQWEnh8T683RVqgrpJSzy7dgf4vXWNu5wVrAad9\nJis7xoxsBooK1UM45P+xQH8GtOL7oxXqTADhjdCB44LlaCtAJdiUMT0LhtHc\n/w3HvIvxlkRabYeeifMBMXyYYqQ5LoDYS/4B0irVwV2/sYlXyG2YmHC0YEST\nSdumo5tKJUpKL6aTszG3nFf0hiDggiIyywlfh4Yr6H2SbeW7w8/IeywG1W/K\nXh0qyaZjfOwDrVNA6Y2Pj5C7/b7vw8r/3EWHtCuG8PG5Sh+nA0Dyp4SWh412\nZI6IV6CQLpe3kOAOmryBsGhYtwRWWOWPGEKyy+097/D+H6686V6lk5n5LMy5\n7wwl\r\n=dl0f\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCObtRbrIOIeWmzIrR1iV6mxscnbA/FrkWuiSrJP6I5dQIhANyKVmgF3Oo6orap8Tju5eUTRv1BWktRpwHcmBTgJOPq"}]},"maintainers":[{"name":"pelleb","email":"pelleb@gmail.com"}],"_npmUser":{"name":"pelleb","email":"pelleb@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ed2curve-esm_0.3.0-alpha-1_1554061514563_0.23793010424122873"},"_hasShrinkwrap":false}},"time":{"created":"2019-03-31T19:45:14.563Z","0.3.0-alpha-1":"2019-03-31T19:45:14.775Z","modified":"2022-04-30T20:50:26.519Z"},"maintainers":[{"name":"pelleb","email":"pelleb@gmail.com"}],"description":"ESM version of dchest/ed2curve Convert Ed25519 signing keys into Curve25519 Diffie-Hellman keys.","homepage":"https://github.com/dchest/ed2curve-js","keywords":["ed25519","curve25519","djb","crypto","public","keys","edwards","montgomery","elliptic"],"repository":{"type":"git","url":"git+https://github.com/pelle/ed2curve-esm.git"},"bugs":{"url":"https://github.com/dchest/ed2curve-js/issues"},"license":"Unlicense","readme":"ed2curve.js (ESM compatible version)\n===========\n\n*note:* This fork is an attempt to make a treeshakeable, typescript typed version of [ed2curve](/dchest/ed2curve-js)\n\nConvert Ed25519 signing key pair into Curve25519 key pair suitable for\nDiffie-Hellman key exchange. This means that by exchanging only 32-byte\nEd25519 public keys users can both sign and encrypt with NaCl.\n\nNote that there's currently [no proof](http://crypto.stackexchange.com/a/3311/291)\nthat this is safe to do. It is safer to share both Ed25519 and Curve25519\npublic keys (their concatenation is 64 bytes long).\n\nWritten by Dmitry Chestnykh in 2014-2016, using public domain code from\n[TweetNaCl.js](https://github.com/dchest/tweetnacl-js). Public domain.\nNo warranty.\n\nThanks to [@CodesInChaos](https://github.com/CodesInChaos) and\n[@nightcracker](https://github.com/nightcracker) for showing how to\nconvert Edwards coordinates to Montgomery coordinates.\n\n[![Build Status](https://travis-ci.org/dchest/ed2curve-js.svg?branch=master)\n](https://travis-ci.org/dchest/ed2curve-js)\n\n\nInstallation\n------------\n\nVia NPM:\n\n    $ npm install --save ed2curve-esm\n\n```js\nimport { convertKeyPair } from 'ed2curve-esm'\n```\n\nUsage\n-----\n\n### ed2curve.convertKeyPair(keyPair) -> convertedKeyPair | null\n\nConverts the given key pair as generated by\n[TweetNaCl.js](https://github.com/dchest/tweetnacl-js)'s `nacl.sign.keyPair`\ninto a key pair suitable for operations which accept key pairs generated by\n`nacl.box.keyPair`. This function is a combination of `convertPublicKey`\nand `convertSecretKey`.\n\nReturns `null` if the public key in the given key pair is not a valid\nEd25519 public key.\n\n### ed2curve.convertPublicKey(edPublicKey) -> curvePublicKey | null\n\nConverts a 32-byte Ed25519 public key into a 32-byte Curve25519 public key\nand returns it.\n\nReturns `null` if the given public key in not a valid Ed25519 public key.\n\n### ed2curve.convertSecretKey(edSecretKey) -> curveSecretKey\n\nConverts a 64-byte Ed25519 secret key (or just the first 32-byte part of it,\nwhich is the secret value) into a 32-byte Curve25519 secret key and returns it.\n\n\nExample\n-------\n\n(Note: example uses [tweetnacl-util](https://github.com/dchest/tweetnacl-util-js)\nto convert bytes)\n\n```javascript\nimport nacl from 'tweetnacl'\nimport naclutil from 'tweetnacl-util'\nimport * as ed2curve from 'ed2curve-esm'\n\n// Generate new sign key pair.\nvar myKeyPair = nacl.sign.keyPair();\n\n// Share public key with a peer.\nconsole.log(myKeyPair.publicKey);\n\n// Receive peer's public key.\nvar theirPublicKey = // ... receive\n\n// Sign a message.\nvar message = nacl.util.decodeUTF8('Hello!');\nvar signedMessage = nacl.sign(message, myKeyPair.secretKey);\n\n// Send message to peer. They can now verify it using\n// the previously shared public key (myKeyPair.publicKey).\n// ...\n\n// Receive a signed message from peer and verify it using their public key.\nvar theirSignedMessage = // ... receive\nvar theirMessage = nacl.sign.open(theirSignedMessage, theirPublicKey);\nif (theirMessage) {\n  // ... we got the message ...\n}\n\n// Encrypt a message to their public key.\n// But first, we need to convert our secret key and their public key\n// from Ed25519 into the format accepted by Curve25519.\n//\n// Note that peers are not involved in this conversion -- all they need\n// to know is the signing public key that we already shared with them.\n\nvar theirDHPublicKey = ed2curve.convertPublicKey(theirPublicKey);\nvar myDHSecretKey = ed2curve.convertSecretKey(myKeyPair.secretKey);\n\nvar anotherMessage = nacl.util.decodeUTF8('Keep silence');\nvar encryptedMessage = nacl.box(anotherMessage, nonce, theirDHPublicKey, myDHSecretKey);\n\n// When we receive encrypted messages from peers,\n// we need to use converted keys to open them.\n\nvar theirEncryptedMessage = // ... receive\nvar decryptedMessage = nacl.box.open(theirEncryptedMessage, nonce, theirDHPublicKey, myDHSecretKey);\n```\n\nRequirements\n------------\n\n* Requires [TweetNaCl.js](https://github.com/dchest/tweetnacl-js)\n* Works in the same enviroments as it.\n\n\nOther libraries\n---------------\n\nSome other libraries that can use a single Ed/Curve25519 key:\n\n* [agl/../extra25519](https://github.com/agl/ed25519/blob/master/extra25519/extra25519.go) - Go\n  (compatible with ed2curve)\n* [CodesInChaos/../MontgomeryCurve25519](https://github.com/CodesInChaos/Chaos.NaCl/blob/master/Chaos.NaCl/MontgomeryCurve25519.cs) - C#\n  (compatible with ed2curve)\n* [nightcracker/ed25519](https://github.com/nightcracker/ed25519/blob/master/src/key_exchange.c) - C\n  (compatible with ed2curve)\n* [libsodium](https://github.com/jedisct1/libsodium) - C\n  (compatible with ed2curve)\n* [trevp/../curve_sigs](https://github.com/trevp/ref10_extract/blob/master/ed25519/additions/curve_sigs.c) - C\n  (incompatible, as it converts the opposite way, and stores a sign bit of signing public key in a signature)\n","readmeFilename":"README.md"}