OverviewFilesCommitsIssuesDocsReleasesPeers

holepunchto-kb / skills / noise-handshake / api-extract.json

58 lines · json ref:
{
  "repo": "noise-handshake",
  "timestamp": "2026-01-16T23:39:54.133Z",
  "entryPoint": "noise.js",
  "exports": {
    "packageJson": {
      "main": "noise.js"
    }
  },
  "api": {
    "file": "noise.js",
    "exports": [
      {
        "type": "default",
        "name": "class"
      }
    ],
    "classes": [
      {
        "name": "Writer"
      },
      {
        "name": "Reader"
      },
      {
        "name": "NoiseState"
      }
    ],
    "functions": [
      {
        "name": "keyPattern"
      },
      {
        "name": "hasPskToken"
      }
    ]
  },
  "readme": {
    "content": "# 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.publicKey)\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.complete) // true\n\n// convention is to use rx for\n// sending and tx for receiving\n\n// initiator.rx === responder.tx\n// responder.rx === initiator.tx\n\n// instantiate a cipher using shared secrets\nconst send = new Cipher(initiator.tx)\nconst recieve = new Cipher(responder.rx)\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\nCreat",
    "sections": [
      "intro",
      "usage",
      "api",
      "license"
    ],
    "hasApi": true,
    "hasExamples": true,
    "exampleCount": 3,
    "examples": [
      "const 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.publicKey)\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.complete) // true\n\n// convention is to use rx for\n// sending and tx for receiving\n\n// initiator.rx === responder.tx\n// responder.rx === initiator.tx\n\n// instantiate a cipher using shared secrets\nconst send = new Cipher(initiator.tx)\nconst recieve = new Cipher(responder.rx)\n\nconst msg = Buffer.from('hello, world')\n\nconst enc = send.encrypt(msg)\nconsole.log(recieve.decrypt(enc)) // hello, world",
      "{\n  DHLEN,\n  PKLEN,\n  SKLEN,\n  ALG,\n  generateKeyPair,\n  dh\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}"
    ]
  },
  "patterns": [
    "cryptography"
  ]
}