wire-mesh-core 1.9.0 → 1.11.0
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/frame-codec.d.cts +1 -1
- package/dist/adapters/frame-codec.d.mts +1 -1
- package/dist/adapters/node-identity.d.cts +2 -2
- package/dist/adapters/node-identity.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/handshake.d.cts +1 -1
- package/dist/domain/handshake.d.mts +1 -1
- package/dist/domain/mesh-session.d.cts +2 -2
- package/dist/domain/mesh-session.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-token-verification.d.cts +1 -1
- package/dist/domain/room-token-verification.d.mts +1 -1
- package/dist/domain/tokens.cjs +29 -19
- package/dist/domain/tokens.d.cts +15 -2
- package/dist/domain/tokens.d.mts +15 -2
- package/dist/domain/tokens.mjs +29 -20
- package/dist/generated/protocol.cjs +2 -1
- package/dist/generated/protocol.d.cts +1 -1
- package/dist/generated/protocol.d.mts +1 -1
- package/dist/generated/protocol.mjs +2 -1
- package/dist/{identity-CedN2RyT.d.cts → identity-B9KsQUyZ.d.cts} +1 -1
- package/dist/{identity-CuNm8s38.d.mts → identity-C65L-kBf.d.mts} +1 -1
- package/dist/ports/identity.d.cts +1 -1
- package/dist/ports/identity.d.mts +1 -1
- package/dist/ports/transport.d.cts +1 -1
- package/dist/ports/transport.d.mts +1 -1
- package/dist/{protocol-CrX3Du0D.d.cts → protocol-CfYGYN0o.d.cts} +6 -0
- package/dist/{protocol-CrX3Du0D.d.mts → protocol-CfYGYN0o.d.mts} +6 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as Frame } from "../protocol-
|
|
1
|
+
import { E as Frame } from "../protocol-CfYGYN0o.cjs";
|
|
2
2
|
//#region src/adapters/frame-codec.d.ts
|
|
3
3
|
export declare function messageFromFrame(frame: Frame): Uint8Array<ArrayBuffer>;
|
|
4
4
|
/** A frame that fails schema validation, caught separately from a decode failure so it can be dropped without disconnecting. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as Frame } from "../protocol-
|
|
1
|
+
import { E as Frame } from "../protocol-CfYGYN0o.mjs";
|
|
2
2
|
//#region src/adapters/frame-codec.d.ts
|
|
3
3
|
export declare function messageFromFrame(frame: Frame): Uint8Array<ArrayBuffer>;
|
|
4
4
|
/** A frame that fails schema validation, caught separately from a decode failure so it can be dropped without disconnecting. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as IdentityKey, b as DeviceId } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { N as IdentityKey, b as DeviceId } from "../protocol-CfYGYN0o.cjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-B9KsQUyZ.cjs";
|
|
3
3
|
import { webcrypto } from "node:crypto";
|
|
4
4
|
//#region src/adapters/node-identity.d.ts
|
|
5
5
|
export declare function deriveDeviceId(publicKey: Uint8Array): Promise<DeviceId>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as IdentityKey, b as DeviceId } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { N as IdentityKey, b as DeviceId } from "../protocol-CfYGYN0o.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-C65L-kBf.mjs";
|
|
3
3
|
import { webcrypto } from "node:crypto";
|
|
4
4
|
//#region src/adapters/node-identity.d.ts
|
|
5
5
|
export declare function deriveDeviceId(publicKey: Uint8Array): Promise<DeviceId>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as DeviceId } from "../protocol-
|
|
1
|
+
import { b as DeviceId } from "../protocol-CfYGYN0o.cjs";
|
|
2
2
|
//#region src/domain/device-id.d.ts
|
|
3
3
|
/** Lowercase, byte-exact hex for an arbitrary-length byte string -- the same encoding convention deviceIdToHex uses for the fixed-length device-id case, extracted so any other byte string needing a stable, displayable, map-keyable text form (e.g. a token-id, which tokens.cddl defines as an arbitrary-length bstr rather than a 32-byte device-id) can use the identical convention without going through a device-id-shaped function. */
|
|
4
4
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as DeviceId } from "../protocol-
|
|
1
|
+
import { b as DeviceId } from "../protocol-CfYGYN0o.mjs";
|
|
2
2
|
//#region src/domain/device-id.d.ts
|
|
3
3
|
/** Lowercase, byte-exact hex for an arbitrary-length byte string -- the same encoding convention deviceIdToHex uses for the fixed-length device-id case, extracted so any other byte string needing a stable, displayable, map-keyable text form (e.g. a token-id, which tokens.cddl defines as an arbitrary-length bstr rather than a 32-byte device-id) can use the identical convention without going through a device-id-shaped function. */
|
|
4
4
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as ProtocolVersion, C as DomainId, j as HandshakeFrame } from "../protocol-
|
|
1
|
+
import { $ as ProtocolVersion, C as DomainId, j as HandshakeFrame } from "../protocol-CfYGYN0o.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 { $ as ProtocolVersion, C as DomainId, j as HandshakeFrame } from "../protocol-
|
|
1
|
+
import { $ as ProtocolVersion, C as DomainId, j as HandshakeFrame } from "../protocol-CfYGYN0o.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,5 +1,5 @@
|
|
|
1
|
-
import { $ as ProtocolVersion, E as Frame, G as PeerAdvert, I as ManageError, L as ManageOk, P as ManageCommand, a as CapabilityScope, b as DeviceId, o as CapabilityToken, ut as RevocationEntry } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { $ as ProtocolVersion, E as Frame, G as PeerAdvert, I as ManageError, L as ManageOk, P as ManageCommand, a as CapabilityScope, b as DeviceId, o as CapabilityToken, ut as RevocationEntry } from "../protocol-CfYGYN0o.cjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-B9KsQUyZ.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.cjs";
|
|
4
4
|
import { Connection, Transport } from "../ports/transport.cjs";
|
|
5
5
|
//#region src/domain/mesh-session.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as ProtocolVersion, E as Frame, G as PeerAdvert, I as ManageError, L as ManageOk, P as ManageCommand, a as CapabilityScope, b as DeviceId, o as CapabilityToken, ut as RevocationEntry } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { $ as ProtocolVersion, E as Frame, G as PeerAdvert, I as ManageError, L as ManageOk, P as ManageCommand, a as CapabilityScope, b as DeviceId, o as CapabilityToken, ut as RevocationEntry } from "../protocol-CfYGYN0o.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-C65L-kBf.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.mjs";
|
|
4
4
|
import { Connection, Transport } from "../ports/transport.mjs";
|
|
5
5
|
//#region src/domain/mesh-session.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ut as RevocationEntry } from "../protocol-
|
|
1
|
+
import { ut as RevocationEntry } from "../protocol-CfYGYN0o.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 { ut as RevocationEntry } from "../protocol-
|
|
1
|
+
import { ut as RevocationEntry } from "../protocol-CfYGYN0o.mjs";
|
|
2
2
|
import { RevocationCheck, RevocationEntryVerdict, VerifyRevocationEntryOptions } from "./tokens.mjs";
|
|
3
3
|
//#region src/domain/revocation-view.d.ts
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ot as TokenClaims, b as DeviceId, o as CapabilityToken } from "../protocol-
|
|
1
|
+
import { Ot as TokenClaims, b as DeviceId, o as CapabilityToken } from "../protocol-CfYGYN0o.cjs";
|
|
2
2
|
import { TokenVerdictReason, VerifyCapabilityTokenOptions } from "./tokens.cjs";
|
|
3
3
|
//#region src/domain/room-token-verification.d.ts
|
|
4
4
|
/** The one capability every core/room verb (room.send/read/leave/members) is gated by, per spec/room.cddl -- room.join/room.invite are deliberately ungated instead and need no token check at all. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ot as TokenClaims, b as DeviceId, o as CapabilityToken } from "../protocol-
|
|
1
|
+
import { Ot as TokenClaims, b as DeviceId, o as CapabilityToken } from "../protocol-CfYGYN0o.mjs";
|
|
2
2
|
import { TokenVerdictReason, VerifyCapabilityTokenOptions } from "./tokens.mjs";
|
|
3
3
|
//#region src/domain/room-token-verification.d.ts
|
|
4
4
|
/** The one capability every core/room verb (room.send/read/leave/members) is gated by, per spec/room.cddl -- room.join/room.invite are deliberately ungated instead and need no token check at all. */
|
package/dist/domain/tokens.cjs
CHANGED
|
@@ -214,6 +214,26 @@ async function verifyRevocationEntry(entry, options) {
|
|
|
214
214
|
claims
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
|
+
/** The narrowing arithmetic tokens.cddl's own delegation obligations require (bearer match, expiry within the parent's, scope narrows, same capability, delegations-remaining strictly less than the parent's) -- shared between mintCapabilityToken (which additionally builds and signs the resulting token) and canGrant (a pure query with no minting side effect at all), so the two can never silently drift into two different ideas of what "narrows" means. Returns the specific refusal reason, or undefined when every rule is satisfied. */
|
|
218
|
+
function checkNarrowing(parentClaims, granterDeviceId, candidate) {
|
|
219
|
+
if (!bytesEqual(parentClaims.bearer, granterDeviceId)) return "parent_bearer_mismatch";
|
|
220
|
+
if (candidate.expires > parentClaims.expires) return "expires_exceeds_parent";
|
|
221
|
+
if (!scopeNarrows(parentClaims.scope, candidate.scope)) return "scope_does_not_narrow";
|
|
222
|
+
if (parentClaims.capability !== candidate.capability) return "capability_mismatch";
|
|
223
|
+
const parentRemaining = parentClaims["delegations-remaining"];
|
|
224
|
+
if (parentRemaining !== void 0 && (candidate.delegationsRemaining === void 0 || candidate.delegationsRemaining >= parentRemaining)) return "delegation_exceeds_parent";
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* A pure query: could deviceId, presenting heldToken as its own delegation authority, successfully mint a delegation matching candidate right now -- without attempting (and potentially failing) a real mint just to find out. Reuses mintCapabilityToken's own narrowing arithmetic via checkNarrowing, so the two can never silently drift into different ideas of what "narrows" means.
|
|
228
|
+
*
|
|
229
|
+
* Deliberately narrower than a full mint attempt in one respect: this checks only the narrowing rules tokens.cddl's own delegation obligations require (bearer match, expiry, scope, capability, delegations-remaining), the same scope mintCapabilityToken itself checks a *parent* against -- it does not verify heldToken's own signature or revocation status, exactly as mintCapabilityToken never re-verifies its own parent's signature either. A caller that also needs heldToken's cryptographic validity confirmed calls verifyCapabilityToken separately.
|
|
230
|
+
*/
|
|
231
|
+
function canGrant(heldToken, deviceId, candidate, now) {
|
|
232
|
+
if (candidate.expires <= now) return false;
|
|
233
|
+
const heldClaims = decodeTokenClaims(heldToken);
|
|
234
|
+
if (heldClaims === void 0) return false;
|
|
235
|
+
return checkNarrowing(heldClaims, deviceId, candidate) === void 0;
|
|
236
|
+
}
|
|
217
237
|
/**
|
|
218
238
|
* Mints one capability token: builds token-claims from the given fields, signs it as a COSE_Sign1 under `identity`'s own key, with a protected header matching what the frozen conformance vectors actually encode (`{1: alg, 4: issuer device-id}`, not the empty header a token merely needs to verify against itself).
|
|
219
239
|
*
|
|
@@ -231,26 +251,15 @@ async function mintCapabilityToken(options) {
|
|
|
231
251
|
ok: false,
|
|
232
252
|
reason: "parent_malformed"
|
|
233
253
|
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
254
|
+
const refusal = checkNarrowing(parentClaims, options.identity.deviceId, {
|
|
255
|
+
capability: options.capability,
|
|
256
|
+
scope: options.scope,
|
|
257
|
+
expires: options.expires,
|
|
258
|
+
...options.delegationsRemaining !== void 0 ? { delegationsRemaining: options.delegationsRemaining } : {}
|
|
259
|
+
});
|
|
260
|
+
if (refusal !== void 0) return {
|
|
239
261
|
ok: false,
|
|
240
|
-
reason:
|
|
241
|
-
};
|
|
242
|
-
if (!scopeNarrows(parentClaims.scope, options.scope)) return {
|
|
243
|
-
ok: false,
|
|
244
|
-
reason: "scope_does_not_narrow"
|
|
245
|
-
};
|
|
246
|
-
if (parentClaims.capability !== options.capability) return {
|
|
247
|
-
ok: false,
|
|
248
|
-
reason: "capability_mismatch"
|
|
249
|
-
};
|
|
250
|
-
const parentRemaining = parentClaims["delegations-remaining"];
|
|
251
|
-
if (parentRemaining !== void 0 && (options.delegationsRemaining === void 0 || options.delegationsRemaining >= parentRemaining)) return {
|
|
252
|
-
ok: false,
|
|
253
|
-
reason: "delegation_exceeds_parent"
|
|
262
|
+
reason: refusal
|
|
254
263
|
};
|
|
255
264
|
parentBytes = encodeBuf(options.parent);
|
|
256
265
|
}
|
|
@@ -294,6 +303,7 @@ async function mintRevocationEntry(options) {
|
|
|
294
303
|
];
|
|
295
304
|
}
|
|
296
305
|
//#endregion
|
|
306
|
+
exports.canGrant = canGrant;
|
|
297
307
|
exports.mintCapabilityToken = mintCapabilityToken;
|
|
298
308
|
exports.mintRevocationEntry = mintRevocationEntry;
|
|
299
309
|
exports.verifyCapabilityToken = verifyCapabilityToken;
|
package/dist/domain/tokens.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Ot as TokenClaims, b as DeviceId, lt as RevocationClaims, o as CapabilityToken, ut as RevocationEntry } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { Ot as TokenClaims, b as DeviceId, lt as RevocationClaims, o as CapabilityToken, ut as RevocationEntry } from "../protocol-CfYGYN0o.cjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-B9KsQUyZ.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.cjs";
|
|
4
4
|
//#region src/domain/tokens.d.ts
|
|
5
5
|
/**
|
|
@@ -55,6 +55,19 @@ export type MintVerdict = {
|
|
|
55
55
|
ok: false;
|
|
56
56
|
reason: MintRefusalReason;
|
|
57
57
|
};
|
|
58
|
+
/** What a would-be delegation needs, to check it narrows a specific parent -- everything mintCapabilityToken itself checks a delegation against, independent of the tokenId/bearer/notBefore/signing concerns unique to actually minting one. */
|
|
59
|
+
interface NarrowingCandidate {
|
|
60
|
+
capability: TokenClaims["capability"];
|
|
61
|
+
scope: TokenClaims["scope"];
|
|
62
|
+
expires: number;
|
|
63
|
+
delegationsRemaining?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A pure query: could deviceId, presenting heldToken as its own delegation authority, successfully mint a delegation matching candidate right now -- without attempting (and potentially failing) a real mint just to find out. Reuses mintCapabilityToken's own narrowing arithmetic via checkNarrowing, so the two can never silently drift into different ideas of what "narrows" means.
|
|
67
|
+
*
|
|
68
|
+
* Deliberately narrower than a full mint attempt in one respect: this checks only the narrowing rules tokens.cddl's own delegation obligations require (bearer match, expiry, scope, capability, delegations-remaining), the same scope mintCapabilityToken itself checks a *parent* against -- it does not verify heldToken's own signature or revocation status, exactly as mintCapabilityToken never re-verifies its own parent's signature either. A caller that also needs heldToken's cryptographic validity confirmed calls verifyCapabilityToken separately.
|
|
69
|
+
*/
|
|
70
|
+
export declare function canGrant(heldToken: CapabilityToken, deviceId: DeviceId, candidate: Readonly<NarrowingCandidate>, now: number): boolean;
|
|
58
71
|
export interface MintCapabilityTokenOptions {
|
|
59
72
|
/** The issuer -- signs the token, and supplies the self-certifying issuer/issuer-key claims. */
|
|
60
73
|
identity: IdentityPort;
|
package/dist/domain/tokens.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Ot as TokenClaims, b as DeviceId, lt as RevocationClaims, o as CapabilityToken, ut as RevocationEntry } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { Ot as TokenClaims, b as DeviceId, lt as RevocationClaims, o as CapabilityToken, ut as RevocationEntry } from "../protocol-CfYGYN0o.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-C65L-kBf.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.mjs";
|
|
4
4
|
//#region src/domain/tokens.d.ts
|
|
5
5
|
/**
|
|
@@ -55,6 +55,19 @@ export type MintVerdict = {
|
|
|
55
55
|
ok: false;
|
|
56
56
|
reason: MintRefusalReason;
|
|
57
57
|
};
|
|
58
|
+
/** What a would-be delegation needs, to check it narrows a specific parent -- everything mintCapabilityToken itself checks a delegation against, independent of the tokenId/bearer/notBefore/signing concerns unique to actually minting one. */
|
|
59
|
+
interface NarrowingCandidate {
|
|
60
|
+
capability: TokenClaims["capability"];
|
|
61
|
+
scope: TokenClaims["scope"];
|
|
62
|
+
expires: number;
|
|
63
|
+
delegationsRemaining?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A pure query: could deviceId, presenting heldToken as its own delegation authority, successfully mint a delegation matching candidate right now -- without attempting (and potentially failing) a real mint just to find out. Reuses mintCapabilityToken's own narrowing arithmetic via checkNarrowing, so the two can never silently drift into different ideas of what "narrows" means.
|
|
67
|
+
*
|
|
68
|
+
* Deliberately narrower than a full mint attempt in one respect: this checks only the narrowing rules tokens.cddl's own delegation obligations require (bearer match, expiry, scope, capability, delegations-remaining), the same scope mintCapabilityToken itself checks a *parent* against -- it does not verify heldToken's own signature or revocation status, exactly as mintCapabilityToken never re-verifies its own parent's signature either. A caller that also needs heldToken's cryptographic validity confirmed calls verifyCapabilityToken separately.
|
|
69
|
+
*/
|
|
70
|
+
export declare function canGrant(heldToken: CapabilityToken, deviceId: DeviceId, candidate: Readonly<NarrowingCandidate>, now: number): boolean;
|
|
58
71
|
export interface MintCapabilityTokenOptions {
|
|
59
72
|
/** The issuer -- signs the token, and supplies the self-certifying issuer/issuer-key claims. */
|
|
60
73
|
identity: IdentityPort;
|
package/dist/domain/tokens.mjs
CHANGED
|
@@ -213,6 +213,26 @@ async function verifyRevocationEntry(entry, options) {
|
|
|
213
213
|
claims
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
|
+
/** The narrowing arithmetic tokens.cddl's own delegation obligations require (bearer match, expiry within the parent's, scope narrows, same capability, delegations-remaining strictly less than the parent's) -- shared between mintCapabilityToken (which additionally builds and signs the resulting token) and canGrant (a pure query with no minting side effect at all), so the two can never silently drift into two different ideas of what "narrows" means. Returns the specific refusal reason, or undefined when every rule is satisfied. */
|
|
217
|
+
function checkNarrowing(parentClaims, granterDeviceId, candidate) {
|
|
218
|
+
if (!bytesEqual(parentClaims.bearer, granterDeviceId)) return "parent_bearer_mismatch";
|
|
219
|
+
if (candidate.expires > parentClaims.expires) return "expires_exceeds_parent";
|
|
220
|
+
if (!scopeNarrows(parentClaims.scope, candidate.scope)) return "scope_does_not_narrow";
|
|
221
|
+
if (parentClaims.capability !== candidate.capability) return "capability_mismatch";
|
|
222
|
+
const parentRemaining = parentClaims["delegations-remaining"];
|
|
223
|
+
if (parentRemaining !== void 0 && (candidate.delegationsRemaining === void 0 || candidate.delegationsRemaining >= parentRemaining)) return "delegation_exceeds_parent";
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* A pure query: could deviceId, presenting heldToken as its own delegation authority, successfully mint a delegation matching candidate right now -- without attempting (and potentially failing) a real mint just to find out. Reuses mintCapabilityToken's own narrowing arithmetic via checkNarrowing, so the two can never silently drift into different ideas of what "narrows" means.
|
|
227
|
+
*
|
|
228
|
+
* Deliberately narrower than a full mint attempt in one respect: this checks only the narrowing rules tokens.cddl's own delegation obligations require (bearer match, expiry, scope, capability, delegations-remaining), the same scope mintCapabilityToken itself checks a *parent* against -- it does not verify heldToken's own signature or revocation status, exactly as mintCapabilityToken never re-verifies its own parent's signature either. A caller that also needs heldToken's cryptographic validity confirmed calls verifyCapabilityToken separately.
|
|
229
|
+
*/
|
|
230
|
+
function canGrant(heldToken, deviceId, candidate, now) {
|
|
231
|
+
if (candidate.expires <= now) return false;
|
|
232
|
+
const heldClaims = decodeTokenClaims(heldToken);
|
|
233
|
+
if (heldClaims === void 0) return false;
|
|
234
|
+
return checkNarrowing(heldClaims, deviceId, candidate) === void 0;
|
|
235
|
+
}
|
|
216
236
|
/**
|
|
217
237
|
* Mints one capability token: builds token-claims from the given fields, signs it as a COSE_Sign1 under `identity`'s own key, with a protected header matching what the frozen conformance vectors actually encode (`{1: alg, 4: issuer device-id}`, not the empty header a token merely needs to verify against itself).
|
|
218
238
|
*
|
|
@@ -230,26 +250,15 @@ async function mintCapabilityToken(options) {
|
|
|
230
250
|
ok: false,
|
|
231
251
|
reason: "parent_malformed"
|
|
232
252
|
};
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
253
|
+
const refusal = checkNarrowing(parentClaims, options.identity.deviceId, {
|
|
254
|
+
capability: options.capability,
|
|
255
|
+
scope: options.scope,
|
|
256
|
+
expires: options.expires,
|
|
257
|
+
...options.delegationsRemaining !== void 0 ? { delegationsRemaining: options.delegationsRemaining } : {}
|
|
258
|
+
});
|
|
259
|
+
if (refusal !== void 0) return {
|
|
238
260
|
ok: false,
|
|
239
|
-
reason:
|
|
240
|
-
};
|
|
241
|
-
if (!scopeNarrows(parentClaims.scope, options.scope)) return {
|
|
242
|
-
ok: false,
|
|
243
|
-
reason: "scope_does_not_narrow"
|
|
244
|
-
};
|
|
245
|
-
if (parentClaims.capability !== options.capability) return {
|
|
246
|
-
ok: false,
|
|
247
|
-
reason: "capability_mismatch"
|
|
248
|
-
};
|
|
249
|
-
const parentRemaining = parentClaims["delegations-remaining"];
|
|
250
|
-
if (parentRemaining !== void 0 && (options.delegationsRemaining === void 0 || options.delegationsRemaining >= parentRemaining)) return {
|
|
251
|
-
ok: false,
|
|
252
|
-
reason: "delegation_exceeds_parent"
|
|
261
|
+
reason: refusal
|
|
253
262
|
};
|
|
254
263
|
parentBytes = encodeBuf(options.parent);
|
|
255
264
|
}
|
|
@@ -293,4 +302,4 @@ async function mintRevocationEntry(options) {
|
|
|
293
302
|
];
|
|
294
303
|
}
|
|
295
304
|
//#endregion
|
|
296
|
-
export { mintCapabilityToken, mintRevocationEntry, verifyCapabilityToken, verifyRevocationEntry };
|
|
305
|
+
export { canGrant, mintCapabilityToken, mintRevocationEntry, verifyCapabilityToken, verifyRevocationEntry };
|
|
@@ -180,7 +180,8 @@ const manageResponseFrameSchema = zod.z.lazy(() => zod.z.object({
|
|
|
180
180
|
}));
|
|
181
181
|
const capabilityRequestSchema = zod.z.lazy(() => zod.z.object({
|
|
182
182
|
"verb": zod.z.literal("capability.request"),
|
|
183
|
-
"capability": zod.z.string()
|
|
183
|
+
"capability": zod.z.string(),
|
|
184
|
+
"valid-until": zod.z.number().int().nonnegative().optional()
|
|
184
185
|
}).catchall(zod.z.unknown()));
|
|
185
186
|
const capabilityGrantOkSchema = zod.z.lazy(() => zod.z.object({
|
|
186
187
|
"result": zod.z.literal("ok"),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as ProtocolVersion, $n as roomReadSchema, $t as deviceIdSchema, A as HandleRecord, An as procSpawnSchema, At as WebrtcIceCandidate, B as MessageRef, Bn as revocationAnnounceFrameSchema, Bt as closeFrameSchema, C as DomainId, Cn as peerAdvertSchema, Ct as StreamAckFrame, D as FrameVariant, Dn as privateUseDomainIdSchema, Dt as SyncPunchFrame, E as Frame, En as privateUseCapabilitySchema, Et as StreamSession, F as ManageCommandParams, Fn as ptyWriteSchema, Ft as capabilityGrantOkSchema, G as PeerAdvert, Gn as roomJoinSchema, Gt as coseHeaderKidSchema, H as NamespacedDomainId, Hn as revocationEntrySchema, Ht as coreCapabilitySchema, I as ManageError, In as relayConnectFrameSchema, It as capabilityRequestSchema, J as PrivateUseCapability, Jn as roomMembersOkSchema, Jt as coseTokenHeadersSchema, K as PeerIdentity, Kn as roomLeaveSchema, Kt as coseHeaderLabelSchema, L as ManageOk, Ln as relayDataFrameSchema, Lt as capabilityScopeSchema, M as IceCandidateInit, Mn as ptyKillSchema, Mt as WireCandidate, N as IdentityKey, Nn as ptyResizeSchema, Nt as candidateKindSchema, O as GossipFrame, On as procKillSchema, Ot as TokenClaims, P as ManageCommand, Pn as ptySpawnSchema, Pt as candidatesFrameSchema, Q as ProcSpawn, Qn as roomPathSchema, Qt as deviceIdHexSchema, R as ManageRequestFrame, Rn as relayInboundFrameSchema, Rt as capabilityTokenSchema, S as DmRoomPath, Sn as ownerNamedRoomPathSchema, St as RoomSend, T as ExecSessionInfo, Tn as pingFrameSchema, Tt as StreamEndFrame, U as ObservedAddressFrame, Un as roomInviteSchema, Ut as coreDomainNameSchema, V as NamespacedCapability, Vn as revocationClaimsSchema, Vt as coordinatorFrameSchema, W as OwnerNamedRoomPath, Wn as roomJoinOkSchema, Wt as coseHeaderAlgSchema, X as ProcKill, Xn as roomNoticeClaimsSchema, Xt as dataHaveFrameSchema, Y as PrivateUseDomainId, Yn as roomMembersSchema, Yt as dataEntriesFrameSchema, Z as ProcSignal, Zn as roomNoticeSchema, Zt as dataRequestFrameSchema, _ as DataEntriesFrame, _n as manageResponseFrameSchema, _t as RoomMembersOk, a as CapabilityScope, an as frameVariantSchema, ar as syncPunchFrameSchema, at as RelayDataFrame, b as DeviceId, bn as namespacedDomainIdSchema, bt as RoomPath, c as CloseFrame, cn as handleRecordSchema, cr as webrtcIceCandidateSchema, ct as RevocationAnnounceFrame, d as CoreDomainName, dn as identityKeySchema, dt as RoomInvite, en as dmRoomPathSchema, er as roomSendSchema, et as PtyKill, f as CoseHeaderAlg, fn as manageCommandParamsSchema, ft as RoomJoin, g as CoseTokenHeaders, gn as manageRequestFrameSchema, gt as RoomMembers, h as CoseSign1, hn as manageOkSchema, ht as RoomMember, i as CapabilityRequest, in as frameSchema, ir as streamSessionSchema, it as RelayConnectFrame, j as HandshakeFrame, jn as protocolVersionSchema, jt as WebrtcOffer, k as HandleClaims, kn as procSignalSchema, kt as WebrtcAnswer, l as CoordinatorFrame, ln as handshakeFrameSchema, lr as webrtcOfferSchema, lt as RevocationClaims, m as CoseHeaderLabel, mn as manageErrorSchema, mt as RoomLeave, n as CandidatesFrame, nn as execListSchema, nr as streamDataFrameSchema, nt as PtySpawn, o as CapabilityToken, on as gossipFrameSchema, or as tokenClaimsSchema, ot as RelayInboundFrame, p as CoseHeaderKid, pn as manageCommandSchema, pt as RoomJoinOk, q as PingFrame, qn as roomMemberSchema, qt as coseSign1Schema, r as CapabilityGrantOk, rn as execSessionInfoSchema, rr as streamEndFrameSchema, rt as PtyWrite, s as CapabilityVerb, sn as handleClaimsSchema, sr as webrtcAnswerSchema, st as RelayOfferFrame, t as CandidateKind, tn as domainIdSchema, tr as streamAckFrameSchema, tt as PtyResize, u as CoreCapability, un as iceCandidateInitSchema, ur as wireCandidateSchema, ut as RevocationEntry, v as DataHaveFrame, vn as messageRefSchema, vt as RoomNotice, w as ExecList, wn as peerIdentitySchema, wt as StreamDataFrame, x as DeviceIdHex, xn as observedAddressFrameSchema, xt as RoomRead, y as DataRequestFrame, yn as namespacedCapabilitySchema, yt as RoomNoticeClaims, z as ManageResponseFrame, zn as relayOfferFrameSchema, zt as capabilityVerbSchema } from "../protocol-
|
|
1
|
+
import { $ as ProtocolVersion, $n as roomReadSchema, $t as deviceIdSchema, A as HandleRecord, An as procSpawnSchema, At as WebrtcIceCandidate, B as MessageRef, Bn as revocationAnnounceFrameSchema, Bt as closeFrameSchema, C as DomainId, Cn as peerAdvertSchema, Ct as StreamAckFrame, D as FrameVariant, Dn as privateUseDomainIdSchema, Dt as SyncPunchFrame, E as Frame, En as privateUseCapabilitySchema, Et as StreamSession, F as ManageCommandParams, Fn as ptyWriteSchema, Ft as capabilityGrantOkSchema, G as PeerAdvert, Gn as roomJoinSchema, Gt as coseHeaderKidSchema, H as NamespacedDomainId, Hn as revocationEntrySchema, Ht as coreCapabilitySchema, I as ManageError, In as relayConnectFrameSchema, It as capabilityRequestSchema, J as PrivateUseCapability, Jn as roomMembersOkSchema, Jt as coseTokenHeadersSchema, K as PeerIdentity, Kn as roomLeaveSchema, Kt as coseHeaderLabelSchema, L as ManageOk, Ln as relayDataFrameSchema, Lt as capabilityScopeSchema, M as IceCandidateInit, Mn as ptyKillSchema, Mt as WireCandidate, N as IdentityKey, Nn as ptyResizeSchema, Nt as candidateKindSchema, O as GossipFrame, On as procKillSchema, Ot as TokenClaims, P as ManageCommand, Pn as ptySpawnSchema, Pt as candidatesFrameSchema, Q as ProcSpawn, Qn as roomPathSchema, Qt as deviceIdHexSchema, R as ManageRequestFrame, Rn as relayInboundFrameSchema, Rt as capabilityTokenSchema, S as DmRoomPath, Sn as ownerNamedRoomPathSchema, St as RoomSend, T as ExecSessionInfo, Tn as pingFrameSchema, Tt as StreamEndFrame, U as ObservedAddressFrame, Un as roomInviteSchema, Ut as coreDomainNameSchema, V as NamespacedCapability, Vn as revocationClaimsSchema, Vt as coordinatorFrameSchema, W as OwnerNamedRoomPath, Wn as roomJoinOkSchema, Wt as coseHeaderAlgSchema, X as ProcKill, Xn as roomNoticeClaimsSchema, Xt as dataHaveFrameSchema, Y as PrivateUseDomainId, Yn as roomMembersSchema, Yt as dataEntriesFrameSchema, Z as ProcSignal, Zn as roomNoticeSchema, Zt as dataRequestFrameSchema, _ as DataEntriesFrame, _n as manageResponseFrameSchema, _t as RoomMembersOk, a as CapabilityScope, an as frameVariantSchema, ar as syncPunchFrameSchema, at as RelayDataFrame, b as DeviceId, bn as namespacedDomainIdSchema, bt as RoomPath, c as CloseFrame, cn as handleRecordSchema, cr as webrtcIceCandidateSchema, ct as RevocationAnnounceFrame, d as CoreDomainName, dn as identityKeySchema, dt as RoomInvite, en as dmRoomPathSchema, er as roomSendSchema, et as PtyKill, f as CoseHeaderAlg, fn as manageCommandParamsSchema, ft as RoomJoin, g as CoseTokenHeaders, gn as manageRequestFrameSchema, gt as RoomMembers, h as CoseSign1, hn as manageOkSchema, ht as RoomMember, i as CapabilityRequest, in as frameSchema, ir as streamSessionSchema, it as RelayConnectFrame, j as HandshakeFrame, jn as protocolVersionSchema, jt as WebrtcOffer, k as HandleClaims, kn as procSignalSchema, kt as WebrtcAnswer, l as CoordinatorFrame, ln as handshakeFrameSchema, lr as webrtcOfferSchema, lt as RevocationClaims, m as CoseHeaderLabel, mn as manageErrorSchema, mt as RoomLeave, n as CandidatesFrame, nn as execListSchema, nr as streamDataFrameSchema, nt as PtySpawn, o as CapabilityToken, on as gossipFrameSchema, or as tokenClaimsSchema, ot as RelayInboundFrame, p as CoseHeaderKid, pn as manageCommandSchema, pt as RoomJoinOk, q as PingFrame, qn as roomMemberSchema, qt as coseSign1Schema, r as CapabilityGrantOk, rn as execSessionInfoSchema, rr as streamEndFrameSchema, rt as PtyWrite, s as CapabilityVerb, sn as handleClaimsSchema, sr as webrtcAnswerSchema, st as RelayOfferFrame, t as CandidateKind, tn as domainIdSchema, tr as streamAckFrameSchema, tt as PtyResize, u as CoreCapability, un as iceCandidateInitSchema, ur as wireCandidateSchema, ut as RevocationEntry, v as DataHaveFrame, vn as messageRefSchema, vt as RoomNotice, w as ExecList, wn as peerIdentitySchema, wt as StreamDataFrame, x as DeviceIdHex, xn as observedAddressFrameSchema, xt as RoomRead, y as DataRequestFrame, yn as namespacedCapabilitySchema, yt as RoomNoticeClaims, z as ManageResponseFrame, zn as relayOfferFrameSchema, zt as capabilityVerbSchema } from "../protocol-CfYGYN0o.cjs";
|
|
2
2
|
export { CandidateKind, CandidatesFrame, CapabilityGrantOk, CapabilityRequest, CapabilityScope, CapabilityToken, CapabilityVerb, CloseFrame, CoordinatorFrame, CoreCapability, CoreDomainName, CoseHeaderAlg, CoseHeaderKid, CoseHeaderLabel, CoseSign1, CoseTokenHeaders, DataEntriesFrame, DataHaveFrame, DataRequestFrame, DeviceId, DeviceIdHex, DmRoomPath, DomainId, ExecList, ExecSessionInfo, Frame, FrameVariant, GossipFrame, HandleClaims, HandleRecord, HandshakeFrame, IceCandidateInit, IdentityKey, ManageCommand, ManageCommandParams, ManageError, ManageOk, ManageRequestFrame, ManageResponseFrame, MessageRef, NamespacedCapability, NamespacedDomainId, ObservedAddressFrame, OwnerNamedRoomPath, PeerAdvert, PeerIdentity, PingFrame, PrivateUseCapability, PrivateUseDomainId, ProcKill, ProcSignal, ProcSpawn, ProtocolVersion, PtyKill, PtyResize, PtySpawn, PtyWrite, RelayConnectFrame, RelayDataFrame, RelayInboundFrame, RelayOfferFrame, RevocationAnnounceFrame, RevocationClaims, RevocationEntry, RoomInvite, RoomJoin, RoomJoinOk, RoomLeave, RoomMember, RoomMembers, RoomMembersOk, RoomNotice, RoomNoticeClaims, RoomPath, RoomRead, RoomSend, StreamAckFrame, StreamDataFrame, StreamEndFrame, StreamSession, SyncPunchFrame, TokenClaims, WebrtcAnswer, WebrtcIceCandidate, WebrtcOffer, WireCandidate, candidateKindSchema, candidatesFrameSchema, capabilityGrantOkSchema, capabilityRequestSchema, capabilityScopeSchema, capabilityTokenSchema, capabilityVerbSchema, closeFrameSchema, coordinatorFrameSchema, coreCapabilitySchema, coreDomainNameSchema, coseHeaderAlgSchema, coseHeaderKidSchema, coseHeaderLabelSchema, coseSign1Schema, coseTokenHeadersSchema, dataEntriesFrameSchema, dataHaveFrameSchema, dataRequestFrameSchema, deviceIdHexSchema, deviceIdSchema, dmRoomPathSchema, domainIdSchema, execListSchema, execSessionInfoSchema, frameSchema, frameVariantSchema, gossipFrameSchema, handleClaimsSchema, handleRecordSchema, handshakeFrameSchema, iceCandidateInitSchema, identityKeySchema, manageCommandParamsSchema, manageCommandSchema, manageErrorSchema, manageOkSchema, manageRequestFrameSchema, manageResponseFrameSchema, messageRefSchema, namespacedCapabilitySchema, namespacedDomainIdSchema, observedAddressFrameSchema, ownerNamedRoomPathSchema, peerAdvertSchema, peerIdentitySchema, pingFrameSchema, privateUseCapabilitySchema, privateUseDomainIdSchema, procKillSchema, procSignalSchema, procSpawnSchema, protocolVersionSchema, ptyKillSchema, ptyResizeSchema, ptySpawnSchema, ptyWriteSchema, relayConnectFrameSchema, relayDataFrameSchema, relayInboundFrameSchema, relayOfferFrameSchema, revocationAnnounceFrameSchema, revocationClaimsSchema, revocationEntrySchema, roomInviteSchema, roomJoinOkSchema, roomJoinSchema, roomLeaveSchema, roomMemberSchema, roomMembersOkSchema, roomMembersSchema, roomNoticeClaimsSchema, roomNoticeSchema, roomPathSchema, roomReadSchema, roomSendSchema, streamAckFrameSchema, streamDataFrameSchema, streamEndFrameSchema, streamSessionSchema, syncPunchFrameSchema, tokenClaimsSchema, webrtcAnswerSchema, webrtcIceCandidateSchema, webrtcOfferSchema, wireCandidateSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as ProtocolVersion, $n as roomReadSchema, $t as deviceIdSchema, A as HandleRecord, An as procSpawnSchema, At as WebrtcIceCandidate, B as MessageRef, Bn as revocationAnnounceFrameSchema, Bt as closeFrameSchema, C as DomainId, Cn as peerAdvertSchema, Ct as StreamAckFrame, D as FrameVariant, Dn as privateUseDomainIdSchema, Dt as SyncPunchFrame, E as Frame, En as privateUseCapabilitySchema, Et as StreamSession, F as ManageCommandParams, Fn as ptyWriteSchema, Ft as capabilityGrantOkSchema, G as PeerAdvert, Gn as roomJoinSchema, Gt as coseHeaderKidSchema, H as NamespacedDomainId, Hn as revocationEntrySchema, Ht as coreCapabilitySchema, I as ManageError, In as relayConnectFrameSchema, It as capabilityRequestSchema, J as PrivateUseCapability, Jn as roomMembersOkSchema, Jt as coseTokenHeadersSchema, K as PeerIdentity, Kn as roomLeaveSchema, Kt as coseHeaderLabelSchema, L as ManageOk, Ln as relayDataFrameSchema, Lt as capabilityScopeSchema, M as IceCandidateInit, Mn as ptyKillSchema, Mt as WireCandidate, N as IdentityKey, Nn as ptyResizeSchema, Nt as candidateKindSchema, O as GossipFrame, On as procKillSchema, Ot as TokenClaims, P as ManageCommand, Pn as ptySpawnSchema, Pt as candidatesFrameSchema, Q as ProcSpawn, Qn as roomPathSchema, Qt as deviceIdHexSchema, R as ManageRequestFrame, Rn as relayInboundFrameSchema, Rt as capabilityTokenSchema, S as DmRoomPath, Sn as ownerNamedRoomPathSchema, St as RoomSend, T as ExecSessionInfo, Tn as pingFrameSchema, Tt as StreamEndFrame, U as ObservedAddressFrame, Un as roomInviteSchema, Ut as coreDomainNameSchema, V as NamespacedCapability, Vn as revocationClaimsSchema, Vt as coordinatorFrameSchema, W as OwnerNamedRoomPath, Wn as roomJoinOkSchema, Wt as coseHeaderAlgSchema, X as ProcKill, Xn as roomNoticeClaimsSchema, Xt as dataHaveFrameSchema, Y as PrivateUseDomainId, Yn as roomMembersSchema, Yt as dataEntriesFrameSchema, Z as ProcSignal, Zn as roomNoticeSchema, Zt as dataRequestFrameSchema, _ as DataEntriesFrame, _n as manageResponseFrameSchema, _t as RoomMembersOk, a as CapabilityScope, an as frameVariantSchema, ar as syncPunchFrameSchema, at as RelayDataFrame, b as DeviceId, bn as namespacedDomainIdSchema, bt as RoomPath, c as CloseFrame, cn as handleRecordSchema, cr as webrtcIceCandidateSchema, ct as RevocationAnnounceFrame, d as CoreDomainName, dn as identityKeySchema, dt as RoomInvite, en as dmRoomPathSchema, er as roomSendSchema, et as PtyKill, f as CoseHeaderAlg, fn as manageCommandParamsSchema, ft as RoomJoin, g as CoseTokenHeaders, gn as manageRequestFrameSchema, gt as RoomMembers, h as CoseSign1, hn as manageOkSchema, ht as RoomMember, i as CapabilityRequest, in as frameSchema, ir as streamSessionSchema, it as RelayConnectFrame, j as HandshakeFrame, jn as protocolVersionSchema, jt as WebrtcOffer, k as HandleClaims, kn as procSignalSchema, kt as WebrtcAnswer, l as CoordinatorFrame, ln as handshakeFrameSchema, lr as webrtcOfferSchema, lt as RevocationClaims, m as CoseHeaderLabel, mn as manageErrorSchema, mt as RoomLeave, n as CandidatesFrame, nn as execListSchema, nr as streamDataFrameSchema, nt as PtySpawn, o as CapabilityToken, on as gossipFrameSchema, or as tokenClaimsSchema, ot as RelayInboundFrame, p as CoseHeaderKid, pn as manageCommandSchema, pt as RoomJoinOk, q as PingFrame, qn as roomMemberSchema, qt as coseSign1Schema, r as CapabilityGrantOk, rn as execSessionInfoSchema, rr as streamEndFrameSchema, rt as PtyWrite, s as CapabilityVerb, sn as handleClaimsSchema, sr as webrtcAnswerSchema, st as RelayOfferFrame, t as CandidateKind, tn as domainIdSchema, tr as streamAckFrameSchema, tt as PtyResize, u as CoreCapability, un as iceCandidateInitSchema, ur as wireCandidateSchema, ut as RevocationEntry, v as DataHaveFrame, vn as messageRefSchema, vt as RoomNotice, w as ExecList, wn as peerIdentitySchema, wt as StreamDataFrame, x as DeviceIdHex, xn as observedAddressFrameSchema, xt as RoomRead, y as DataRequestFrame, yn as namespacedCapabilitySchema, yt as RoomNoticeClaims, z as ManageResponseFrame, zn as relayOfferFrameSchema, zt as capabilityVerbSchema } from "../protocol-
|
|
1
|
+
import { $ as ProtocolVersion, $n as roomReadSchema, $t as deviceIdSchema, A as HandleRecord, An as procSpawnSchema, At as WebrtcIceCandidate, B as MessageRef, Bn as revocationAnnounceFrameSchema, Bt as closeFrameSchema, C as DomainId, Cn as peerAdvertSchema, Ct as StreamAckFrame, D as FrameVariant, Dn as privateUseDomainIdSchema, Dt as SyncPunchFrame, E as Frame, En as privateUseCapabilitySchema, Et as StreamSession, F as ManageCommandParams, Fn as ptyWriteSchema, Ft as capabilityGrantOkSchema, G as PeerAdvert, Gn as roomJoinSchema, Gt as coseHeaderKidSchema, H as NamespacedDomainId, Hn as revocationEntrySchema, Ht as coreCapabilitySchema, I as ManageError, In as relayConnectFrameSchema, It as capabilityRequestSchema, J as PrivateUseCapability, Jn as roomMembersOkSchema, Jt as coseTokenHeadersSchema, K as PeerIdentity, Kn as roomLeaveSchema, Kt as coseHeaderLabelSchema, L as ManageOk, Ln as relayDataFrameSchema, Lt as capabilityScopeSchema, M as IceCandidateInit, Mn as ptyKillSchema, Mt as WireCandidate, N as IdentityKey, Nn as ptyResizeSchema, Nt as candidateKindSchema, O as GossipFrame, On as procKillSchema, Ot as TokenClaims, P as ManageCommand, Pn as ptySpawnSchema, Pt as candidatesFrameSchema, Q as ProcSpawn, Qn as roomPathSchema, Qt as deviceIdHexSchema, R as ManageRequestFrame, Rn as relayInboundFrameSchema, Rt as capabilityTokenSchema, S as DmRoomPath, Sn as ownerNamedRoomPathSchema, St as RoomSend, T as ExecSessionInfo, Tn as pingFrameSchema, Tt as StreamEndFrame, U as ObservedAddressFrame, Un as roomInviteSchema, Ut as coreDomainNameSchema, V as NamespacedCapability, Vn as revocationClaimsSchema, Vt as coordinatorFrameSchema, W as OwnerNamedRoomPath, Wn as roomJoinOkSchema, Wt as coseHeaderAlgSchema, X as ProcKill, Xn as roomNoticeClaimsSchema, Xt as dataHaveFrameSchema, Y as PrivateUseDomainId, Yn as roomMembersSchema, Yt as dataEntriesFrameSchema, Z as ProcSignal, Zn as roomNoticeSchema, Zt as dataRequestFrameSchema, _ as DataEntriesFrame, _n as manageResponseFrameSchema, _t as RoomMembersOk, a as CapabilityScope, an as frameVariantSchema, ar as syncPunchFrameSchema, at as RelayDataFrame, b as DeviceId, bn as namespacedDomainIdSchema, bt as RoomPath, c as CloseFrame, cn as handleRecordSchema, cr as webrtcIceCandidateSchema, ct as RevocationAnnounceFrame, d as CoreDomainName, dn as identityKeySchema, dt as RoomInvite, en as dmRoomPathSchema, er as roomSendSchema, et as PtyKill, f as CoseHeaderAlg, fn as manageCommandParamsSchema, ft as RoomJoin, g as CoseTokenHeaders, gn as manageRequestFrameSchema, gt as RoomMembers, h as CoseSign1, hn as manageOkSchema, ht as RoomMember, i as CapabilityRequest, in as frameSchema, ir as streamSessionSchema, it as RelayConnectFrame, j as HandshakeFrame, jn as protocolVersionSchema, jt as WebrtcOffer, k as HandleClaims, kn as procSignalSchema, kt as WebrtcAnswer, l as CoordinatorFrame, ln as handshakeFrameSchema, lr as webrtcOfferSchema, lt as RevocationClaims, m as CoseHeaderLabel, mn as manageErrorSchema, mt as RoomLeave, n as CandidatesFrame, nn as execListSchema, nr as streamDataFrameSchema, nt as PtySpawn, o as CapabilityToken, on as gossipFrameSchema, or as tokenClaimsSchema, ot as RelayInboundFrame, p as CoseHeaderKid, pn as manageCommandSchema, pt as RoomJoinOk, q as PingFrame, qn as roomMemberSchema, qt as coseSign1Schema, r as CapabilityGrantOk, rn as execSessionInfoSchema, rr as streamEndFrameSchema, rt as PtyWrite, s as CapabilityVerb, sn as handleClaimsSchema, sr as webrtcAnswerSchema, st as RelayOfferFrame, t as CandidateKind, tn as domainIdSchema, tr as streamAckFrameSchema, tt as PtyResize, u as CoreCapability, un as iceCandidateInitSchema, ur as wireCandidateSchema, ut as RevocationEntry, v as DataHaveFrame, vn as messageRefSchema, vt as RoomNotice, w as ExecList, wn as peerIdentitySchema, wt as StreamDataFrame, x as DeviceIdHex, xn as observedAddressFrameSchema, xt as RoomRead, y as DataRequestFrame, yn as namespacedCapabilitySchema, yt as RoomNoticeClaims, z as ManageResponseFrame, zn as relayOfferFrameSchema, zt as capabilityVerbSchema } from "../protocol-CfYGYN0o.mjs";
|
|
2
2
|
export { CandidateKind, CandidatesFrame, CapabilityGrantOk, CapabilityRequest, CapabilityScope, CapabilityToken, CapabilityVerb, CloseFrame, CoordinatorFrame, CoreCapability, CoreDomainName, CoseHeaderAlg, CoseHeaderKid, CoseHeaderLabel, CoseSign1, CoseTokenHeaders, DataEntriesFrame, DataHaveFrame, DataRequestFrame, DeviceId, DeviceIdHex, DmRoomPath, DomainId, ExecList, ExecSessionInfo, Frame, FrameVariant, GossipFrame, HandleClaims, HandleRecord, HandshakeFrame, IceCandidateInit, IdentityKey, ManageCommand, ManageCommandParams, ManageError, ManageOk, ManageRequestFrame, ManageResponseFrame, MessageRef, NamespacedCapability, NamespacedDomainId, ObservedAddressFrame, OwnerNamedRoomPath, PeerAdvert, PeerIdentity, PingFrame, PrivateUseCapability, PrivateUseDomainId, ProcKill, ProcSignal, ProcSpawn, ProtocolVersion, PtyKill, PtyResize, PtySpawn, PtyWrite, RelayConnectFrame, RelayDataFrame, RelayInboundFrame, RelayOfferFrame, RevocationAnnounceFrame, RevocationClaims, RevocationEntry, RoomInvite, RoomJoin, RoomJoinOk, RoomLeave, RoomMember, RoomMembers, RoomMembersOk, RoomNotice, RoomNoticeClaims, RoomPath, RoomRead, RoomSend, StreamAckFrame, StreamDataFrame, StreamEndFrame, StreamSession, SyncPunchFrame, TokenClaims, WebrtcAnswer, WebrtcIceCandidate, WebrtcOffer, WireCandidate, candidateKindSchema, candidatesFrameSchema, capabilityGrantOkSchema, capabilityRequestSchema, capabilityScopeSchema, capabilityTokenSchema, capabilityVerbSchema, closeFrameSchema, coordinatorFrameSchema, coreCapabilitySchema, coreDomainNameSchema, coseHeaderAlgSchema, coseHeaderKidSchema, coseHeaderLabelSchema, coseSign1Schema, coseTokenHeadersSchema, dataEntriesFrameSchema, dataHaveFrameSchema, dataRequestFrameSchema, deviceIdHexSchema, deviceIdSchema, dmRoomPathSchema, domainIdSchema, execListSchema, execSessionInfoSchema, frameSchema, frameVariantSchema, gossipFrameSchema, handleClaimsSchema, handleRecordSchema, handshakeFrameSchema, iceCandidateInitSchema, identityKeySchema, manageCommandParamsSchema, manageCommandSchema, manageErrorSchema, manageOkSchema, manageRequestFrameSchema, manageResponseFrameSchema, messageRefSchema, namespacedCapabilitySchema, namespacedDomainIdSchema, observedAddressFrameSchema, ownerNamedRoomPathSchema, peerAdvertSchema, peerIdentitySchema, pingFrameSchema, privateUseCapabilitySchema, privateUseDomainIdSchema, procKillSchema, procSignalSchema, procSpawnSchema, protocolVersionSchema, ptyKillSchema, ptyResizeSchema, ptySpawnSchema, ptyWriteSchema, relayConnectFrameSchema, relayDataFrameSchema, relayInboundFrameSchema, relayOfferFrameSchema, revocationAnnounceFrameSchema, revocationClaimsSchema, revocationEntrySchema, roomInviteSchema, roomJoinOkSchema, roomJoinSchema, roomLeaveSchema, roomMemberSchema, roomMembersOkSchema, roomMembersSchema, roomNoticeClaimsSchema, roomNoticeSchema, roomPathSchema, roomReadSchema, roomSendSchema, streamAckFrameSchema, streamDataFrameSchema, streamEndFrameSchema, streamSessionSchema, syncPunchFrameSchema, tokenClaimsSchema, webrtcAnswerSchema, webrtcIceCandidateSchema, webrtcOfferSchema, wireCandidateSchema };
|
|
@@ -179,7 +179,8 @@ const manageResponseFrameSchema = z.lazy(() => z.object({
|
|
|
179
179
|
}));
|
|
180
180
|
const capabilityRequestSchema = z.lazy(() => z.object({
|
|
181
181
|
"verb": z.literal("capability.request"),
|
|
182
|
-
"capability": z.string()
|
|
182
|
+
"capability": z.string(),
|
|
183
|
+
"valid-until": z.number().int().nonnegative().optional()
|
|
183
184
|
}).catchall(z.unknown()));
|
|
184
185
|
const capabilityGrantOkSchema = z.lazy(() => z.object({
|
|
185
186
|
"result": z.literal("ok"),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as IdentityKey, b as DeviceId } from "./protocol-
|
|
1
|
+
import { N as IdentityKey, b as DeviceId } from "./protocol-CfYGYN0o.cjs";
|
|
2
2
|
//#region src/ports/identity.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Wraps the local node's own identity plus the signing/verification primitives capability-token handling needs -- never hardcoded to one crypto library's own API shape (Node's webcrypto, a WASM implementation, a hardware key, etc. can all satisfy this same contract).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as IdentityKey, b as DeviceId } from "./protocol-
|
|
1
|
+
import { N as IdentityKey, b as DeviceId } from "./protocol-CfYGYN0o.mjs";
|
|
2
2
|
//#region src/ports/identity.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Wraps the local node's own identity plus the signing/verification primitives capability-token handling needs -- never hardcoded to one crypto library's own API shape (Node's webcrypto, a WASM implementation, a hardware key, etc. can all satisfy this same contract).
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { t as IdentityPort } from "../identity-B9KsQUyZ.cjs";
|
|
2
2
|
export { IdentityPort };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { t as IdentityPort } from "../identity-C65L-kBf.mjs";
|
|
2
2
|
export { IdentityPort };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as Frame, b as DeviceId } from "../protocol-
|
|
1
|
+
import { E as Frame, b as DeviceId } from "../protocol-CfYGYN0o.cjs";
|
|
2
2
|
//#region src/ports/transport.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* An async, serialisable-data contract for exchanging frame values over some connection -- deliberately without baking in any specific transport's own primitives (no raw socket types, no WebSocket-specific options), so a TCP adapter, a WebSocket adapter, or an in-memory adapter for tests can all satisfy it.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as Frame, b as DeviceId } from "../protocol-
|
|
1
|
+
import { E as Frame, b as DeviceId } from "../protocol-CfYGYN0o.mjs";
|
|
2
2
|
//#region src/ports/transport.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* An async, serialisable-data contract for exchanging frame values over some connection -- deliberately without baking in any specific transport's own primitives (no raw socket types, no WebSocket-specific options), so a TCP adapter, a WebSocket adapter, or an in-memory adapter for tests can all satisfy it.
|
|
@@ -74,6 +74,7 @@ declare const manageCommandParamsSchema: z.ZodLazy<z.ZodUnion<readonly [z.ZodUni
|
|
|
74
74
|
}, z.core.$strip>>>]>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
75
75
|
verb: z.ZodLiteral<"capability.request">;
|
|
76
76
|
capability: z.ZodString;
|
|
77
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
77
78
|
}, z.core.$catchall<z.ZodUnknown>>>>, z.ZodUnion<readonly [z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
78
79
|
verb: z.ZodLiteral<"room.send">;
|
|
79
80
|
"message-id": z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
@@ -261,6 +262,7 @@ declare const frameVariantSchema: z.ZodLazy<z.ZodUnion<readonly [z.ZodLazy<z.Zod
|
|
|
261
262
|
}, z.core.$strip>>>]>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
262
263
|
verb: z.ZodLiteral<"capability.request">;
|
|
263
264
|
capability: z.ZodString;
|
|
265
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
264
266
|
}, z.core.$catchall<z.ZodUnknown>>>>, z.ZodUnion<readonly [z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
265
267
|
verb: z.ZodLiteral<"room.send">;
|
|
266
268
|
"message-id": z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
@@ -454,6 +456,7 @@ declare const frameSchema: z.ZodLazy<z.ZodLazy<z.ZodLazy<z.ZodUnion<readonly [z.
|
|
|
454
456
|
}, z.core.$strip>>>]>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
455
457
|
verb: z.ZodLiteral<"capability.request">;
|
|
456
458
|
capability: z.ZodString;
|
|
459
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
457
460
|
}, z.core.$catchall<z.ZodUnknown>>>>, z.ZodUnion<readonly [z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
458
461
|
verb: z.ZodLiteral<"room.send">;
|
|
459
462
|
"message-id": z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
@@ -618,6 +621,7 @@ declare const manageCommandSchema: z.ZodLazy<z.ZodObject<{
|
|
|
618
621
|
}, z.core.$strip>>>]>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
619
622
|
verb: z.ZodLiteral<"capability.request">;
|
|
620
623
|
capability: z.ZodString;
|
|
624
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
621
625
|
}, z.core.$catchall<z.ZodUnknown>>>>, z.ZodUnion<readonly [z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
622
626
|
verb: z.ZodLiteral<"room.send">;
|
|
623
627
|
"message-id": z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
@@ -707,6 +711,7 @@ declare const manageRequestFrameSchema: z.ZodLazy<z.ZodObject<{
|
|
|
707
711
|
}, z.core.$strip>>>]>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
708
712
|
verb: z.ZodLiteral<"capability.request">;
|
|
709
713
|
capability: z.ZodString;
|
|
714
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
710
715
|
}, z.core.$catchall<z.ZodUnknown>>>>, z.ZodUnion<readonly [z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
711
716
|
verb: z.ZodLiteral<"room.send">;
|
|
712
717
|
"message-id": z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
@@ -784,6 +789,7 @@ declare const manageResponseFrameSchema: z.ZodLazy<z.ZodObject<{
|
|
|
784
789
|
declare const capabilityRequestSchema: z.ZodLazy<z.ZodObject<{
|
|
785
790
|
verb: z.ZodLiteral<"capability.request">;
|
|
786
791
|
capability: z.ZodString;
|
|
792
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
787
793
|
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
788
794
|
declare const capabilityGrantOkSchema: z.ZodLazy<z.ZodObject<{
|
|
789
795
|
result: z.ZodLiteral<"ok">;
|
|
@@ -74,6 +74,7 @@ declare const manageCommandParamsSchema: z.ZodLazy<z.ZodUnion<readonly [z.ZodUni
|
|
|
74
74
|
}, z.core.$strip>>>]>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
75
75
|
verb: z.ZodLiteral<"capability.request">;
|
|
76
76
|
capability: z.ZodString;
|
|
77
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
77
78
|
}, z.core.$catchall<z.ZodUnknown>>>>, z.ZodUnion<readonly [z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
78
79
|
verb: z.ZodLiteral<"room.send">;
|
|
79
80
|
"message-id": z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
@@ -261,6 +262,7 @@ declare const frameVariantSchema: z.ZodLazy<z.ZodUnion<readonly [z.ZodLazy<z.Zod
|
|
|
261
262
|
}, z.core.$strip>>>]>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
262
263
|
verb: z.ZodLiteral<"capability.request">;
|
|
263
264
|
capability: z.ZodString;
|
|
265
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
264
266
|
}, z.core.$catchall<z.ZodUnknown>>>>, z.ZodUnion<readonly [z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
265
267
|
verb: z.ZodLiteral<"room.send">;
|
|
266
268
|
"message-id": z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
@@ -454,6 +456,7 @@ declare const frameSchema: z.ZodLazy<z.ZodLazy<z.ZodLazy<z.ZodUnion<readonly [z.
|
|
|
454
456
|
}, z.core.$strip>>>]>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
455
457
|
verb: z.ZodLiteral<"capability.request">;
|
|
456
458
|
capability: z.ZodString;
|
|
459
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
457
460
|
}, z.core.$catchall<z.ZodUnknown>>>>, z.ZodUnion<readonly [z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
458
461
|
verb: z.ZodLiteral<"room.send">;
|
|
459
462
|
"message-id": z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
@@ -618,6 +621,7 @@ declare const manageCommandSchema: z.ZodLazy<z.ZodObject<{
|
|
|
618
621
|
}, z.core.$strip>>>]>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
619
622
|
verb: z.ZodLiteral<"capability.request">;
|
|
620
623
|
capability: z.ZodString;
|
|
624
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
621
625
|
}, z.core.$catchall<z.ZodUnknown>>>>, z.ZodUnion<readonly [z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
622
626
|
verb: z.ZodLiteral<"room.send">;
|
|
623
627
|
"message-id": z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
@@ -707,6 +711,7 @@ declare const manageRequestFrameSchema: z.ZodLazy<z.ZodObject<{
|
|
|
707
711
|
}, z.core.$strip>>>]>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
708
712
|
verb: z.ZodLiteral<"capability.request">;
|
|
709
713
|
capability: z.ZodString;
|
|
714
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
710
715
|
}, z.core.$catchall<z.ZodUnknown>>>>, z.ZodUnion<readonly [z.ZodLazy<z.ZodLazy<z.ZodObject<{
|
|
711
716
|
verb: z.ZodLiteral<"room.send">;
|
|
712
717
|
"message-id": z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
@@ -784,6 +789,7 @@ declare const manageResponseFrameSchema: z.ZodLazy<z.ZodObject<{
|
|
|
784
789
|
declare const capabilityRequestSchema: z.ZodLazy<z.ZodObject<{
|
|
785
790
|
verb: z.ZodLiteral<"capability.request">;
|
|
786
791
|
capability: z.ZodString;
|
|
792
|
+
"valid-until": z.ZodOptional<z.ZodNumber>;
|
|
787
793
|
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
788
794
|
declare const capabilityGrantOkSchema: z.ZodLazy<z.ZodObject<{
|
|
789
795
|
result: z.ZodLiteral<"ok">;
|