wire-mesh-core 4.1.2 → 4.1.4
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/adapters/byte-stream-connection.d.cts +2 -2
- package/dist/adapters/byte-stream-connection.d.mts +2 -2
- package/dist/adapters/frame-codec.d.cts +1 -1
- package/dist/adapters/frame-codec.d.mts +1 -1
- package/dist/adapters/node-identity.cjs +7 -1
- package/dist/adapters/node-identity.d.cts +2 -2
- package/dist/adapters/node-identity.d.mts +2 -2
- package/dist/adapters/node-identity.mjs +7 -1
- package/dist/adapters/tcp-transport.d.cts +1 -1
- package/dist/adapters/tcp-transport.d.mts +1 -1
- package/dist/adapters/threshold-identity.d.cts +2 -2
- package/dist/adapters/threshold-identity.d.mts +2 -2
- package/dist/adapters/threshold-wasm.d.cts +1 -1
- package/dist/adapters/threshold-wasm.d.mts +1 -1
- package/dist/adapters/tls-transport.d.cts +1 -1
- package/dist/adapters/tls-transport.d.mts +1 -1
- package/dist/domain/advert-extension-policy.d.cts +1 -1
- package/dist/domain/advert-extension-policy.d.mts +1 -1
- package/dist/domain/bulk.d.cts +2 -2
- package/dist/domain/bulk.d.mts +2 -2
- package/dist/domain/capability-grant.d.cts +2 -2
- package/dist/domain/capability-grant.d.mts +2 -2
- package/dist/domain/capability-request.d.cts +3 -3
- package/dist/domain/capability-request.d.mts +3 -3
- package/dist/domain/coordinator-election.d.cts +1 -1
- package/dist/domain/coordinator-election.d.mts +1 -1
- package/dist/domain/data-sync.d.cts +2 -2
- package/dist/domain/data-sync.d.mts +2 -2
- package/dist/domain/device-id.d.cts +1 -1
- package/dist/domain/device-id.d.mts +1 -1
- package/dist/domain/direct-manage-request.d.cts +2 -2
- package/dist/domain/direct-manage-request.d.mts +2 -2
- package/dist/domain/ed25519-identity-key.cjs +152 -0
- package/dist/domain/ed25519-identity-key.d.cts +13 -0
- package/dist/domain/ed25519-identity-key.d.mts +13 -0
- package/dist/domain/ed25519-identity-key.mjs +150 -0
- package/dist/domain/gossip-expansion.d.cts +1 -1
- package/dist/domain/gossip-expansion.d.mts +1 -1
- package/dist/domain/grant-candidates.d.cts +1 -1
- package/dist/domain/grant-candidates.d.mts +1 -1
- package/dist/domain/handshake.d.cts +1 -1
- package/dist/domain/handshake.d.mts +1 -1
- package/dist/domain/hub-mailbox.d.cts +1 -1
- package/dist/domain/hub-mailbox.d.mts +1 -1
- package/dist/domain/mesh-session.cjs +1 -1
- package/dist/domain/mesh-session.d.cts +3 -3
- package/dist/domain/mesh-session.d.mts +3 -3
- package/dist/domain/mesh-session.mjs +1 -1
- package/dist/domain/notice-board.d.cts +2 -2
- package/dist/domain/notice-board.d.mts +2 -2
- package/dist/domain/path-trace.d.cts +1 -1
- package/dist/domain/path-trace.d.mts +1 -1
- package/dist/domain/peer-advert.d.cts +2 -2
- package/dist/domain/peer-advert.d.mts +2 -2
- package/dist/domain/relay-advert.d.cts +1 -1
- package/dist/domain/relay-advert.d.mts +1 -1
- package/dist/domain/relay-hub.d.cts +2 -2
- package/dist/domain/relay-hub.d.mts +2 -2
- package/dist/domain/relay-use-gate.d.cts +2 -2
- package/dist/domain/relay-use-gate.d.mts +2 -2
- package/dist/domain/revocation-view.d.cts +1 -1
- package/dist/domain/revocation-view.d.mts +1 -1
- package/dist/domain/room-rekey.d.cts +2 -2
- package/dist/domain/room-rekey.d.mts +2 -2
- package/dist/domain/room-token-verification.d.cts +1 -1
- package/dist/domain/room-token-verification.d.mts +1 -1
- package/dist/domain/room.cjs +2 -1
- package/dist/domain/room.d.cts +3 -3
- package/dist/domain/room.d.mts +3 -3
- package/dist/domain/room.mjs +2 -1
- package/dist/domain/shard-manifest.d.cts +1 -1
- package/dist/domain/shard-manifest.d.mts +1 -1
- package/dist/domain/token-predicates.d.cts +1 -1
- package/dist/domain/token-predicates.d.mts +1 -1
- package/dist/domain/token-scope.d.cts +1 -1
- package/dist/domain/token-scope.d.mts +1 -1
- package/dist/domain/tokens.cjs +3 -2
- package/dist/domain/tokens.d.cts +3 -3
- package/dist/domain/tokens.d.mts +3 -3
- package/dist/domain/tokens.mjs +3 -2
- package/dist/domain/topology-snapshot.d.cts +1 -1
- package/dist/domain/topology-snapshot.d.mts +1 -1
- package/dist/domain/topology.d.cts +1 -1
- package/dist/domain/topology.d.mts +1 -1
- package/dist/domain/webrtc-signaling.d.cts +1 -1
- package/dist/domain/webrtc-signaling.d.mts +1 -1
- package/dist/generated/protocol.cjs +8 -8
- package/dist/generated/protocol.d.cts +1 -1
- package/dist/generated/protocol.d.mts +1 -1
- package/dist/generated/protocol.mjs +8 -8
- package/dist/{identity-BioGOV9M.d.mts → identity-CQof0iEM.d.cts} +4 -2
- package/dist/{identity-C5jq53NV.d.cts → identity-CUr-jaAB.d.mts} +4 -2
- package/dist/ports/identity.cjs +10 -0
- package/dist/ports/identity.d.cts +2 -2
- package/dist/ports/identity.d.mts +2 -2
- package/dist/ports/identity.mjs +10 -1
- package/dist/ports/transport.d.cts +1 -1
- package/dist/ports/transport.d.mts +1 -1
- package/dist/{protocol-DzmpxxUr.d.cts → protocol-Cb3BnuTL.d.cts} +346 -346
- package/dist/{protocol-DzmpxxUr.d.mts → protocol-Cb3BnuTL.d.mts} +346 -346
- package/dist/{room-token-verification-Hb1LkpFh.d.mts → room-token-verification-B1doIXmJ.d.mts} +1 -1
- package/dist/{room-token-verification-Dh7SGJfK.d.cts → room-token-verification-DuXqERah.d.cts} +1 -1
- package/dist/{token-predicates-CrieP1WI.d.mts → token-predicates-CS4DprDE.d.mts} +1 -1
- package/dist/{token-predicates-lg4TtUxm.d.cts → token-predicates-ooQCcAZm.d.cts} +1 -1
- package/dist/{transport-bD3p_TO_.d.mts → transport-CAD419ge.d.mts} +1 -1
- package/dist/{transport-gDbSHO-r.d.cts → transport-DaeS9N-o.d.cts} +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { bytesToHex } from "./device-id.mjs";
|
|
2
|
+
//#region src/domain/ed25519-identity-key.ts
|
|
3
|
+
/**
|
|
4
|
+
* What an Ed25519 identity-key must be, and what an Ed25519 signature under one must look like, decided here and nowhere else, before the platform's crypto library is consulted.
|
|
5
|
+
*
|
|
6
|
+
* A key is usable when it is exactly 32 bytes, is the canonical encoding of a point on the curve (its y coordinate is below the field prime, and it decodes), is not a point of small order (the eight points of the torsion subgroup, the identity element among them), and lies in the prime-order subgroup (it has no torsion component). A signature is acceptable to verify when its S is below the group order and its R is a canonical encoding that is not a small-order point. The signature equation itself is the cofactorless one, `[S]B = R + [k]A` compared as encodings, which Web Crypto's Ed25519 verification does on the platforms the conformance vectors are run on: a platform that verifies differently fails the mixed-order vectors there. The Rust crates apply the same rules through ed25519-dalek's `is_weak`, `is_torsion_free` and `verify_strict`.
|
|
7
|
+
*/
|
|
8
|
+
const BITS_PER_BYTE = 8;
|
|
9
|
+
const THREE = 3;
|
|
10
|
+
const FOUR = 4;
|
|
11
|
+
const EIGHT = 8;
|
|
12
|
+
const FIELD_BITS = 255;
|
|
13
|
+
const PRIME_OFFSET = 19;
|
|
14
|
+
const ORDER_BITS = 252;
|
|
15
|
+
const PUBLIC_KEY_BYTES = 32;
|
|
16
|
+
const SIGNATURE_BYTES = 64;
|
|
17
|
+
const BYTE_BITS = BigInt(BITS_PER_BYTE);
|
|
18
|
+
const SIGN_BIT_BYTE = 31;
|
|
19
|
+
const SIGN_BIT_MASK = 127;
|
|
20
|
+
const ZERO = BigInt(0);
|
|
21
|
+
const ONE = BigInt(1);
|
|
22
|
+
const TWO = BigInt(2);
|
|
23
|
+
/** The field prime, 2^255 - 19. */
|
|
24
|
+
const FIELD_PRIME = (ONE << BigInt(FIELD_BITS)) - BigInt(PRIME_OFFSET);
|
|
25
|
+
/** The order of the prime-order subgroup. */
|
|
26
|
+
const GROUP_ORDER = (ONE << BigInt(ORDER_BITS)) + BigInt("27742317777372353535851937790883648493");
|
|
27
|
+
/** The curve constant d = -121665 / 121666, as a field element. */
|
|
28
|
+
const CURVE_D = BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555");
|
|
29
|
+
/**
|
|
30
|
+
* The y coordinates of the eight small-order points: 0 (two points of order 4), 1 (the identity element), -1 (order 2) and the two pairs of order 8. Both signs of x share each y, so a key is small-order exactly when its y is one of these, whatever its sign bit.
|
|
31
|
+
*/
|
|
32
|
+
const SMALL_ORDER_Y = new Set([
|
|
33
|
+
"0",
|
|
34
|
+
"1",
|
|
35
|
+
"7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec",
|
|
36
|
+
"5fc536d880238b13933c6d305acdfd5f098eff289f4c345b027b2c28f95e826",
|
|
37
|
+
"7a03ac9277fdc74ec6cc392cfa53202a0f67100d760b3cba4fd84d3d706a17c7"
|
|
38
|
+
].map((hex) => BigInt(`0x${hex}`)));
|
|
39
|
+
function littleEndian(bytes) {
|
|
40
|
+
let value = ZERO;
|
|
41
|
+
for (let index = bytes.length - 1; index >= 0; index -= 1) value = value << BYTE_BITS | BigInt(bytes[index] ?? 0);
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
/** The y coordinate an encoding carries: the 255 low bits, with the sign bit of x cleared. */
|
|
45
|
+
function encodedY(encoding) {
|
|
46
|
+
const bytes = Uint8Array.from(encoding);
|
|
47
|
+
bytes[SIGN_BIT_BYTE] = (bytes[SIGN_BIT_BYTE] ?? 0) & SIGN_BIT_MASK;
|
|
48
|
+
return littleEndian(bytes);
|
|
49
|
+
}
|
|
50
|
+
function modPow(base, exponent) {
|
|
51
|
+
let result = ONE;
|
|
52
|
+
let factor = base % FIELD_PRIME;
|
|
53
|
+
let remaining = exponent;
|
|
54
|
+
while (remaining > ZERO) {
|
|
55
|
+
if ((remaining & ONE) === ONE) result = result * factor % FIELD_PRIME;
|
|
56
|
+
factor = factor * factor % FIELD_PRIME;
|
|
57
|
+
remaining >>= ONE;
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
function mod(value) {
|
|
62
|
+
const reduced = value % FIELD_PRIME;
|
|
63
|
+
return reduced >= ZERO ? reduced : reduced + FIELD_PRIME;
|
|
64
|
+
}
|
|
65
|
+
/** sqrt(-1) modulo the prime: 2^((p - 1) / 4). */
|
|
66
|
+
const SQRT_MINUS_ONE = modPow(TWO, (FIELD_PRIME - ONE) / BigInt(FOUR));
|
|
67
|
+
/** A point with the given y, with either sign of x (negating a point preserves its order, so the sign does not matter to a subgroup test), or `undefined` when no point has that y. */
|
|
68
|
+
function pointWithY(y) {
|
|
69
|
+
const ySquared = mod(y * y);
|
|
70
|
+
const target = mod(mod(ySquared - ONE) * modPow(mod(CURVE_D * ySquared + ONE), FIELD_PRIME - TWO));
|
|
71
|
+
const candidate = modPow(target, (FIELD_PRIME + BigInt(THREE)) / BigInt(EIGHT));
|
|
72
|
+
for (const x of [candidate, mod(candidate * SQRT_MINUS_ONE)]) if (mod(x * x) === target) return {
|
|
73
|
+
x,
|
|
74
|
+
y,
|
|
75
|
+
z: ONE,
|
|
76
|
+
t: mod(x * y)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** The sum of two points: the unified, complete addition of Hisil, Wong, Carter and Dawson for a = -1, which doubles as the doubling. */
|
|
80
|
+
function addPoints(p, q) {
|
|
81
|
+
const a = mod((p.y - p.x) * (q.y - q.x));
|
|
82
|
+
const b = mod((p.y + p.x) * (q.y + q.x));
|
|
83
|
+
const c = mod(p.t * TWO * CURVE_D * q.t);
|
|
84
|
+
const d = mod(p.z * TWO * q.z);
|
|
85
|
+
const e = b - a;
|
|
86
|
+
const f = d - c;
|
|
87
|
+
const g = d + c;
|
|
88
|
+
const h = b + a;
|
|
89
|
+
return {
|
|
90
|
+
x: mod(e * f),
|
|
91
|
+
y: mod(g * h),
|
|
92
|
+
z: mod(f * g),
|
|
93
|
+
t: mod(e * h)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const IDENTITY_POINT = {
|
|
97
|
+
x: ZERO,
|
|
98
|
+
y: ONE,
|
|
99
|
+
z: ONE,
|
|
100
|
+
t: ZERO
|
|
101
|
+
};
|
|
102
|
+
/** Whether the point is in the prime-order subgroup: multiplying it by the group order gives the identity element. The point and the order are public, so the double-and-add loop leaks nothing. It costs one doubling per bit of the order below the top (252) and one addition per set bit below the top (72), each a handful of field multiplications, once per distinct key. */
|
|
103
|
+
function isTorsionFree(point) {
|
|
104
|
+
let result = IDENTITY_POINT;
|
|
105
|
+
for (let bit = ORDER_BITS; bit >= 0; bit -= 1) {
|
|
106
|
+
result = addPoints(result, result);
|
|
107
|
+
if ((GROUP_ORDER >> BigInt(bit) & ONE) === ONE) result = addPoints(result, point);
|
|
108
|
+
}
|
|
109
|
+
return result.x === ZERO && result.y === result.z;
|
|
110
|
+
}
|
|
111
|
+
/** How many key verdicts are remembered, so a key that signs many messages is checked for torsion once and a flood of distinct keys cannot grow the memory without bound. */
|
|
112
|
+
const VERDICT_CAPACITY = 1024;
|
|
113
|
+
const verdicts = /* @__PURE__ */ new Map();
|
|
114
|
+
function keyFaultUncached(publicKey) {
|
|
115
|
+
if (publicKey.length !== PUBLIC_KEY_BYTES) return "wrong_size";
|
|
116
|
+
const y = encodedY(publicKey);
|
|
117
|
+
if (y >= FIELD_PRIME) return "non_canonical";
|
|
118
|
+
const point = pointWithY(y);
|
|
119
|
+
if (point === void 0) return "not_a_point";
|
|
120
|
+
if (SMALL_ORDER_Y.has(y)) return "small_order";
|
|
121
|
+
return isTorsionFree(point) ? void 0 : "mixed_order";
|
|
122
|
+
}
|
|
123
|
+
/** The first reason an Ed25519 identity-key's bytes are refused, or `undefined` for a usable key. The checks are independent of the platform's crypto library, and the verdict for a key is remembered (the least recently used first goes once more than a fixed number are held), so verifying many signatures under one key tests it for torsion once. */
|
|
124
|
+
function ed25519KeyFault(publicKey) {
|
|
125
|
+
if (publicKey.length !== PUBLIC_KEY_BYTES) return "wrong_size";
|
|
126
|
+
const id = bytesToHex(publicKey);
|
|
127
|
+
if (verdicts.has(id)) {
|
|
128
|
+
const held = verdicts.get(id);
|
|
129
|
+
verdicts.delete(id);
|
|
130
|
+
verdicts.set(id, held);
|
|
131
|
+
return held;
|
|
132
|
+
}
|
|
133
|
+
const fault = keyFaultUncached(publicKey);
|
|
134
|
+
verdicts.set(id, fault);
|
|
135
|
+
for (const oldest of verdicts.keys()) {
|
|
136
|
+
if (verdicts.size <= VERDICT_CAPACITY) break;
|
|
137
|
+
verdicts.delete(oldest);
|
|
138
|
+
}
|
|
139
|
+
return fault;
|
|
140
|
+
}
|
|
141
|
+
/** Whether a 64-byte Ed25519 signature is acceptable to verify: S below the group order, and R a canonical encoding of a point that is not of small order. A signature that fails this does not verify, whatever the platform's library would say. */
|
|
142
|
+
function ed25519SignatureIsStrict(signature) {
|
|
143
|
+
if (signature.length !== SIGNATURE_BYTES) return false;
|
|
144
|
+
const r = signature.subarray(0, PUBLIC_KEY_BYTES);
|
|
145
|
+
const s = signature.subarray(PUBLIC_KEY_BYTES);
|
|
146
|
+
const rY = encodedY(r);
|
|
147
|
+
return littleEndian(s) < GROUP_ORDER && rY < FIELD_PRIME && !SMALL_ORDER_Y.has(rY);
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
export { ed25519KeyFault, ed25519SignatureIsStrict };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, et as PeerAdvert } from "../protocol-
|
|
1
|
+
import { D as DeviceId, et as PeerAdvert } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
import { MeshSession } from "./mesh-session.cjs";
|
|
3
3
|
//#region src/domain/gossip-expansion.d.ts
|
|
4
4
|
/** One not-yet-considered device this session's gossip directory has surfaced, carrying only what a dial/trust decision needs: the device-id to decide identity, and the "host:port" addresses its own peer-advert claims are directly reachable at, in the order it advertised them. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, et as PeerAdvert } from "../protocol-
|
|
1
|
+
import { D as DeviceId, et as PeerAdvert } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
import { MeshSession } from "./mesh-session.mjs";
|
|
3
3
|
//#region src/domain/gossip-expansion.d.ts
|
|
4
4
|
/** One not-yet-considered device this session's gossip directory has surfaced, carrying only what a dial/trust decision needs: the device-id to decide identity, and the "host:port" addresses its own peer-advert claims are directly reachable at, in the order it advertised them. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, f as CapabilityScope } from "../protocol-
|
|
1
|
+
import { D as DeviceId, f as CapabilityScope } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
import { DirectoryEntry, MeshSession } from "./mesh-session.cjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/domain/grant-candidates.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, f as CapabilityScope } from "../protocol-
|
|
1
|
+
import { D as DeviceId, f as CapabilityScope } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
import { DirectoryEntry, MeshSession } from "./mesh-session.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/domain/grant-candidates.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DomainId, R as HandshakeFrame, lt as ProtocolVersion } from "../protocol-
|
|
1
|
+
import { A as DomainId, R as HandshakeFrame, lt as ProtocolVersion } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
//#region src/domain/handshake.d.ts
|
|
3
3
|
/** The highest protocol version this build of core understands. */
|
|
4
4
|
export declare const SUPPORTED_PROTOCOL_VERSION: ProtocolVersion;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DomainId, R as HandshakeFrame, lt as ProtocolVersion } from "../protocol-
|
|
1
|
+
import { A as DomainId, R as HandshakeFrame, lt as ProtocolVersion } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
//#region src/domain/handshake.d.ts
|
|
3
3
|
/** The highest protocol version this build of core understands. */
|
|
4
4
|
export declare const SUPPORTED_PROTOCOL_VERSION: ProtocolVersion;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-
|
|
1
|
+
import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
import { t as KeyValueStorage } from "../storage-jbGFAYIV.cjs";
|
|
3
3
|
//#region src/domain/hub-mailbox.d.ts
|
|
4
4
|
export interface MailboxLimits {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-
|
|
1
|
+
import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
import { t as KeyValueStorage } from "../storage-jbGFAYIV.mjs";
|
|
3
3
|
//#region src/domain/hub-mailbox.d.ts
|
|
4
4
|
export interface MailboxLimits {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_adapters_frame_codec = require("../adapters/frame-codec.cjs");
|
|
3
|
-
const require_ports_identity = require("../ports/identity.cjs");
|
|
4
3
|
const require_domain_device_id = require("./device-id.cjs");
|
|
4
|
+
const require_ports_identity = require("../ports/identity.cjs");
|
|
5
5
|
const require_domain_token_scope = require("./token-scope.cjs");
|
|
6
6
|
const require_gossip_extensions = require("../gossip-extensions-BBYgMZ2N.cjs");
|
|
7
7
|
const require_domain_peer_advert = require("./peer-advert.cjs");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, bt as RevocationEntry, et as PeerAdvert, f as CapabilityScope, g as CoordinatorFrame, lt as ProtocolVersion, nn as TopologyPeers, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-
|
|
2
|
-
import { r as Transport, t as Connection } from "../transport-
|
|
3
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, bt as RevocationEntry, et as PeerAdvert, f as CapabilityScope, g as CoordinatorFrame, lt as ProtocolVersion, nn as TopologyPeers, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { r as Transport, t as Connection } from "../transport-DaeS9N-o.cjs";
|
|
3
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
4
4
|
import { t as Clock } from "../clock-DhUPRfLh.cjs";
|
|
5
5
|
//#region src/domain/mesh-session.d.ts
|
|
6
6
|
/** How long to wait for the node's handshake before calling it unanswered. A relay-only node never sends one; that is a state to display, not an error. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, bt as RevocationEntry, et as PeerAdvert, f as CapabilityScope, g as CoordinatorFrame, lt as ProtocolVersion, nn as TopologyPeers, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-
|
|
2
|
-
import { r as Transport, t as Connection } from "../transport-
|
|
3
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, E as DataRequestFrame, N as Frame, T as DataHaveFrame, U as ManageError, V as ManageCommand, W as ManageOk, bt as RevocationEntry, et as PeerAdvert, f as CapabilityScope, g as CoordinatorFrame, lt as ProtocolVersion, nn as TopologyPeers, p as CapabilityToken, w as DataEntriesFrame } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { r as Transport, t as Connection } from "../transport-CAD419ge.mjs";
|
|
3
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
4
4
|
import { t as Clock } from "../clock-DhUPRfLh.mjs";
|
|
5
5
|
//#region src/domain/mesh-session.d.ts
|
|
6
6
|
/** How long to wait for the node's handshake before calling it unanswered. A relay-only node never sends one; that is a state to display, not an error. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { messageFromFrame, tryDecodeFrame, wrapRelayData } from "../adapters/frame-codec.mjs";
|
|
2
|
-
import { IdentityKeyError } from "../ports/identity.mjs";
|
|
3
2
|
import { deviceIdToHex } from "./device-id.mjs";
|
|
3
|
+
import { IdentityKeyError } from "../ports/identity.mjs";
|
|
4
4
|
import { bytesEqual } from "./token-scope.mjs";
|
|
5
5
|
import { a as OWN_VERSION, i as CORE_VERSION_GOSSIP_KEY, n as TOPOLOGY_PEERS_GOSSIP_KEY, o as isVersionGetCommand, r as validateGossipExtensions, s as versionGetOutcome } from "../gossip-extensions-B6WJjkAr.mjs";
|
|
6
6
|
import { signPeerAdvert, verifyPeerAdvert } from "./peer-advert.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DeviceId, Ot as RoomNotice, T as DataHaveFrame, kt as RoomNoticeClaims, p as CapabilityToken } from "../protocol-
|
|
1
|
+
import { D as DeviceId, Ot as RoomNotice, T as DataHaveFrame, kt as RoomNoticeClaims, p as CapabilityToken } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
import { t as KeyValueStorage } from "../storage-jbGFAYIV.cjs";
|
|
3
|
-
import { r as IdentityPort } from "../identity-
|
|
3
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
4
4
|
import { t as Clock } from "../clock-DhUPRfLh.cjs";
|
|
5
5
|
import { RevocationCheck } from "./tokens.cjs";
|
|
6
6
|
import { RoomNoticeVerdictReason } from "./room.cjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DeviceId, Ot as RoomNotice, T as DataHaveFrame, kt as RoomNoticeClaims, p as CapabilityToken } from "../protocol-
|
|
1
|
+
import { D as DeviceId, Ot as RoomNotice, T as DataHaveFrame, kt as RoomNoticeClaims, p as CapabilityToken } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
import { t as KeyValueStorage } from "../storage-jbGFAYIV.mjs";
|
|
3
|
-
import { r as IdentityPort } from "../identity-
|
|
3
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
4
4
|
import { t as Clock } from "../clock-DhUPRfLh.mjs";
|
|
5
5
|
import { RevocationCheck } from "./tokens.mjs";
|
|
6
6
|
import { RoomNoticeVerdictReason } from "./room.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, H as ManageCommandParams, Q as PathTrace, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
1
|
+
import { D as DeviceId, H as ManageCommandParams, Q as PathTrace, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
import { t as Clock } from "../clock-DhUPRfLh.cjs";
|
|
3
3
|
import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.cjs";
|
|
4
4
|
//#region src/domain/path-trace.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, H as ManageCommandParams, Q as PathTrace, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
1
|
+
import { D as DeviceId, H as ManageCommandParams, Q as PathTrace, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
import { t as Clock } from "../clock-DhUPRfLh.mjs";
|
|
3
3
|
import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.mjs";
|
|
4
4
|
//#region src/domain/path-trace.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as IdentityKey, D as DeviceId, et as PeerAdvert } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { B as IdentityKey, D as DeviceId, et as PeerAdvert } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
3
3
|
//#region src/domain/peer-advert.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* The most a verifier's verdict memo may charge across all its entries, in bytes of key.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as IdentityKey, D as DeviceId, et as PeerAdvert } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { B as IdentityKey, D as DeviceId, et as PeerAdvert } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
3
3
|
//#region src/domain/peer-advert.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* The most a verifier's verdict memo may charge across all its entries, in bytes of key.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { et as PeerAdvert } from "../protocol-
|
|
1
|
+
import { et as PeerAdvert } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
//#region src/domain/relay-advert.d.ts
|
|
3
3
|
/** The domain-qualified gossip extension key a node's relay offer rides under, the same `wire-mesh` domain the core's own gossiped version fact occupies. */
|
|
4
4
|
export declare const RELAY_OFFER_GOSSIP_KEY = "wire-mesh/relay-offer";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { et as PeerAdvert } from "../protocol-
|
|
1
|
+
import { et as PeerAdvert } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
//#region src/domain/relay-advert.d.ts
|
|
3
3
|
/** The domain-qualified gossip extension key a node's relay offer rides under, the same `wire-mesh` domain the core's own gossiped version fact occupies. */
|
|
4
4
|
export declare const RELAY_OFFER_GOSSIP_KEY = "wire-mesh/relay-offer";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame, et as PeerAdvert } from "../protocol-
|
|
2
|
-
import { t as Connection } from "../transport-
|
|
1
|
+
import { D as DeviceId, N as Frame, et as PeerAdvert } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { t as Connection } from "../transport-DaeS9N-o.cjs";
|
|
3
3
|
import { AdvertExtensionPolicy } from "./advert-extension-policy.cjs";
|
|
4
4
|
import { Mailbox, MailboxRefusalReason } from "./hub-mailbox.cjs";
|
|
5
5
|
import { PeerAdvertVerifier } from "./peer-advert.cjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame, et as PeerAdvert } from "../protocol-
|
|
2
|
-
import { t as Connection } from "../transport-
|
|
1
|
+
import { D as DeviceId, N as Frame, et as PeerAdvert } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { t as Connection } from "../transport-CAD419ge.mjs";
|
|
3
3
|
import { AdvertExtensionPolicy } from "./advert-extension-policy.mjs";
|
|
4
4
|
import { Mailbox, MailboxRefusalReason } from "./hub-mailbox.mjs";
|
|
5
5
|
import { PeerAdvertVerifier } from "./peer-advert.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as Frame } from "../protocol-
|
|
2
|
-
import { t as Connection } from "../transport-
|
|
1
|
+
import { N as Frame } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { t as Connection } from "../transport-DaeS9N-o.cjs";
|
|
3
3
|
//#region src/domain/relay-use-gate.d.ts
|
|
4
4
|
export interface RelayUseAuthorizationTracker {
|
|
5
5
|
/** True once authorize() has been called for this exact connection and revoke() has not been called since. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as Frame } from "../protocol-
|
|
2
|
-
import { t as Connection } from "../transport-
|
|
1
|
+
import { N as Frame } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { t as Connection } from "../transport-CAD419ge.mjs";
|
|
3
3
|
//#region src/domain/relay-use-gate.d.ts
|
|
4
4
|
export interface RelayUseAuthorizationTracker {
|
|
5
5
|
/** True once authorize() has been called for this exact connection and revoke() has not been called since. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bt as RevocationEntry } from "../protocol-
|
|
1
|
+
import { bt as RevocationEntry } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
import { RevocationCheck, RevocationEntryVerdict, VerifyRevocationEntryOptions } from "./tokens.cjs";
|
|
3
3
|
//#region src/domain/revocation-view.d.ts
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bt as RevocationEntry } from "../protocol-
|
|
1
|
+
import { bt as RevocationEntry } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
import { RevocationCheck, RevocationEntryVerdict, VerifyRevocationEntryOptions } from "./tokens.mjs";
|
|
3
3
|
//#region src/domain/revocation-view.d.ts
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, p as CapabilityToken } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DhUPRfLh.cjs";
|
|
4
4
|
import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.cjs";
|
|
5
5
|
import { RevocationCheck } from "./tokens.cjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, p as CapabilityToken } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DhUPRfLh.mjs";
|
|
4
4
|
import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.mjs";
|
|
5
5
|
import { RevocationCheck } from "./tokens.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as verifyRoomToken, i as VerifyRoomTokenOptions, n as RoomTokenVerdict, r as RoomTokenVerdictReason, t as ROOM_MEMBER_CAPABILITY } from "../room-token-verification-
|
|
1
|
+
import { a as verifyRoomToken, i as VerifyRoomTokenOptions, n as RoomTokenVerdict, r as RoomTokenVerdictReason, t as ROOM_MEMBER_CAPABILITY } from "../room-token-verification-DuXqERah.cjs";
|
|
2
2
|
export { ROOM_MEMBER_CAPABILITY, RoomTokenVerdict, RoomTokenVerdictReason, VerifyRoomTokenOptions, verifyRoomToken };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as verifyRoomToken, i as VerifyRoomTokenOptions, n as RoomTokenVerdict, r as RoomTokenVerdictReason, t as ROOM_MEMBER_CAPABILITY } from "../room-token-verification-
|
|
1
|
+
import { a as verifyRoomToken, i as VerifyRoomTokenOptions, n as RoomTokenVerdict, r as RoomTokenVerdictReason, t as ROOM_MEMBER_CAPABILITY } from "../room-token-verification-B1doIXmJ.mjs";
|
|
2
2
|
export { ROOM_MEMBER_CAPABILITY, RoomTokenVerdict, RoomTokenVerdictReason, VerifyRoomTokenOptions, verifyRoomToken };
|
package/dist/domain/room.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_generated_protocol = require("../generated/protocol.cjs");
|
|
3
|
+
const require_ports_identity = require("../ports/identity.cjs");
|
|
3
4
|
const require_domain_group_key = require("./group-key.cjs");
|
|
4
5
|
const require_domain_room_token_verification = require("./room-token-verification.cjs");
|
|
5
6
|
let cbor2 = require("cbor2");
|
|
@@ -79,7 +80,7 @@ async function verifyRoomNotice(notice, options) {
|
|
|
79
80
|
ok: false,
|
|
80
81
|
reason: "wrong_room"
|
|
81
82
|
};
|
|
82
|
-
if (!await options.identity
|
|
83
|
+
if (!await require_ports_identity.verifiesOrRefuses(options.identity, claims["poster-key"], sig1ToBeSigned(protectedHeader, payload), signature)) return {
|
|
83
84
|
ok: false,
|
|
84
85
|
reason: "bad_signature"
|
|
85
86
|
};
|
package/dist/domain/room.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { At as RoomPath, Ot as RoomNotice, kt as RoomNoticeClaims, p as CapabilityToken, q as MessageRef } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { At as RoomPath, Ot as RoomNotice, kt as RoomNoticeClaims, p as CapabilityToken, q as MessageRef } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DhUPRfLh.cjs";
|
|
4
4
|
import { RevocationCheck } from "./tokens.cjs";
|
|
5
|
-
import { r as RoomTokenVerdictReason } from "../room-token-verification-
|
|
5
|
+
import { r as RoomTokenVerdictReason } from "../room-token-verification-DuXqERah.cjs";
|
|
6
6
|
//#region src/domain/room.d.ts
|
|
7
7
|
export type RoomNoticeVerdictReason = "malformed" | "wrong_room" | "bad_signature" | "wrong_poster" | "content_expired" | "key_epoch_mismatch" | RoomTokenVerdictReason;
|
|
8
8
|
export type RoomNoticeVerdict = {
|
package/dist/domain/room.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { At as RoomPath, Ot as RoomNotice, kt as RoomNoticeClaims, p as CapabilityToken, q as MessageRef } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { At as RoomPath, Ot as RoomNotice, kt as RoomNoticeClaims, p as CapabilityToken, q as MessageRef } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DhUPRfLh.mjs";
|
|
4
4
|
import { RevocationCheck } from "./tokens.mjs";
|
|
5
|
-
import { r as RoomTokenVerdictReason } from "../room-token-verification-
|
|
5
|
+
import { r as RoomTokenVerdictReason } from "../room-token-verification-B1doIXmJ.mjs";
|
|
6
6
|
//#region src/domain/room.d.ts
|
|
7
7
|
export type RoomNoticeVerdictReason = "malformed" | "wrong_room" | "bad_signature" | "wrong_poster" | "content_expired" | "key_epoch_mismatch" | RoomTokenVerdictReason;
|
|
8
8
|
export type RoomNoticeVerdict = {
|
package/dist/domain/room.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { roomNoticeClaimsSchema } from "../generated/protocol.mjs";
|
|
2
|
+
import { verifiesOrRefuses } from "../ports/identity.mjs";
|
|
2
3
|
import { isEncryptedContentType } from "./group-key.mjs";
|
|
3
4
|
import { verifyRoomToken } from "./room-token-verification.mjs";
|
|
4
5
|
import { cdeDecodeOptions, cdeEncodeOptions, decode, encode } from "cbor2";
|
|
@@ -78,7 +79,7 @@ async function verifyRoomNotice(notice, options) {
|
|
|
78
79
|
ok: false,
|
|
79
80
|
reason: "wrong_room"
|
|
80
81
|
};
|
|
81
|
-
if (!await options.identity
|
|
82
|
+
if (!await verifiesOrRefuses(options.identity, claims["poster-key"], sig1ToBeSigned(protectedHeader, payload), signature)) return {
|
|
82
83
|
ok: false,
|
|
83
84
|
reason: "bad_signature"
|
|
84
85
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
1
|
+
import { D as DeviceId } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
import { PresentedShard, ShardConfig } from "./erasure-coding.cjs";
|
|
3
3
|
//#region src/domain/shard-manifest.d.ts
|
|
4
4
|
/** The content-type a core/data entry carrying a shard manifest declares. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
1
|
+
import { D as DeviceId } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
import { PresentedShard, ShardConfig } from "./erasure-coding.mjs";
|
|
3
3
|
//#region src/domain/shard-manifest.d.ts
|
|
4
4
|
/** The content-type a core/data entry carrying a shard manifest declares. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as evaluateConditions, a as DEPTH_REMAINING, c as GRANTEE_IS, d as NarrowingSystem, f as SCOPE_NARROWS, g as conditionsListSchema, h as TokenPredicateContext, i as ConditionsVerdict, l as GrantSubject, m as TokenDelegateHandler, n as CAPABILITY_IS, o as EXPIRES_AT, p as SubjectSystem, r as ConditionsContext, s as GRANTED_CAPABILITY_IS, t as BEARER_IS, u as NarrowingCandidate, v as evaluateNarrowing, y as noSelfGrantBar } from "../token-predicates-
|
|
1
|
+
import { _ as evaluateConditions, a as DEPTH_REMAINING, c as GRANTEE_IS, d as NarrowingSystem, f as SCOPE_NARROWS, g as conditionsListSchema, h as TokenPredicateContext, i as ConditionsVerdict, l as GrantSubject, m as TokenDelegateHandler, n as CAPABILITY_IS, o as EXPIRES_AT, p as SubjectSystem, r as ConditionsContext, s as GRANTED_CAPABILITY_IS, t as BEARER_IS, u as NarrowingCandidate, v as evaluateNarrowing, y as noSelfGrantBar } from "../token-predicates-ooQCcAZm.cjs";
|
|
2
2
|
export { BEARER_IS, CAPABILITY_IS, ConditionsContext, ConditionsVerdict, DEPTH_REMAINING, EXPIRES_AT, GRANTED_CAPABILITY_IS, GRANTEE_IS, GrantSubject, NarrowingCandidate, NarrowingSystem, SCOPE_NARROWS, SubjectSystem, TokenDelegateHandler, TokenPredicateContext, conditionsListSchema, evaluateConditions, evaluateNarrowing, noSelfGrantBar };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as evaluateConditions, a as DEPTH_REMAINING, c as GRANTEE_IS, d as NarrowingSystem, f as SCOPE_NARROWS, g as conditionsListSchema, h as TokenPredicateContext, i as ConditionsVerdict, l as GrantSubject, m as TokenDelegateHandler, n as CAPABILITY_IS, o as EXPIRES_AT, p as SubjectSystem, r as ConditionsContext, s as GRANTED_CAPABILITY_IS, t as BEARER_IS, u as NarrowingCandidate, v as evaluateNarrowing, y as noSelfGrantBar } from "../token-predicates-
|
|
1
|
+
import { _ as evaluateConditions, a as DEPTH_REMAINING, c as GRANTEE_IS, d as NarrowingSystem, f as SCOPE_NARROWS, g as conditionsListSchema, h as TokenPredicateContext, i as ConditionsVerdict, l as GrantSubject, m as TokenDelegateHandler, n as CAPABILITY_IS, o as EXPIRES_AT, p as SubjectSystem, r as ConditionsContext, s as GRANTED_CAPABILITY_IS, t as BEARER_IS, u as NarrowingCandidate, v as evaluateNarrowing, y as noSelfGrantBar } from "../token-predicates-CS4DprDE.mjs";
|
|
2
2
|
export { BEARER_IS, CAPABILITY_IS, ConditionsContext, ConditionsVerdict, DEPTH_REMAINING, EXPIRES_AT, GRANTED_CAPABILITY_IS, GRANTEE_IS, GrantSubject, NarrowingCandidate, NarrowingSystem, SCOPE_NARROWS, SubjectSystem, TokenDelegateHandler, TokenPredicateContext, conditionsListSchema, evaluateConditions, evaluateNarrowing, noSelfGrantBar };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { en as TokenClaims } from "../protocol-
|
|
1
|
+
import { en as TokenClaims } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
//#region src/domain/token-scope.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Extracted out of tokens.ts specifically so token-predicates.ts (the generic evaluator's own delegate handlers) and tokens.ts (the chain walk, and its re-export for capability-grant.ts) can both depend on this pure, no-domain-imports module without creating an import cycle between the two -- tokens.ts imports evaluateNarrowing from token-predicates.ts, and token-predicates.ts's own scope-narrows/bearer-is handlers need these exact comparisons, so neither of those two files may import the other.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { en as TokenClaims } from "../protocol-
|
|
1
|
+
import { en as TokenClaims } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
//#region src/domain/token-scope.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Extracted out of tokens.ts specifically so token-predicates.ts (the generic evaluator's own delegate handlers) and tokens.ts (the chain walk, and its re-export for capability-grant.ts) can both depend on this pure, no-domain-imports module without creating an import cycle between the two -- tokens.ts imports evaluateNarrowing from token-predicates.ts, and token-predicates.ts's own scope-narrows/bearer-is handlers need these exact comparisons, so neither of those two files may import the other.
|
package/dist/domain/tokens.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_generated_protocol = require("../generated/protocol.cjs");
|
|
3
3
|
const require_domain_device_id = require("./device-id.cjs");
|
|
4
|
+
const require_ports_identity = require("../ports/identity.cjs");
|
|
4
5
|
const require_sequential = require("../sequential-CtQVlW8M.cjs");
|
|
5
6
|
const require_domain_token_scope = require("./token-scope.cjs");
|
|
6
7
|
const require_domain_token_predicates = require("./token-predicates.cjs");
|
|
@@ -118,7 +119,7 @@ async function verifyTokenChain(token, options, { subjectClaims, depth, seen } =
|
|
|
118
119
|
reason: "malformed"
|
|
119
120
|
};
|
|
120
121
|
const claims = claimsResult.data;
|
|
121
|
-
if (!await options.identity
|
|
122
|
+
if (!await require_ports_identity.verifiesOrRefuses(options.identity, claims["issuer-key"], sig1ToBeSigned(protectedHeader, payload), signature)) return {
|
|
122
123
|
ok: false,
|
|
123
124
|
reason: "bad_signature"
|
|
124
125
|
};
|
|
@@ -299,7 +300,7 @@ async function verifyRevocationEntry(entry, options) {
|
|
|
299
300
|
reason: "malformed"
|
|
300
301
|
};
|
|
301
302
|
const claims = claimsResult.data;
|
|
302
|
-
if (!await options.identity
|
|
303
|
+
if (!await require_ports_identity.verifiesOrRefuses(options.identity, claims["issuer-key"], sig1ToBeSigned(protectedHeader, payload), signature)) return {
|
|
303
304
|
ok: false,
|
|
304
305
|
reason: "bad_signature"
|
|
305
306
|
};
|
package/dist/domain/tokens.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as IdentityKey, D as DeviceId, bt as RevocationEntry, en as TokenClaims, p as CapabilityToken, yt as RevocationClaims } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { B as IdentityKey, D as DeviceId, bt as RevocationEntry, en as TokenClaims, p as CapabilityToken, yt as RevocationClaims } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DhUPRfLh.cjs";
|
|
4
|
-
import { l as GrantSubject, m as TokenDelegateHandler, r as ConditionsContext, u as NarrowingCandidate } from "../token-predicates-
|
|
4
|
+
import { l as GrantSubject, m as TokenDelegateHandler, r as ConditionsContext, u as NarrowingCandidate } from "../token-predicates-ooQCcAZm.cjs";
|
|
5
5
|
import { PredicateNode } from "trilean";
|
|
6
6
|
//#region src/domain/tokens.d.ts
|
|
7
7
|
/** The capability verb of a grant-capability (wire-mesh#323): authority to mint other capability tokens, the same register manage:revoke already established for authority over tokens. */
|
package/dist/domain/tokens.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as IdentityKey, D as DeviceId, bt as RevocationEntry, en as TokenClaims, p as CapabilityToken, yt as RevocationClaims } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { B as IdentityKey, D as DeviceId, bt as RevocationEntry, en as TokenClaims, p as CapabilityToken, yt as RevocationClaims } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DhUPRfLh.mjs";
|
|
4
|
-
import { l as GrantSubject, m as TokenDelegateHandler, r as ConditionsContext, u as NarrowingCandidate } from "../token-predicates-
|
|
4
|
+
import { l as GrantSubject, m as TokenDelegateHandler, r as ConditionsContext, u as NarrowingCandidate } from "../token-predicates-CS4DprDE.mjs";
|
|
5
5
|
import { PredicateNode } from "trilean";
|
|
6
6
|
//#region src/domain/tokens.d.ts
|
|
7
7
|
/** The capability verb of a grant-capability (wire-mesh#323): authority to mint other capability tokens, the same register manage:revoke already established for authority over tokens. */
|
package/dist/domain/tokens.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { capabilityTokenSchema, capabilityVerbSchema, revocationClaimsSchema, tokenClaimsSchema } from "../generated/protocol.mjs";
|
|
2
2
|
import { bytesToHex } from "./device-id.mjs";
|
|
3
|
+
import { verifiesOrRefuses } from "../ports/identity.mjs";
|
|
3
4
|
import { n as firstAsync } from "../sequential-D_W3THly.mjs";
|
|
4
5
|
import { bytesEqual, scopeNarrows } from "./token-scope.mjs";
|
|
5
6
|
import { conditionsListSchema, evaluateConditions, evaluateNarrowing } from "./token-predicates.mjs";
|
|
@@ -117,7 +118,7 @@ async function verifyTokenChain(token, options, { subjectClaims, depth, seen } =
|
|
|
117
118
|
reason: "malformed"
|
|
118
119
|
};
|
|
119
120
|
const claims = claimsResult.data;
|
|
120
|
-
if (!await options.identity
|
|
121
|
+
if (!await verifiesOrRefuses(options.identity, claims["issuer-key"], sig1ToBeSigned(protectedHeader, payload), signature)) return {
|
|
121
122
|
ok: false,
|
|
122
123
|
reason: "bad_signature"
|
|
123
124
|
};
|
|
@@ -298,7 +299,7 @@ async function verifyRevocationEntry(entry, options) {
|
|
|
298
299
|
reason: "malformed"
|
|
299
300
|
};
|
|
300
301
|
const claims = claimsResult.data;
|
|
301
|
-
if (!await options.identity
|
|
302
|
+
if (!await verifiesOrRefuses(options.identity, claims["issuer-key"], sig1ToBeSigned(protectedHeader, payload), signature)) return {
|
|
302
303
|
ok: false,
|
|
303
304
|
reason: "bad_signature"
|
|
304
305
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, nn as TopologyPeers } from "../protocol-
|
|
1
|
+
import { D as DeviceId, nn as TopologyPeers } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
//#region src/domain/topology-snapshot.d.ts
|
|
3
3
|
export interface TopologyPeersInputs {
|
|
4
4
|
/** connection?.peerDeviceId -- the transport-authenticated direct peer, when the adapter gives one. Takes priority over firstAdvertisedPeer below. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, nn as TopologyPeers } from "../protocol-
|
|
1
|
+
import { D as DeviceId, nn as TopologyPeers } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
//#region src/domain/topology-snapshot.d.ts
|
|
3
3
|
export interface TopologyPeersInputs {
|
|
4
4
|
/** connection?.peerDeviceId -- the transport-authenticated direct peer, when the adapter gives one. Takes priority over firstAdvertisedPeer below. */
|