This commit is contained in:
Raven Scott
2026-05-20 23:10:07 -04:00
parent dd384eb944
commit a2e7da7b5b
17 changed files with 391 additions and 15 deletions
@@ -1,28 +1,36 @@
# hyper-p2p-secret-stream-pair # hyper-p2p-secret-stream-pair
**Status:** scaffold (`0.0.0-scaffold`) · **Protocol:** `secret-stream-pair/v1` · **Wave:** 8 In-process `@hyperswarm/secret-stream` pair for tests, RPC harnesses, and session-bridge handoff.
In-process SecretStream pair helper. **Category:** Network transport
## Holepunch references (inspiration only) **Composes with:** `hyper-p2p-session-bridge`, `hyper-p2p-rpc`
- `hyperswarm-secret-stream` **Protocol:** `secret-stream-pair/v1`
> This module composes on Hyperswarm/Hypercore — it does **not** re-implement upstream packages. ## When to use
## Composes with Local integration tests or tooling that need a connected encrypted stream pair without the public DHT.
- `hyper-p2p-session-bridge` ## When not to use
## Planned API Production WAN transport (use Hyperswarm discovery + live connections instead).
- `constructor(opts)` — topic, optional keyPair ## Quick start
- `getStats()` — scaffold counters
- `ready()` — no-op until implemented
- Domain methods — throw `not implemented: scaffold` until Wave 8+ pass
## Layout ```js
const { createPair } = require('hyper-p2p-secret-stream-pair')
const { initiator, responder } = await createPair().open()
// use initiator / responder as duplex streams
```
`modules/network-transport/hyper-p2p-secret-stream-pair/` ## Docs
See [`modules/_shared/MODULE_SYSTEM.md`](../../_shared/MODULE_SYSTEM.md). - [docs/api.md](docs/api.md)
- [docs/architecture.md](docs/architecture.md)
## Test
```bash
npm install && npm test
```
@@ -0,0 +1,23 @@
{
"scores": {
"6f2cbb405066765ffb41e1676abaa1ec1d9a3f409b6aa0cd12aa5db615e95c9e": {
"score": 75,
"lastUpdated": 1779332478350,
"attestationsCount": 1
}
},
"history": {
"6f2cbb405066765ffb41e1676abaa1ec1d9a3f409b6aa0cd12aa5db615e95c9e": [
{
"ts": 1779332478350,
"delta": 75,
"attester": "b4f90760037993453b031e551dccc78b53204c6e25267a43a30ea1cdefada2b2",
"signature": "i6/vOHXWgX3Rv0+2v7CArEs+m8mQbFbOe9Lxih0syZ6TWZBne8r/8eDctLOF7ESx/wjQXDlDsWwhEMif/f6VCA==",
"metadata": {
"context": "test"
}
}
]
},
"lastPersist": 1779332478411
}
@@ -0,0 +1,23 @@
{
"scores": {
"d1d63df8ca1ba37d2eb3fba6445173f19486eb4d1cd0e7bc12a0b9efb60dcb12": {
"score": 75,
"lastUpdated": 1779332868713,
"attestationsCount": 1
}
},
"history": {
"d1d63df8ca1ba37d2eb3fba6445173f19486eb4d1cd0e7bc12a0b9efb60dcb12": [
{
"ts": 1779332868713,
"delta": 75,
"attester": "a3b0d6615455ef1b9d45edf83c9f34bdb5f012c22ffc8bfc90f3e871b0389398",
"signature": "hORg+JyFyJF/74ODzTo9tpX8Z1tlngzi2JJSbZ+qvPbfRxD88oTXqIlbPjP/39YZxv02miTmhNJiCtH1NqbOBg==",
"metadata": {
"context": "test"
}
}
]
},
"lastPersist": 1779332868774
}
@@ -0,0 +1,21 @@
{
"scores": {
"decay-peer": {
"score": 90,
"lastUpdated": 1779332478415,
"attestationsCount": 1
}
},
"history": {
"decay-peer": [
{
"ts": 1779332478415,
"delta": 100,
"attester": "0157e77d2b6bfbd0e2f51b97ffb58d6c639ccc0113ac12d1c00bea01e8b2fd8b",
"signature": "fyIpLElQ2Fe3u4lpAaWrSeY2lCSONlfkX4lutgVtZlqdQduopjVMgO5OoO5vD9n3tuPJ7Bph3QpOo2ydJT+jAQ==",
"metadata": {}
}
]
},
"lastPersist": 1779332478416
}
@@ -0,0 +1,21 @@
{
"scores": {
"decay-peer": {
"score": 90,
"lastUpdated": 1779332868777,
"attestationsCount": 1
}
},
"history": {
"decay-peer": [
{
"ts": 1779332868777,
"delta": 100,
"attester": "1fee34de6d1e4453f5e2eb3c48bd5db62ba2e31b30ef44a4b5e15aa28dbb18bf",
"signature": "0+8nbKBbVzLBNHZ7AD6DPA5Dl7KaB+z6gKafaL/hPyB5gjqrNFO6b9bBzuvL7bkmWH3J7VyuKlqczLwlan53CQ==",
"metadata": {}
}
]
},
"lastPersist": 1779332868778
}
@@ -0,0 +1,5 @@
{
"scores": {},
"history": {},
"lastPersist": 1779332478347
}
@@ -0,0 +1,5 @@
{
"scores": {},
"history": {},
"lastPersist": 1779332868710
}
@@ -0,0 +1,21 @@
{
"scores": {
"persist-peer": {
"score": 55,
"lastUpdated": 1779332478417,
"attestationsCount": 1
}
},
"history": {
"persist-peer": [
{
"ts": 1779332478417,
"delta": 55,
"attester": "9f0cac6c9bfbc555896b4b00cb2b4c6b5ed88cda4eda95b991b4d408a0829d5b",
"signature": "RzrlnhLKWs3DSbOSaGJe0hg42NUCS47cNbj12Eg50C/ukLqSzAcDyDd5apEdjff4hzlaa/u9cncMQYProrEcAg==",
"metadata": {}
}
]
},
"lastPersist": 1779332478417
}
@@ -0,0 +1,21 @@
{
"scores": {
"persist-peer": {
"score": 55,
"lastUpdated": 1779332868778,
"attestationsCount": 1
}
},
"history": {
"persist-peer": [
{
"ts": 1779332868778,
"delta": 55,
"attester": "d3b4e9e496b767a2f8dc4a6b97877d8b95a6e9365df12123c18229286de6563a",
"signature": "WD+h/WaxzPmyfHUgYFQd7Egh7Roc3CVt5hnCaTNHjUb4w2lUqB46CPqP5Ir5/pr1oOjN+IT4PBDJi+3n7lJVBg==",
"metadata": {}
}
]
},
"lastPersist": 1779332868779
}
@@ -0,0 +1,35 @@
{
"scores": {
"peer1": {
"score": 100,
"lastUpdated": 1779332478414,
"attestationsCount": 1
},
"peer2": {
"score": 60,
"lastUpdated": 1779332478414,
"attestationsCount": 1
}
},
"history": {
"peer1": [
{
"ts": 1779332478414,
"delta": 100,
"attester": "d9210816ddf2e50d396f924c20bec1ab1609377b81b97bf9e93fa4c7a0be163a",
"signature": "v49rGg1/htQvEVDqwqA9ER5DGtAgfQbOgDEjfqgL6xjpT6awcBoNlc340ExQlYjJ9m8nhIGha/We8opYYiCRBQ==",
"metadata": {}
}
],
"peer2": [
{
"ts": 1779332478414,
"delta": 60,
"attester": "d9210816ddf2e50d396f924c20bec1ab1609377b81b97bf9e93fa4c7a0be163a",
"signature": "FUWHOy5mgfKPgosdnujTrLP7ZcpOivx4XTkFVI4P2XhXyfH1Q7Xi1VFPp/I0mPWhwUPV5P/c6x+ylP92oCqPAw==",
"metadata": {}
}
]
},
"lastPersist": 1779332478415
}
@@ -0,0 +1,35 @@
{
"scores": {
"peer1": {
"score": 100,
"lastUpdated": 1779332868776,
"attestationsCount": 1
},
"peer2": {
"score": 60,
"lastUpdated": 1779332868776,
"attestationsCount": 1
}
},
"history": {
"peer1": [
{
"ts": 1779332868776,
"delta": 100,
"attester": "3fa723712e34768c6e712d358f98db83508b52194155cb98a952d71c06011cdb",
"signature": "r1TqphKk7LwnNpDRezsQi8eNVx4jdKYjqzHGDo73lt4cFITsCiQbmH41iM0mD5uiVl+4HVC6qFZyviVBN6dKDA==",
"metadata": {}
}
],
"peer2": [
{
"ts": 1779332868776,
"delta": 60,
"attester": "3fa723712e34768c6e712d358f98db83508b52194155cb98a952d71c06011cdb",
"signature": "SCfsJnPs6tCX+1V185zIOwkcnK/oy31rY9GZVKxQmatEo3ERELDvOWyc3Hi0eB6r38uZ1trNDv/juSpnngUrBw==",
"metadata": {}
}
]
},
"lastPersist": 1779332868777
}
@@ -0,0 +1,5 @@
{
"scores": {},
"history": {},
"lastPersist": 1779332478413
}
@@ -0,0 +1,5 @@
{
"scores": {},
"history": {},
"lastPersist": 1779332868775
}
@@ -0,0 +1,37 @@
{
"scores": {
"snapshot-peer-1": {
"score": 120,
"lastUpdated": 1779332478418,
"attestationsCount": 1
},
"snapshot-peer-2": {
"score": 80,
"lastUpdated": 1779332478418,
"attestationsCount": 1
}
},
"history": {
"snapshot-peer-1": [
{
"ts": 1779332478418,
"delta": 120,
"attester": "0147108cecf3642df853cbdc711447354f2c48b5fa9811d4ce4b336f7b2db6dc",
"signature": "ZPjA3z6AmIqP+3EXRrlfA0b4UFvp1/oyeumR4n5c4KQpZTn241BmefpLV4cvw0lu4tiUZ2TVaBRymYyG76RGDA==",
"metadata": {
"category": "reliability"
}
}
],
"snapshot-peer-2": [
{
"ts": 1779332478418,
"delta": 80,
"attester": "0147108cecf3642df853cbdc711447354f2c48b5fa9811d4ce4b336f7b2db6dc",
"signature": "2JIFp+THd8NZSFg7Gg5g3X3XNJHkDbS50khNKROv/vsUl0aI5XHJZ+7R+8F14gMCaPF82CNSOC2tnNBTBbzHBg==",
"metadata": {}
}
]
},
"lastPersist": 1779332478419
}
@@ -0,0 +1,37 @@
{
"scores": {
"snapshot-peer-1": {
"score": 120,
"lastUpdated": 1779332868780,
"attestationsCount": 1
},
"snapshot-peer-2": {
"score": 80,
"lastUpdated": 1779332868780,
"attestationsCount": 1
}
},
"history": {
"snapshot-peer-1": [
{
"ts": 1779332868780,
"delta": 120,
"attester": "8134a9920d1c0a90d01dac03d5c11fb67121f16c03510f2b4289bff31a1d8973",
"signature": "V9qaBkyBTd+YFGWufRraVM0xb9ANQv7JWWAQk+hVZq2L4zwOoAvK6AAZA5wsnkeV37jnndIcHhMqESur4vLzAA==",
"metadata": {
"category": "reliability"
}
}
],
"snapshot-peer-2": [
{
"ts": 1779332868780,
"delta": 80,
"attester": "8134a9920d1c0a90d01dac03d5c11fb67121f16c03510f2b4289bff31a1d8973",
"signature": "3zi+lEo4JJWRdk2t3eTnalOW2BOg28nz7Hd214nKxU6pkQWcSLAs5eL9qXJVLAHpWefYoVZy4i5vZcWreWscCQ==",
"metadata": {}
}
]
},
"lastPersist": 1779332868781
}
@@ -0,0 +1,37 @@
{
"scores": {
"snapshot-peer-1": {
"score": 120,
"lastUpdated": 1779332478418,
"attestationsCount": 1
},
"snapshot-peer-2": {
"score": 80,
"lastUpdated": 1779332478418,
"attestationsCount": 1
}
},
"history": {
"snapshot-peer-1": [
{
"ts": 1779332478418,
"delta": 120,
"attester": "0147108cecf3642df853cbdc711447354f2c48b5fa9811d4ce4b336f7b2db6dc",
"signature": "ZPjA3z6AmIqP+3EXRrlfA0b4UFvp1/oyeumR4n5c4KQpZTn241BmefpLV4cvw0lu4tiUZ2TVaBRymYyG76RGDA==",
"metadata": {
"category": "reliability"
}
}
],
"snapshot-peer-2": [
{
"ts": 1779332478418,
"delta": 80,
"attester": "0147108cecf3642df853cbdc711447354f2c48b5fa9811d4ce4b336f7b2db6dc",
"signature": "2JIFp+THd8NZSFg7Gg5g3X3XNJHkDbS50khNKROv/vsUl0aI5XHJZ+7R+8F14gMCaPF82CNSOC2tnNBTBbzHBg==",
"metadata": {}
}
]
},
"lastPersist": 1779332478419
}
@@ -0,0 +1,37 @@
{
"scores": {
"snapshot-peer-1": {
"score": 120,
"lastUpdated": 1779332868780,
"attestationsCount": 1
},
"snapshot-peer-2": {
"score": 80,
"lastUpdated": 1779332868780,
"attestationsCount": 1
}
},
"history": {
"snapshot-peer-1": [
{
"ts": 1779332868780,
"delta": 120,
"attester": "8134a9920d1c0a90d01dac03d5c11fb67121f16c03510f2b4289bff31a1d8973",
"signature": "V9qaBkyBTd+YFGWufRraVM0xb9ANQv7JWWAQk+hVZq2L4zwOoAvK6AAZA5wsnkeV37jnndIcHhMqESur4vLzAA==",
"metadata": {
"category": "reliability"
}
}
],
"snapshot-peer-2": [
{
"ts": 1779332868780,
"delta": 80,
"attester": "8134a9920d1c0a90d01dac03d5c11fb67121f16c03510f2b4289bff31a1d8973",
"signature": "3zi+lEo4JJWRdk2t3eTnalOW2BOg28nz7Hd214nKxU6pkQWcSLAs5eL9qXJVLAHpWefYoVZy4i5vZcWreWscCQ==",
"metadata": {}
}
]
},
"lastPersist": 1779332868781
}