@highway1/core 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -18
- package/src/discovery/agent-card-encoder.ts +0 -119
- package/src/discovery/agent-card-schema.ts +0 -87
- package/src/discovery/agent-card-types.ts +0 -99
- package/src/discovery/agent-card.ts +0 -190
- package/src/discovery/bootstrap.ts +0 -63
- package/src/discovery/capability-matcher.ts +0 -167
- package/src/discovery/dht.ts +0 -282
- package/src/discovery/index.ts +0 -3
- package/src/discovery/search-index.ts +0 -247
- package/src/discovery/semantic-search.ts +0 -218
- package/src/identity/did.ts +0 -48
- package/src/identity/document.ts +0 -77
- package/src/identity/index.ts +0 -4
- package/src/identity/keys.ts +0 -79
- package/src/identity/signer.ts +0 -55
- package/src/index.ts +0 -33
- package/src/messaging/codec.ts +0 -47
- package/src/messaging/envelope.ts +0 -107
- package/src/messaging/index.ts +0 -3
- package/src/messaging/router.ts +0 -368
- package/src/transport/connection.ts +0 -77
- package/src/transport/index.ts +0 -2
- package/src/transport/node.ts +0 -152
- package/src/trust/endorsement.ts +0 -167
- package/src/trust/index.ts +0 -194
- package/src/trust/interaction-history.ts +0 -155
- package/src/trust/sybil-defense.ts +0 -232
- package/src/trust/trust-score.ts +0 -136
- package/src/utils/errors.ts +0 -38
- package/src/utils/logger.ts +0 -48
package/dist/index.js
CHANGED
|
@@ -1502,7 +1502,7 @@ function createMessageRouter(libp2p, verifyFn, dht, relayPeers) {
|
|
|
1502
1502
|
function buildCircuitRelayAddr(relayAddr, targetPeerId) {
|
|
1503
1503
|
return `${relayAddr}/p2p-circuit/p2p/${targetPeerId}`;
|
|
1504
1504
|
}
|
|
1505
|
-
async function handleIncomingStream(stream, handlers, catchAllHandler,
|
|
1505
|
+
async function handleIncomingStream(stream, handlers, catchAllHandler, verifyFn) {
|
|
1506
1506
|
try {
|
|
1507
1507
|
const chunks = [];
|
|
1508
1508
|
for await (const chunk of stream.source) {
|
|
@@ -1532,6 +1532,26 @@ async function handleIncomingStream(stream, handlers, catchAllHandler, _verifyFn
|
|
|
1532
1532
|
});
|
|
1533
1533
|
return;
|
|
1534
1534
|
}
|
|
1535
|
+
try {
|
|
1536
|
+
const { signature, ...envelopeWithoutSig } = envelope;
|
|
1537
|
+
const dataBytes = new TextEncoder().encode(JSON.stringify(envelopeWithoutSig));
|
|
1538
|
+
const signatureBytes = Buffer.from(signature, "hex");
|
|
1539
|
+
const hookValid = await verifyFn(signatureBytes, dataBytes);
|
|
1540
|
+
if (!hookValid) {
|
|
1541
|
+
logger5.warn("Message rejected by custom verifier", {
|
|
1542
|
+
id: envelope.id,
|
|
1543
|
+
from: envelope.from
|
|
1544
|
+
});
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
} catch (error) {
|
|
1548
|
+
logger5.warn("Custom verification hook failed", {
|
|
1549
|
+
id: envelope.id,
|
|
1550
|
+
from: envelope.from,
|
|
1551
|
+
error: error.message
|
|
1552
|
+
});
|
|
1553
|
+
return;
|
|
1554
|
+
}
|
|
1535
1555
|
logger5.info("Received message", {
|
|
1536
1556
|
id: envelope.id,
|
|
1537
1557
|
from: envelope.from,
|