OverviewFilesCommitsIssuesDocsReleasesPeers

holepunchto-kb / skills / hyperswarm-secret-stream / api-extract.json

66 lines · json ref:
{
  "repo": "hyperswarm-secret-stream",
  "timestamp": "2026-01-16T23:05:19.791Z",
  "entryPoint": "index.js",
  "exports": {
    "packageJson": {
      "main": "index.js"
    }
  },
  "api": {
    "file": "index.js",
    "exports": [
      {
        "type": "default",
        "name": "class"
      }
    ],
    "classes": [
      {
        "name": "NoiseSecretStream"
      }
    ],
    "functions": [
      {
        "name": "onkeypair"
      },
      {
        "name": "writeUint24le"
      },
      {
        "name": "streamId"
      },
      {
        "name": "toBuffer"
      },
      {
        "name": "destroyTimeout"
      },
      {
        "name": "sendKeepAlive"
      }
    ]
  },
  "readme": {
    "content": "# @hyperswarm/secret-stream\n\n### [See the full API docs at docs.pears.com](https://docs.pears.com/helpers/secretstream)\n\nSecret stream backed by Noise and libsodium's secretstream\n\n```\nnpm install @hyperswarm/secret-stream\n```\n\n## Usage\n\nYou can either make a secret stream from an existing transport stream.\n\n```js\nconst SecretStream = require('@hyperswarm/secret-stream')\n\nconst a = new SecretStream(true, tcpClientStream)\nconst b = new SecretStream(false, tcpServerStream)\n\n// pipe the underlying rawstreams together\n\na.write(Buffer.from('hello encrypted!'))\n\nb.on('data', function (data) {\n  console.log(data) // <Buffer hello encrypted!>\n})\n```\n\nOr by making your own pipeline\n\n```js\nconst a = new SecretStream(true)\nconst b = new SecretStream(false)\n\n// pipe the underlying rawstreams together\na.rawStream.pipe(b.rawStream).pipe(a.rawStream)\n\na.write(Buffer.from('hello encrypted!'))\n\nb.on('data', function (data) {\n  console.log(data) // <Buffer hello encrypted!>\n})\n```\n\n## API\n\n#### `const s",
    "sections": [
      "intro",
      "usage",
      "api",
      "license"
    ],
    "hasApi": true,
    "hasExamples": true,
    "exampleCount": 5,
    "examples": [
      "npm install @hyperswarm/secret-stream",
      "const SecretStream = require('@hyperswarm/secret-stream')\n\nconst a = new SecretStream(true, tcpClientStream)\nconst b = new SecretStream(false, tcpServerStream)\n\n// pipe the underlying rawstreams together\n\na.write(Buffer.from('hello encrypted!'))\n\nb.on('data', function (data) {\n  console.log(data) // <Buffer hello encrypted!>\n})",
      "const a = new SecretStream(true)\nconst b = new SecretStream(false)\n\n// pipe the underlying rawstreams together\na.rawStream.pipe(b.rawStream).pipe(a.rawStream)\n\na.write(Buffer.from('hello encrypted!'))\n\nb.on('data', function (data) {\n  console.log(data) // <Buffer hello encrypted!>\n})"
    ]
  },
  "patterns": [
    "peer-discovery",
    "cryptography",
    "streaming"
  ]
}