{"_id":"noise-handshake","_rev":"1671828","name":"noise-handshake","description":"## Usage ```js const Noise = require('noise-handshake') const Cipher = require('noise-handshake/cipher') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","dist-tags":{"latest":"2.2.0"},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"time":{"modified":"2021-11-24T00:01:10.000Z","created":"2021-07-09T15:38:07.436Z","2.2.0":"2021-11-23T23:58:41.045Z","2.1.2":"2021-11-23T23:55:13.320Z","2.1.1":"2021-11-23T23:46:48.301Z","2.1.0":"2021-09-16T10:38:26.065Z","2.0.0":"2021-09-08T17:12:11.975Z","1.2.2":"2021-07-16T12:33:52.277Z","1.2.1":"2021-07-16T12:21:09.034Z","1.2.0":"2021-07-16T11:49:45.178Z","1.1.0":"2021-07-16T09:18:32.933Z","1.0.0":"2021-07-09T15:38:07.436Z"},"users":{},"author":"","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"versions":{"2.2.0":{"name":"noise-handshake","version":"2.2.0","description":"## Usage ```js const Noise = require('noise-handshake') const Cipher = require('noise-handshake/cipher') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","main":"noise.js","scripts":{"test":"standard && tape test/*.js"},"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"dependencies":{"b4a":"^1.1.0","hmac-blake2b":"^2.0.0","nanoassert":"^2.0.0","sodium-universal":"^3.0.4"},"devDependencies":{"noise-protocol":"github:chm-diederichs/noise-protocol#xx-ephemeral-key","standard":"^16.0.3","tape":"^5.2.2"},"gitHead":"061cb50397f28df108b653a292306eb5ec030d8e","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","_id":"noise-handshake@2.2.0","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"shasum":"24c98f502d49118770e1ec2af2894b8789f0ac7c","size":6958,"noattachment":false,"key":"/noise-handshake/-/noise-handshake-2.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/noise-handshake/download/noise-handshake-2.2.0.tgz"},"_npmUser":{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},"directories":{},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/noise-handshake_2.2.0_1637711920888_0.8380904436747829"},"_hasShrinkwrap":false,"publish_time":1637711921045,"_cnpm_publish_time":1637711921045},"2.1.2":{"name":"noise-handshake","version":"2.1.2","description":"## Usage ```js const Noise = require('noise-handshake') const Cipher = require('noise-handshake/cipher') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","main":"noise.js","scripts":{"test":"standard && tape test/*.js"},"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"dependencies":{"b4a":"^1.1.0","hmac-blake2b":"^2.0.0","nanoassert":"^2.0.0","sodium-universal":"^3.0.4"},"devDependencies":{"noise-protocol":"github:chm-diederichs/noise-protocol#xx-ephemeral-key","standard":"^16.0.3","tape":"^5.2.2"},"gitHead":"a8b4116023d4ae65015e9a2a0e9da144770a7c74","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","_id":"noise-handshake@2.1.2","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"shasum":"72839b7700fb105be8fabbb4abcc526aada6c8e3","size":8835,"noattachment":false,"key":"/noise-handshake/-/noise-handshake-2.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/noise-handshake/download/noise-handshake-2.1.2.tgz"},"_npmUser":{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},"directories":{},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/noise-handshake_2.1.2_1637711713164_0.07824912238298976"},"_hasShrinkwrap":false,"publish_time":1637711713320,"_cnpm_publish_time":1637711713320},"2.1.1":{"name":"noise-handshake","version":"2.1.1","description":"## Usage ```js const Noise = require('noise-handshake') const Cipher = require('noise-handshake/cipher') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","main":"noise.js","scripts":{"test":"standard && tape test/*.js"},"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"dependencies":{"bint8array":"^1.1.3","hmac-blake2b":"^2.0.0","nanoassert":"^2.0.0","sodium-universal":"^3.0.4"},"devDependencies":{"noise-protocol":"github:chm-diederichs/noise-protocol#xx-ephemeral-key","standard":"^16.0.3","tape":"^5.2.2"},"gitHead":"27f4177cfda31e0b0ee6794cace9afcf039feeba","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","_id":"noise-handshake@2.1.1","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"shasum":"eb148da857994f8941759b3b34d8fba2a1a236e5","size":7015,"noattachment":false,"key":"/noise-handshake/-/noise-handshake-2.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/noise-handshake/download/noise-handshake-2.1.1.tgz"},"_npmUser":{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},"directories":{},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/noise-handshake_2.1.1_1637711208119_0.5244038574912593"},"_hasShrinkwrap":false,"publish_time":1637711208301,"_cnpm_publish_time":1637711208301},"2.1.0":{"name":"noise-handshake","version":"2.1.0","description":"## Usage ```js const Noise = require('noise-handshake') const Cipher = require('noise-handshake/cipher') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","main":"noise.js","scripts":{"test":"standard && tape test/*.js"},"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"dependencies":{"bint8array":"^1.1.3","hmac-blake2b":"^2.0.0","nanoassert":"^2.0.0","sodium-universal":"^3.0.4"},"devDependencies":{"noise-protocol":"github:chm-diederichs/noise-protocol#xx-ephemeral-key","standard":"^16.0.3","tape":"^5.2.2"},"gitHead":"93fed82a0edc51dec59168602351071b3dea9266","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","_id":"noise-handshake@2.1.0","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"shasum":"023d92c7a2237782b4bbf98da9a2abbf897ad432","size":7016,"noattachment":false,"key":"/noise-handshake/-/noise-handshake-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/noise-handshake/download/noise-handshake-2.1.0.tgz"},"_npmUser":{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},"directories":{},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/noise-handshake_2.1.0_1631788705928_0.7519872001566865"},"_hasShrinkwrap":false,"publish_time":1631788706065,"_cnpm_publish_time":1631788706065},"2.0.0":{"name":"noise-handshake","version":"2.0.0","description":"## Usage ```js const Noise = require('noise-handshake') const Cipher = require('noise-handshake/cipher') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","main":"noise.js","scripts":{"test":"standard && tape test/*.js"},"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"dependencies":{"hmac-blake2b":"^2.0.0","nanoassert":"^2.0.0","sodium-universal":"^3.0.4"},"devDependencies":{"noise-protocol":"github:chm-diederichs/noise-protocol#xx-ephemeral-key","standard":"^16.0.3","tape":"^5.2.2"},"gitHead":"f749d82fd74501ac1bb67b14a348cdd0a8b3cb25","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","_id":"noise-handshake@2.0.0","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"shasum":"aba340cf67949ce2e19f6fc2d1dcf146d7c64abd","size":6908,"noattachment":false,"key":"/noise-handshake/-/noise-handshake-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/noise-handshake/download/noise-handshake-2.0.0.tgz"},"_npmUser":{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},"directories":{},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/noise-handshake_2.0.0_1631121131823_0.7033045692357502"},"_hasShrinkwrap":false,"publish_time":1631121131975,"_cnpm_publish_time":1631121131975},"1.2.2":{"name":"noise-handshake","version":"1.2.2","description":"## Usage ```js const Noise = require('basic-noise') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","main":"noise.js","scripts":{"test":"standard && tape test/*.js"},"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"dependencies":{"hmac-blake2b":"^2.0.0","nanoassert":"^2.0.0","sodium-universal":"^3.0.4"},"devDependencies":{"noise-protocol":"github:chm-diederichs/noise-protocol#xx-ephemeral-key","standard":"^16.0.3","tape":"^5.2.2"},"gitHead":"c094c378e18d404b7edcd8effa038205a27d2772","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","_id":"noise-handshake@1.2.2","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"shasum":"7b15e13b26387eab60d5b70d9b91cca1c77c5479","size":6853,"noattachment":false,"key":"/noise-handshake/-/noise-handshake-1.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/noise-handshake/download/noise-handshake-1.2.2.tgz"},"_npmUser":{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},"directories":{},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/noise-handshake_1.2.2_1626438832134_0.036550709811608906"},"_hasShrinkwrap":false,"publish_time":1626438832277,"_cnpm_publish_time":1626438832277},"1.2.1":{"name":"noise-handshake","version":"1.2.1","description":"## Usage ```js const Noise = require('basic-noise') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","main":"noise.js","scripts":{"test":"standard && tape test/*.js"},"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"dependencies":{"hmac-blake2b":"^2.0.0","nanoassert":"^2.0.0","sodium-universal":"^3.0.4"},"devDependencies":{"noise-protocol":"github:chm-diederichs/noise-protocol#xx-ephemeral-key","standard":"^16.0.3","tape":"^5.2.2"},"gitHead":"70bbdf05f79571a53398c648f8bb3fa01e02aae1","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","_id":"noise-handshake@1.2.1","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"shasum":"2dfc65fed52ee524b45e0b72ccc1a64b02dc959c","size":6813,"noattachment":false,"key":"/noise-handshake/-/noise-handshake-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/noise-handshake/download/noise-handshake-1.2.1.tgz"},"_npmUser":{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},"directories":{},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/noise-handshake_1.2.1_1626438068853_0.962004765283963"},"_hasShrinkwrap":false,"publish_time":1626438069034,"_cnpm_publish_time":1626438069034},"1.2.0":{"name":"noise-handshake","version":"1.2.0","description":"## Usage ```js const Noise = require('basic-noise') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","main":"noise.js","scripts":{"test":"standard && tape test/*.js"},"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"dependencies":{"hmac-blake2b":"^2.0.0","nanoassert":"^2.0.0","sodium-universal":"^3.0.4"},"devDependencies":{"noise-protocol":"github:chm-diederichs/noise-protocol#xx-ephemeral-key","standard":"^16.0.3","tape":"^5.2.2"},"gitHead":"ac49dd17295560ab0ec43cc88342f0055ff6f9ca","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","_id":"noise-handshake@1.2.0","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"shasum":"d4e5cd87d2c5b066f6cc25ee4277f741337593d2","size":6914,"noattachment":false,"key":"/noise-handshake/-/noise-handshake-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/noise-handshake/download/noise-handshake-1.2.0.tgz"},"_npmUser":{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},"directories":{},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/noise-handshake_1.2.0_1626436185044_0.9414486002340365"},"_hasShrinkwrap":false,"publish_time":1626436185178,"_cnpm_publish_time":1626436185178},"1.1.0":{"name":"noise-handshake","version":"1.1.0","description":"## Usage ```js const Noise = require('basic-noise') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","main":"noise.js","scripts":{"test":"standard && tape test/*.js"},"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"dependencies":{"hmac-blake2b":"^2.0.0","nanoassert":"^2.0.0","sodium-universal":"^3.0.4"},"devDependencies":{"noise-protocol":"github:chm-diederichs/noise-protocol#xx-ephemeral-key","standard":"^16.0.3","tape":"^5.2.2"},"gitHead":"d38e319f694d613b2160f046810b480725366346","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","_id":"noise-handshake@1.1.0","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"shasum":"94ce77da391637f7593b8d3093a62181a24752cd","size":6600,"noattachment":false,"key":"/noise-handshake/-/noise-handshake-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/noise-handshake/download/noise-handshake-1.1.0.tgz"},"_npmUser":{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},"directories":{},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/noise-handshake_1.1.0_1626427112794_0.616668796423081"},"_hasShrinkwrap":false,"publish_time":1626427112933,"_cnpm_publish_time":1626427112933},"1.0.0":{"name":"noise-handshake","version":"1.0.0","description":"## Usage ```js const Noise = require('basic-noise') const initiator = new Noise('IK ', true) const responder = new Noise('IK', false)","main":"noise.js","scripts":{"test":"standard && tape test/*.js"},"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/chm-diederichs/noise-handshake.git"},"dependencies":{"hmac-blake2b":"^2.0.0","nanoassert":"^2.0.0","sodium-universal":"^3.0.4"},"devDependencies":{"noise-protocol":"github:chm-diederichs/noise-protocol#xx-ephemeral-key","standard":"^16.0.3","tape":"^5.2.2"},"gitHead":"5423c1d365b3a9603346fa00353ebfd257a71dab","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","_id":"noise-handshake@1.0.0","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"shasum":"da953f0ab8a6ed5f24a9b347d057937e9a851a0c","size":6600,"noattachment":false,"key":"/noise-handshake/-/noise-handshake-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/noise-handshake/download/noise-handshake-1.0.0.tgz"},"_npmUser":{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},"directories":{},"maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/noise-handshake_1.0.0_1625845087297_0.9945260524124824"},"_hasShrinkwrap":false,"publish_time":1625845087436,"_cnpm_publish_time":1625845087436}},"readme":"# noise-handshake\n\n## Usage\n```js\nconst Noise = require('noise-handshake')\nconst Cipher = require('noise-handshake/cipher')\nconst initiator = new Noise('IK ', true)\nconst responder = new Noise('IK', false)\n\nconst prologue = Buffer.alloc(0)\n\n// preshared key\ninitiator.initialise(prologue, responder.s.pub)\nresponder.initialise(prologue)\n\n// -> e, es, s, ss\nconst message = initiator.send()\nresponder.recv(message)\n\n// <- e, ee, se\nconst reply = responder.send()\ninitiator.recv(reply)\n\nconsole.log(initiator.handshakeComplete) // true\n\n// instantiate a cipher using shared secrets\nconst send = new Cipher(initiator.rx)\nconst recieve = new Cipher(initiator.tx)\n\nconst msg = Buffer.from('hello, world')\n\nconst enc = send.encrypt(msg)\nconsole.log(recieve.decrypt(enc)) // hello, world\n```\n\n## API\n\n#### `const peer = new Noise(pattern, initiator, staticKeypair, [opts])`\n\nCreate a new handshake state for a given pattern. Initiator should be either `true` or `false` depending on the role. A preexisting keypair may be passed as `staticKeypair`\n\n`opts` is may be used to pass in a `curve` module for performing Noise over other curves.\n\nCurve modules should export the following:\n```\n{\n  DHLEN,\n  PKLEN,\n  SKLEN,\n  ALG,\n  generateKeyPair,\n  dh\n}\n```\n\nSee [dh.js](./dh) for an example.\n\n#### `peer.initialise(prologue, remoteStatic)`\n\nInitialise the handshake state with a prologue and any preshared keys.\n\n#### `const buf = send([payload])`\n\nSend the next message in the handshake, add an optional payload buffer to be included in the message, payload is a zero length buffer by default.\n\n#### `const payload = peer.recv(buf)`\n\nReceive a handshake message from the peer and return the encrypted payload.\n\n#### `peer.complete`\n\n`true` or `false`. Indicates whether `rx` and `tx` have been created yet.\n\nWhen complete, the working handshake state shall be cleared *only* the following state shall remain on the object:\n\n```js\n{\n  tx, // session key to decrypt messages from remote peer\n  rx, // session key to encrypt messages to remote peer\n  rs, // the remote peer's public key,\n  hash, // a hash of the entire handshake state\n}\n```\n","_attachments":{},"homepage":"https://github.com/chm-diederichs/noise-handshake#readme","bugs":{"url":"https://github.com/chm-diederichs/noise-handshake/issues"},"license":"ISC"}