wire-mesh-core 1.31.0 → 1.33.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.cjs +26 -2
- package/dist/adapters/node-identity.d.cts +5 -3
- package/dist/adapters/node-identity.d.mts +5 -3
- package/dist/adapters/node-identity.mjs +26 -2
- package/dist/adapters/tcp-transport.d.cts +1 -1
- package/dist/adapters/tcp-transport.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/bulk.d.cts +2 -2
- package/dist/domain/bulk.d.mts +2 -2
- package/dist/domain/capability-grant.cjs +1 -1
- package/dist/domain/capability-grant.d.cts +3 -3
- package/dist/domain/capability-grant.d.mts +3 -3
- package/dist/domain/capability-grant.mjs +1 -1
- package/dist/domain/capability-request.cjs +1 -1
- package/dist/domain/capability-request.d.cts +2 -2
- package/dist/domain/capability-request.d.mts +2 -2
- package/dist/domain/capability-request.mjs +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/grant-candidates.d.cts +1 -1
- package/dist/domain/grant-candidates.d.mts +1 -1
- package/dist/domain/group-key.cjs +93 -0
- package/dist/domain/group-key.d.cts +24 -0
- package/dist/domain/group-key.d.mts +24 -0
- package/dist/domain/group-key.mjs +87 -0
- package/dist/domain/handshake.d.cts +1 -1
- package/dist/domain/handshake.d.mts +1 -1
- package/dist/domain/mesh-session.d.cts +3 -3
- package/dist/domain/mesh-session.d.mts +3 -3
- 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.cjs +1 -1
- package/dist/domain/revocation-view.d.cts +2 -2
- package/dist/domain/revocation-view.d.mts +2 -2
- package/dist/domain/revocation-view.mjs +1 -1
- package/dist/domain/room-rekey.cjs +112 -0
- package/dist/domain/room-rekey.d.cts +35 -0
- package/dist/domain/room-rekey.d.mts +35 -0
- package/dist/domain/room-rekey.mjs +109 -0
- package/dist/domain/room-token-verification.cjs +3 -2
- package/dist/domain/room-token-verification.d.cts +4 -2
- package/dist/domain/room-token-verification.d.mts +4 -2
- package/dist/domain/room-token-verification.mjs +3 -2
- package/dist/domain/room.d.cts +3 -3
- package/dist/domain/room.d.mts +3 -3
- package/dist/domain/tokens.cjs +1 -1
- package/dist/domain/tokens.d.cts +1 -1
- package/dist/domain/tokens.d.mts +1 -1
- package/dist/domain/tokens.mjs +1 -1
- package/dist/generated/protocol.cjs +9 -1
- package/dist/generated/protocol.d.cts +2 -2
- package/dist/generated/protocol.d.mts +2 -2
- package/dist/generated/protocol.mjs +9 -2
- package/dist/{identity-C5N86BPz.d.mts → identity-B4XBWkqg.d.cts} +3 -1
- package/dist/{identity-DJ06jn4k.d.cts → identity-CIb9dGkJ.d.mts} +3 -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-sW8d6Og-.d.cts → protocol-gbXtNeOc.d.cts} +33 -6
- package/dist/{protocol-sW8d6Og-.d.mts → protocol-gbXtNeOc.d.mts} +33 -6
- package/dist/{tokens-DfVfE00W.d.cts → tokens-C9Kwy0Gk.d.cts} +4 -2
- package/dist/{tokens-VicRWTj1.mjs → tokens-CdQwzCyJ.mjs} +2 -0
- package/dist/{tokens-CiNXdKJ8.cjs → tokens-DxGVURpB.cjs} +2 -0
- package/dist/{tokens-CpLDI5Fo.d.mts → tokens-k172l0Iy.d.mts} +4 -2
- package/dist/{transport-B5E896PN.d.mts → transport-DAsFqDDS.d.cts} +1 -1
- package/dist/{transport-DxZ4JWZc.d.cts → transport-Dy4h2eNY.d.mts} +1 -1
- package/package.json +9 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame, Q as PeerAdvert, U as ManageError, V as ManageCommand, W as ManageOk, _t as RevocationEntry, f as CapabilityScope, ot as ProtocolVersion, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, N as Frame, Q as PeerAdvert, U as ManageError, V as ManageCommand, W as ManageOk, _t as RevocationEntry, f as CapabilityScope, ot as ProtocolVersion, p as CapabilityToken } from "../protocol-gbXtNeOc.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-CIb9dGkJ.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.mjs";
|
|
4
|
-
import { r as Transport, t as Connection } from "../transport-
|
|
4
|
+
import { r as Transport, t as Connection } from "../transport-Dy4h2eNY.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. */
|
|
7
7
|
export declare const HANDSHAKE_TIMEOUT_MS = 3000;
|
|
@@ -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-gbXtNeOc.cjs";
|
|
2
|
+
import { t as Connection } from "../transport-DAsFqDDS.cjs";
|
|
3
3
|
//#region src/domain/relay-hub.d.ts
|
|
4
4
|
export interface RelayHub {
|
|
5
5
|
/** Drives one accepted connection until it closes: registers gossip-advertised devices, re-broadcasts each gossip frame to every other connected client and replies to the gossiping connection with a catch-up frame of every other already-known device, answers relay-connect by pairing and notifying the target, and forwards relay-data within established pairings. Resolves when the connection's frame stream ends. Internally just registerConnection followed by a loop of onFrame calls and a final onDisconnect -- kept as its own method since a dedicated hub deployment (wire-mesh-node/cloudflare-hub) has nothing else driving the connection and wants the whole lifecycle in one call. */
|
|
@@ -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-gbXtNeOc.mjs";
|
|
2
|
+
import { t as Connection } from "../transport-Dy4h2eNY.mjs";
|
|
3
3
|
//#region src/domain/relay-hub.d.ts
|
|
4
4
|
export interface RelayHub {
|
|
5
5
|
/** Drives one accepted connection until it closes: registers gossip-advertised devices, re-broadcasts each gossip frame to every other connected client and replies to the gossiping connection with a catch-up frame of every other already-known device, answers relay-connect by pairing and notifying the target, and forwards relay-data within established pairings. Resolves when the connection's frame stream ends. Internally just registerConnection followed by a loop of onFrame calls and a final onDisconnect -- kept as its own method since a dedicated hub deployment (wire-mesh-node/cloudflare-hub) has nothing else driving the connection and wants the whole lifecycle in one call. */
|
|
@@ -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-gbXtNeOc.cjs";
|
|
2
|
+
import { t as Connection } from "../transport-DAsFqDDS.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-gbXtNeOc.mjs";
|
|
2
|
+
import { t as Connection } from "../transport-Dy4h2eNY.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,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_domain_device_id = require("./device-id.cjs");
|
|
3
|
-
const require_tokens = require("../tokens-
|
|
3
|
+
const require_tokens = require("../tokens-DxGVURpB.cjs");
|
|
4
4
|
//#region src/domain/revocation-view.ts
|
|
5
5
|
function revocationKey(tokenId) {
|
|
6
6
|
return require_domain_device_id.bytesToHex(tokenId);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _t as RevocationEntry } from "../protocol-
|
|
2
|
-
import { a as RevocationCheck, d as VerifyRevocationEntryOptions, o as RevocationEntryVerdict } from "../tokens-
|
|
1
|
+
import { _t as RevocationEntry } from "../protocol-gbXtNeOc.cjs";
|
|
2
|
+
import { a as RevocationCheck, d as VerifyRevocationEntryOptions, o as RevocationEntryVerdict } from "../tokens-C9Kwy0Gk.cjs";
|
|
3
3
|
//#region src/domain/revocation-view.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* An in-memory RevocationCheck fed by ingested revocation-announce frames. Keyed by token-id alone, per management.cddl's contract: a token-id can legitimately carry multiple recorded entries from different issuers (the token's own issuer, and/or any number of parties holding a delegated manage:revoke authorization over it) -- entriesFor returns every one of them unfiltered, since checking which actually apply (issuer-match, or a verified authorization) is verifyTokenChain's own obligation, not this store's.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _t as RevocationEntry } from "../protocol-
|
|
2
|
-
import { a as RevocationCheck, d as VerifyRevocationEntryOptions, o as RevocationEntryVerdict } from "../tokens-
|
|
1
|
+
import { _t as RevocationEntry } from "../protocol-gbXtNeOc.mjs";
|
|
2
|
+
import { a as RevocationCheck, d as VerifyRevocationEntryOptions, o as RevocationEntryVerdict } from "../tokens-k172l0Iy.mjs";
|
|
3
3
|
//#region src/domain/revocation-view.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* An in-memory RevocationCheck fed by ingested revocation-announce frames. Keyed by token-id alone, per management.cddl's contract: a token-id can legitimately carry multiple recorded entries from different issuers (the token's own issuer, and/or any number of parties holding a delegated manage:revoke authorization over it) -- entriesFor returns every one of them unfiltered, since checking which actually apply (issuer-match, or a verified authorization) is verifyTokenChain's own obligation, not this store's.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bytesToHex } from "./device-id.mjs";
|
|
2
|
-
import { a as verifyRevocationEntry } from "../tokens-
|
|
2
|
+
import { a as verifyRevocationEntry } from "../tokens-CdQwzCyJ.mjs";
|
|
3
3
|
//#region src/domain/revocation-view.ts
|
|
4
4
|
function revocationKey(tokenId) {
|
|
5
5
|
return bytesToHex(tokenId);
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_generated_protocol = require("../generated/protocol.cjs");
|
|
3
|
+
const require_domain_group_key = require("./group-key.cjs");
|
|
4
|
+
const require_domain_room_token_verification = require("./room-token-verification.cjs");
|
|
5
|
+
//#region src/domain/room-rekey.ts
|
|
6
|
+
/**
|
|
7
|
+
* room.rekey (wire-mesh#141, spec/room.cddl): distributes and rotates a room's symmetric content-encryption key. Two responsibilities, split the same way capability-grant.ts and capability-request.ts already split theirs: sendRoomRekey is the pushing side (a thin wrapper over MeshSession.sendManageRequest), and createRoomRekeyHandler is the receiving side.
|
|
8
|
+
*
|
|
9
|
+
* The receiving side's own security property is worth stating plainly, since it's what makes this handler simpler than it might look: it needs no separate check of who actually sent the request. verifyRoomToken (obligation 1) already certifies that the recipient's OWN held room:member token's delegation chain terminates at the room's real, rightful owner -- deriving the ECDH shared secret against that certified owner's own rootIssuerKey means a wrapped-key only ever unwraps correctly when it was actually produced by someone holding the real owner's private key. A forged room.rekey from anyone else -- an attacker, a not-yet-admitted stranger, even another legitimate member with no admission authority -- cannot produce ciphertext that unwraps, so it fails closed on the cryptography itself rather than needing a redundant, separately-maintained live-sender identity check.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Builds a room.rekey command per room.cddl. The outer verb is room:member, the same "one resource, several inner verbs" pattern room.send/room.leave/room.members already establish -- not a new capability of its own.
|
|
13
|
+
*/
|
|
14
|
+
function buildRoomRekeyCommand(keyEpoch, wrappedKey) {
|
|
15
|
+
return {
|
|
16
|
+
verb: require_domain_room_token_verification.ROOM_MEMBER_CAPABILITY,
|
|
17
|
+
params: {
|
|
18
|
+
verb: "room.rekey",
|
|
19
|
+
"key-epoch": keyEpoch,
|
|
20
|
+
"wrapped-key": wrappedKey
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Sends a room.rekey for roomPath. targetDevice/token forward directly to MeshSession.sendManageRequest's own identically-named parameters, exactly as sendRoomMessage's own doc comment already describes. */
|
|
25
|
+
async function sendRoomRekey(session, roomPath, keyEpoch, wrappedKey, targetDevice, token) {
|
|
26
|
+
return session.sendManageRequest(buildRoomRekeyCommand(keyEpoch, wrappedKey), {
|
|
27
|
+
kind: "room",
|
|
28
|
+
path: roomPath
|
|
29
|
+
}, targetDevice, token);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Builds a reusable handler for one room's incoming room.rekey messages. Checks, in order: the outer verb is room:member (otherwise "malformed"); the params payload parses against room.rekey's own CDDL shape (otherwise "malformed"); the request's own scope is a room scope (otherwise "scope_mismatch"); ownRoomMemberToken independently passes every one of core/room's six verifier obligations, scoped to the incoming request's own room path (a failure responds with verifyRoomToken's own specific reason, e.g. "wrong_chain_root"/"wrong_scope_path"/"expired"); this identity actually supports deriveSharedSecret (otherwise "ecdh_unsupported" -- an Ed25519-only identity genuinely cannot participate). Only then does it derive the shared secret against the verified chain's own rootIssuerKey, derive one wrapping key per granted epoch (per the array-ordering convention: entry i is epoch i+1, counting back from key-epoch), and unwrap each -- a failure at that final cryptographic step (a forged sender, or genuine corruption) responds "unwrap_failed" rather than surfacing a partially-decoded result.
|
|
33
|
+
*/
|
|
34
|
+
function createRoomRekeyHandler(options) {
|
|
35
|
+
return async function handleRoomRekey(incoming) {
|
|
36
|
+
if (incoming.command.verb !== "room:member") {
|
|
37
|
+
await incoming.respond({
|
|
38
|
+
result: "error",
|
|
39
|
+
code: "malformed"
|
|
40
|
+
});
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const parsed = require_generated_protocol.roomRekeySchema.safeParse(incoming.command.params);
|
|
44
|
+
if (!parsed.success) {
|
|
45
|
+
await incoming.respond({
|
|
46
|
+
result: "error",
|
|
47
|
+
code: "malformed"
|
|
48
|
+
});
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (incoming.scope.kind !== "room" || incoming.scope.path === void 0) {
|
|
52
|
+
await incoming.respond({
|
|
53
|
+
result: "error",
|
|
54
|
+
code: "scope_mismatch"
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const roomPath = incoming.scope.path;
|
|
59
|
+
const verdict = await require_domain_room_token_verification.verifyRoomToken(options.ownRoomMemberToken, {
|
|
60
|
+
identity: options.identity,
|
|
61
|
+
clock: options.clock,
|
|
62
|
+
revocation: options.revocation,
|
|
63
|
+
expectedBearer: options.identity.deviceId,
|
|
64
|
+
roomPath
|
|
65
|
+
});
|
|
66
|
+
if (!verdict.ok) {
|
|
67
|
+
await incoming.respond({
|
|
68
|
+
result: "error",
|
|
69
|
+
code: verdict.reason
|
|
70
|
+
});
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const deriveSharedSecret = options.identity.deriveSharedSecret;
|
|
74
|
+
if (deriveSharedSecret === void 0) {
|
|
75
|
+
await incoming.respond({
|
|
76
|
+
result: "error",
|
|
77
|
+
code: "ecdh_unsupported"
|
|
78
|
+
});
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const keyEpoch = parsed.data["key-epoch"];
|
|
82
|
+
const wrappedKeys = Array.isArray(parsed.data["wrapped-key"]) ? parsed.data["wrapped-key"] : [parsed.data["wrapped-key"]];
|
|
83
|
+
const firstEpoch = keyEpoch - wrappedKeys.length + 1;
|
|
84
|
+
let contentKeys;
|
|
85
|
+
try {
|
|
86
|
+
const sharedSecret = await deriveSharedSecret(verdict.rootIssuerKey);
|
|
87
|
+
contentKeys = await Promise.all(wrappedKeys.map(async (wrapped, i) => {
|
|
88
|
+
const wrappingKey = await require_domain_group_key.deriveWrappingKey(sharedSecret, {
|
|
89
|
+
room: roomPath,
|
|
90
|
+
keyEpoch: firstEpoch + i
|
|
91
|
+
});
|
|
92
|
+
return require_domain_group_key.unwrapContentKey(wrappingKey, wrapped);
|
|
93
|
+
}));
|
|
94
|
+
} catch {
|
|
95
|
+
await incoming.respond({
|
|
96
|
+
result: "error",
|
|
97
|
+
code: "unwrap_failed"
|
|
98
|
+
});
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
await incoming.respond({ result: "ok" });
|
|
102
|
+
options.onRekey({
|
|
103
|
+
room: roomPath,
|
|
104
|
+
keyEpoch,
|
|
105
|
+
contentKeys
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
exports.buildRoomRekeyCommand = buildRoomRekeyCommand;
|
|
111
|
+
exports.createRoomRekeyHandler = createRoomRekeyHandler;
|
|
112
|
+
exports.sendRoomRekey = sendRoomRekey;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, p as CapabilityToken } from "../protocol-gbXtNeOc.cjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-B4XBWkqg.cjs";
|
|
3
|
+
import { t as Clock } from "../clock-DiSx-WKM.cjs";
|
|
4
|
+
import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.cjs";
|
|
5
|
+
import { a as RevocationCheck } from "../tokens-C9Kwy0Gk.cjs";
|
|
6
|
+
//#region src/domain/room-rekey.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Builds a room.rekey command per room.cddl. The outer verb is room:member, the same "one resource, several inner verbs" pattern room.send/room.leave/room.members already establish -- not a new capability of its own.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildRoomRekeyCommand(keyEpoch: number, wrappedKey: Uint8Array | readonly Uint8Array[]): ManageCommand;
|
|
11
|
+
/** Sends a room.rekey for roomPath. targetDevice/token forward directly to MeshSession.sendManageRequest's own identically-named parameters, exactly as sendRoomMessage's own doc comment already describes. */
|
|
12
|
+
export declare function sendRoomRekey(session: Readonly<MeshSession>, roomPath: string, keyEpoch: number, wrappedKey: Uint8Array | readonly Uint8Array[], targetDevice?: DeviceId, token?: CapabilityToken): Promise<ManageOutcome>;
|
|
13
|
+
/** One incoming, fully-verified and unwrapped room.rekey, surfaced for the domain to store (index content keys by epoch for later room-notice decryption). */
|
|
14
|
+
export interface RoomRekeyEvent {
|
|
15
|
+
room: string;
|
|
16
|
+
/** The highest epoch this room.rekey granted -- the same value the wire message itself carried. */
|
|
17
|
+
keyEpoch: number;
|
|
18
|
+
/** contentKeys[i] is the content-encryption key for epoch i+1, matching wrapped-key's own array-ordering convention (spec/room.cddl) -- always at least one entry (the current epoch), even under the default single-bstr, members-at-the-time policy. */
|
|
19
|
+
contentKeys: readonly Uint8Array[];
|
|
20
|
+
}
|
|
21
|
+
export interface CreateRoomRekeyHandlerOptions {
|
|
22
|
+
/** This recipient's own identity -- both the verification primitives ownRoomMemberToken is checked with, and (via deriveSharedSecret) the ECDH half of unwrapping. */
|
|
23
|
+
identity: IdentityPort;
|
|
24
|
+
clock: Clock;
|
|
25
|
+
revocation: RevocationCheck;
|
|
26
|
+
/** This recipient's own currently-held room:member token for the room being rekeyed, verified fresh on every incoming room.rekey (not cached) -- see this module's own doc comment for why its certified root issuer-key is what the ECDH derivation uses, rather than a separately-tracked live-sender identity. */
|
|
27
|
+
ownRoomMemberToken: CapabilityToken;
|
|
28
|
+
/** Called once per successfully unwrapped room.rekey. */
|
|
29
|
+
onRekey: (event: Readonly<RoomRekeyEvent>) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Builds a reusable handler for one room's incoming room.rekey messages. Checks, in order: the outer verb is room:member (otherwise "malformed"); the params payload parses against room.rekey's own CDDL shape (otherwise "malformed"); the request's own scope is a room scope (otherwise "scope_mismatch"); ownRoomMemberToken independently passes every one of core/room's six verifier obligations, scoped to the incoming request's own room path (a failure responds with verifyRoomToken's own specific reason, e.g. "wrong_chain_root"/"wrong_scope_path"/"expired"); this identity actually supports deriveSharedSecret (otherwise "ecdh_unsupported" -- an Ed25519-only identity genuinely cannot participate). Only then does it derive the shared secret against the verified chain's own rootIssuerKey, derive one wrapping key per granted epoch (per the array-ordering convention: entry i is epoch i+1, counting back from key-epoch), and unwrap each -- a failure at that final cryptographic step (a forged sender, or genuine corruption) responds "unwrap_failed" rather than surfacing a partially-decoded result.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createRoomRekeyHandler(options: Readonly<CreateRoomRekeyHandlerOptions>): (incoming: Readonly<IncomingManageRequest>) => Promise<void>;
|
|
35
|
+
//#endregion
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, p as CapabilityToken } from "../protocol-gbXtNeOc.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-CIb9dGkJ.mjs";
|
|
3
|
+
import { t as Clock } from "../clock-DiSx-WKM.mjs";
|
|
4
|
+
import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.mjs";
|
|
5
|
+
import { a as RevocationCheck } from "../tokens-k172l0Iy.mjs";
|
|
6
|
+
//#region src/domain/room-rekey.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Builds a room.rekey command per room.cddl. The outer verb is room:member, the same "one resource, several inner verbs" pattern room.send/room.leave/room.members already establish -- not a new capability of its own.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildRoomRekeyCommand(keyEpoch: number, wrappedKey: Uint8Array | readonly Uint8Array[]): ManageCommand;
|
|
11
|
+
/** Sends a room.rekey for roomPath. targetDevice/token forward directly to MeshSession.sendManageRequest's own identically-named parameters, exactly as sendRoomMessage's own doc comment already describes. */
|
|
12
|
+
export declare function sendRoomRekey(session: Readonly<MeshSession>, roomPath: string, keyEpoch: number, wrappedKey: Uint8Array | readonly Uint8Array[], targetDevice?: DeviceId, token?: CapabilityToken): Promise<ManageOutcome>;
|
|
13
|
+
/** One incoming, fully-verified and unwrapped room.rekey, surfaced for the domain to store (index content keys by epoch for later room-notice decryption). */
|
|
14
|
+
export interface RoomRekeyEvent {
|
|
15
|
+
room: string;
|
|
16
|
+
/** The highest epoch this room.rekey granted -- the same value the wire message itself carried. */
|
|
17
|
+
keyEpoch: number;
|
|
18
|
+
/** contentKeys[i] is the content-encryption key for epoch i+1, matching wrapped-key's own array-ordering convention (spec/room.cddl) -- always at least one entry (the current epoch), even under the default single-bstr, members-at-the-time policy. */
|
|
19
|
+
contentKeys: readonly Uint8Array[];
|
|
20
|
+
}
|
|
21
|
+
export interface CreateRoomRekeyHandlerOptions {
|
|
22
|
+
/** This recipient's own identity -- both the verification primitives ownRoomMemberToken is checked with, and (via deriveSharedSecret) the ECDH half of unwrapping. */
|
|
23
|
+
identity: IdentityPort;
|
|
24
|
+
clock: Clock;
|
|
25
|
+
revocation: RevocationCheck;
|
|
26
|
+
/** This recipient's own currently-held room:member token for the room being rekeyed, verified fresh on every incoming room.rekey (not cached) -- see this module's own doc comment for why its certified root issuer-key is what the ECDH derivation uses, rather than a separately-tracked live-sender identity. */
|
|
27
|
+
ownRoomMemberToken: CapabilityToken;
|
|
28
|
+
/** Called once per successfully unwrapped room.rekey. */
|
|
29
|
+
onRekey: (event: Readonly<RoomRekeyEvent>) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Builds a reusable handler for one room's incoming room.rekey messages. Checks, in order: the outer verb is room:member (otherwise "malformed"); the params payload parses against room.rekey's own CDDL shape (otherwise "malformed"); the request's own scope is a room scope (otherwise "scope_mismatch"); ownRoomMemberToken independently passes every one of core/room's six verifier obligations, scoped to the incoming request's own room path (a failure responds with verifyRoomToken's own specific reason, e.g. "wrong_chain_root"/"wrong_scope_path"/"expired"); this identity actually supports deriveSharedSecret (otherwise "ecdh_unsupported" -- an Ed25519-only identity genuinely cannot participate). Only then does it derive the shared secret against the verified chain's own rootIssuerKey, derive one wrapping key per granted epoch (per the array-ordering convention: entry i is epoch i+1, counting back from key-epoch), and unwrap each -- a failure at that final cryptographic step (a forged sender, or genuine corruption) responds "unwrap_failed" rather than surfacing a partially-decoded result.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createRoomRekeyHandler(options: Readonly<CreateRoomRekeyHandlerOptions>): (incoming: Readonly<IncomingManageRequest>) => Promise<void>;
|
|
35
|
+
//#endregion
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { roomRekeySchema } from "../generated/protocol.mjs";
|
|
2
|
+
import { deriveWrappingKey, unwrapContentKey } from "./group-key.mjs";
|
|
3
|
+
import { ROOM_MEMBER_CAPABILITY, verifyRoomToken } from "./room-token-verification.mjs";
|
|
4
|
+
//#region src/domain/room-rekey.ts
|
|
5
|
+
/**
|
|
6
|
+
* room.rekey (wire-mesh#141, spec/room.cddl): distributes and rotates a room's symmetric content-encryption key. Two responsibilities, split the same way capability-grant.ts and capability-request.ts already split theirs: sendRoomRekey is the pushing side (a thin wrapper over MeshSession.sendManageRequest), and createRoomRekeyHandler is the receiving side.
|
|
7
|
+
*
|
|
8
|
+
* The receiving side's own security property is worth stating plainly, since it's what makes this handler simpler than it might look: it needs no separate check of who actually sent the request. verifyRoomToken (obligation 1) already certifies that the recipient's OWN held room:member token's delegation chain terminates at the room's real, rightful owner -- deriving the ECDH shared secret against that certified owner's own rootIssuerKey means a wrapped-key only ever unwraps correctly when it was actually produced by someone holding the real owner's private key. A forged room.rekey from anyone else -- an attacker, a not-yet-admitted stranger, even another legitimate member with no admission authority -- cannot produce ciphertext that unwraps, so it fails closed on the cryptography itself rather than needing a redundant, separately-maintained live-sender identity check.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Builds a room.rekey command per room.cddl. The outer verb is room:member, the same "one resource, several inner verbs" pattern room.send/room.leave/room.members already establish -- not a new capability of its own.
|
|
12
|
+
*/
|
|
13
|
+
function buildRoomRekeyCommand(keyEpoch, wrappedKey) {
|
|
14
|
+
return {
|
|
15
|
+
verb: ROOM_MEMBER_CAPABILITY,
|
|
16
|
+
params: {
|
|
17
|
+
verb: "room.rekey",
|
|
18
|
+
"key-epoch": keyEpoch,
|
|
19
|
+
"wrapped-key": wrappedKey
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Sends a room.rekey for roomPath. targetDevice/token forward directly to MeshSession.sendManageRequest's own identically-named parameters, exactly as sendRoomMessage's own doc comment already describes. */
|
|
24
|
+
async function sendRoomRekey(session, roomPath, keyEpoch, wrappedKey, targetDevice, token) {
|
|
25
|
+
return session.sendManageRequest(buildRoomRekeyCommand(keyEpoch, wrappedKey), {
|
|
26
|
+
kind: "room",
|
|
27
|
+
path: roomPath
|
|
28
|
+
}, targetDevice, token);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Builds a reusable handler for one room's incoming room.rekey messages. Checks, in order: the outer verb is room:member (otherwise "malformed"); the params payload parses against room.rekey's own CDDL shape (otherwise "malformed"); the request's own scope is a room scope (otherwise "scope_mismatch"); ownRoomMemberToken independently passes every one of core/room's six verifier obligations, scoped to the incoming request's own room path (a failure responds with verifyRoomToken's own specific reason, e.g. "wrong_chain_root"/"wrong_scope_path"/"expired"); this identity actually supports deriveSharedSecret (otherwise "ecdh_unsupported" -- an Ed25519-only identity genuinely cannot participate). Only then does it derive the shared secret against the verified chain's own rootIssuerKey, derive one wrapping key per granted epoch (per the array-ordering convention: entry i is epoch i+1, counting back from key-epoch), and unwrap each -- a failure at that final cryptographic step (a forged sender, or genuine corruption) responds "unwrap_failed" rather than surfacing a partially-decoded result.
|
|
32
|
+
*/
|
|
33
|
+
function createRoomRekeyHandler(options) {
|
|
34
|
+
return async function handleRoomRekey(incoming) {
|
|
35
|
+
if (incoming.command.verb !== "room:member") {
|
|
36
|
+
await incoming.respond({
|
|
37
|
+
result: "error",
|
|
38
|
+
code: "malformed"
|
|
39
|
+
});
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const parsed = roomRekeySchema.safeParse(incoming.command.params);
|
|
43
|
+
if (!parsed.success) {
|
|
44
|
+
await incoming.respond({
|
|
45
|
+
result: "error",
|
|
46
|
+
code: "malformed"
|
|
47
|
+
});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (incoming.scope.kind !== "room" || incoming.scope.path === void 0) {
|
|
51
|
+
await incoming.respond({
|
|
52
|
+
result: "error",
|
|
53
|
+
code: "scope_mismatch"
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const roomPath = incoming.scope.path;
|
|
58
|
+
const verdict = await verifyRoomToken(options.ownRoomMemberToken, {
|
|
59
|
+
identity: options.identity,
|
|
60
|
+
clock: options.clock,
|
|
61
|
+
revocation: options.revocation,
|
|
62
|
+
expectedBearer: options.identity.deviceId,
|
|
63
|
+
roomPath
|
|
64
|
+
});
|
|
65
|
+
if (!verdict.ok) {
|
|
66
|
+
await incoming.respond({
|
|
67
|
+
result: "error",
|
|
68
|
+
code: verdict.reason
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const deriveSharedSecret = options.identity.deriveSharedSecret;
|
|
73
|
+
if (deriveSharedSecret === void 0) {
|
|
74
|
+
await incoming.respond({
|
|
75
|
+
result: "error",
|
|
76
|
+
code: "ecdh_unsupported"
|
|
77
|
+
});
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const keyEpoch = parsed.data["key-epoch"];
|
|
81
|
+
const wrappedKeys = Array.isArray(parsed.data["wrapped-key"]) ? parsed.data["wrapped-key"] : [parsed.data["wrapped-key"]];
|
|
82
|
+
const firstEpoch = keyEpoch - wrappedKeys.length + 1;
|
|
83
|
+
let contentKeys;
|
|
84
|
+
try {
|
|
85
|
+
const sharedSecret = await deriveSharedSecret(verdict.rootIssuerKey);
|
|
86
|
+
contentKeys = await Promise.all(wrappedKeys.map(async (wrapped, i) => {
|
|
87
|
+
const wrappingKey = await deriveWrappingKey(sharedSecret, {
|
|
88
|
+
room: roomPath,
|
|
89
|
+
keyEpoch: firstEpoch + i
|
|
90
|
+
});
|
|
91
|
+
return unwrapContentKey(wrappingKey, wrapped);
|
|
92
|
+
}));
|
|
93
|
+
} catch {
|
|
94
|
+
await incoming.respond({
|
|
95
|
+
result: "error",
|
|
96
|
+
code: "unwrap_failed"
|
|
97
|
+
});
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
await incoming.respond({ result: "ok" });
|
|
101
|
+
options.onRekey({
|
|
102
|
+
room: roomPath,
|
|
103
|
+
keyEpoch,
|
|
104
|
+
contentKeys
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { buildRoomRekeyCommand, createRoomRekeyHandler, sendRoomRekey };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_domain_device_id = require("./device-id.cjs");
|
|
3
|
-
const require_tokens = require("../tokens-
|
|
3
|
+
const require_tokens = require("../tokens-DxGVURpB.cjs");
|
|
4
4
|
const require_domain_room_path = require("./room-path.cjs");
|
|
5
5
|
//#region src/domain/room-token-verification.ts
|
|
6
6
|
/**
|
|
@@ -35,7 +35,8 @@ async function verifyRoomToken(token, options) {
|
|
|
35
35
|
};
|
|
36
36
|
return {
|
|
37
37
|
ok: true,
|
|
38
|
-
claims: verdict.claims
|
|
38
|
+
claims: verdict.claims,
|
|
39
|
+
rootIssuerKey: verdict.rootIssuerKey
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId,
|
|
2
|
-
import { l as TokenVerdictReason, u as VerifyCapabilityTokenOptions } from "../tokens-
|
|
1
|
+
import { B as IdentityKey, D as DeviceId, It as TokenClaims, p as CapabilityToken } from "../protocol-gbXtNeOc.cjs";
|
|
2
|
+
import { l as TokenVerdictReason, u as VerifyCapabilityTokenOptions } from "../tokens-C9Kwy0Gk.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. */
|
|
5
5
|
export declare const ROOM_MEMBER_CAPABILITY = "room:member";
|
|
@@ -7,6 +7,8 @@ export type RoomTokenVerdictReason = TokenVerdictReason | "wrong_scope_kind" | "
|
|
|
7
7
|
export type RoomTokenVerdict = {
|
|
8
8
|
ok: true;
|
|
9
9
|
claims: TokenClaims;
|
|
10
|
+
/** The chain's own certified root issuer-key -- for a named room, this is exactly the room's rightful owner (obligation 1 just confirmed the chain terminates there), and for a DM it's the verifying identity's own key. Lets a caller (e.g. room.rekey's own handler) derive an ECDH shared secret against the room's real owner with no separate live-sender identity check needed. */
|
|
11
|
+
rootIssuerKey: IdentityKey;
|
|
10
12
|
} | {
|
|
11
13
|
ok: false;
|
|
12
14
|
reason: RoomTokenVerdictReason;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId,
|
|
2
|
-
import { l as TokenVerdictReason, u as VerifyCapabilityTokenOptions } from "../tokens-
|
|
1
|
+
import { B as IdentityKey, D as DeviceId, It as TokenClaims, p as CapabilityToken } from "../protocol-gbXtNeOc.mjs";
|
|
2
|
+
import { l as TokenVerdictReason, u as VerifyCapabilityTokenOptions } from "../tokens-k172l0Iy.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. */
|
|
5
5
|
export declare const ROOM_MEMBER_CAPABILITY = "room:member";
|
|
@@ -7,6 +7,8 @@ export type RoomTokenVerdictReason = TokenVerdictReason | "wrong_scope_kind" | "
|
|
|
7
7
|
export type RoomTokenVerdict = {
|
|
8
8
|
ok: true;
|
|
9
9
|
claims: TokenClaims;
|
|
10
|
+
/** The chain's own certified root issuer-key -- for a named room, this is exactly the room's rightful owner (obligation 1 just confirmed the chain terminates there), and for a DM it's the verifying identity's own key. Lets a caller (e.g. room.rekey's own handler) derive an ECDH shared secret against the room's real owner with no separate live-sender identity check needed. */
|
|
11
|
+
rootIssuerKey: IdentityKey;
|
|
10
12
|
} | {
|
|
11
13
|
ok: false;
|
|
12
14
|
reason: RoomTokenVerdictReason;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { deviceIdToHex } from "./device-id.mjs";
|
|
2
|
-
import { i as verifyCapabilityToken } from "../tokens-
|
|
2
|
+
import { i as verifyCapabilityToken } from "../tokens-CdQwzCyJ.mjs";
|
|
3
3
|
import { parseRoomPath } from "./room-path.mjs";
|
|
4
4
|
//#region src/domain/room-token-verification.ts
|
|
5
5
|
/**
|
|
@@ -34,7 +34,8 @@ async function verifyRoomToken(token, options) {
|
|
|
34
34
|
};
|
|
35
35
|
return {
|
|
36
36
|
ok: true,
|
|
37
|
-
claims: verdict.claims
|
|
37
|
+
claims: verdict.claims,
|
|
38
|
+
rootIssuerKey: verdict.rootIssuerKey
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
41
|
//#endregion
|
package/dist/domain/room.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Dt as RoomPath, Et as RoomNoticeClaims, Tt as RoomNotice, p as CapabilityToken, q as MessageRef } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { Dt as RoomPath, Et as RoomNoticeClaims, Tt as RoomNotice, p as CapabilityToken, q as MessageRef } from "../protocol-gbXtNeOc.cjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-B4XBWkqg.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.cjs";
|
|
4
|
-
import { a as RevocationCheck } from "../tokens-
|
|
4
|
+
import { a as RevocationCheck } from "../tokens-C9Kwy0Gk.cjs";
|
|
5
5
|
import { RoomTokenVerdictReason } from "./room-token-verification.cjs";
|
|
6
6
|
//#region src/domain/room.d.ts
|
|
7
7
|
export type RoomNoticeVerdictReason = "malformed" | "wrong_room" | "bad_signature" | "wrong_poster" | "content_expired" | RoomTokenVerdictReason;
|
package/dist/domain/room.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Dt as RoomPath, Et as RoomNoticeClaims, Tt as RoomNotice, p as CapabilityToken, q as MessageRef } from "../protocol-
|
|
2
|
-
import { t as IdentityPort } from "../identity-
|
|
1
|
+
import { Dt as RoomPath, Et as RoomNoticeClaims, Tt as RoomNotice, p as CapabilityToken, q as MessageRef } from "../protocol-gbXtNeOc.mjs";
|
|
2
|
+
import { t as IdentityPort } from "../identity-CIb9dGkJ.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DiSx-WKM.mjs";
|
|
4
|
-
import { a as RevocationCheck } from "../tokens-
|
|
4
|
+
import { a as RevocationCheck } from "../tokens-k172l0Iy.mjs";
|
|
5
5
|
import { RoomTokenVerdictReason } from "./room-token-verification.mjs";
|
|
6
6
|
//#region src/domain/room.d.ts
|
|
7
7
|
export type RoomNoticeVerdictReason = "malformed" | "wrong_room" | "bad_signature" | "wrong_poster" | "content_expired" | RoomTokenVerdictReason;
|
package/dist/domain/tokens.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_tokens = require("../tokens-
|
|
2
|
+
const require_tokens = require("../tokens-DxGVURpB.cjs");
|
|
3
3
|
exports.canGrant = require_tokens.canGrant;
|
|
4
4
|
exports.mintCapabilityToken = require_tokens.mintCapabilityToken;
|
|
5
5
|
exports.mintRevocationEntry = require_tokens.mintRevocationEntry;
|
package/dist/domain/tokens.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RevocationCheck, c as TokenVerdict, d as VerifyRevocationEntryOptions, f as canGrant, g as verifyRevocationEntry, h as verifyCapabilityToken, i as MintVerdict, l as TokenVerdictReason, m as mintRevocationEntry, n as MintRefusalReason, o as RevocationEntryVerdict, p as mintCapabilityToken, r as MintRevocationEntryOptions, s as RevocationEntryVerdictReason, t as MintCapabilityTokenOptions, u as VerifyCapabilityTokenOptions } from "../tokens-
|
|
1
|
+
import { a as RevocationCheck, c as TokenVerdict, d as VerifyRevocationEntryOptions, f as canGrant, g as verifyRevocationEntry, h as verifyCapabilityToken, i as MintVerdict, l as TokenVerdictReason, m as mintRevocationEntry, n as MintRefusalReason, o as RevocationEntryVerdict, p as mintCapabilityToken, r as MintRevocationEntryOptions, s as RevocationEntryVerdictReason, t as MintCapabilityTokenOptions, u as VerifyCapabilityTokenOptions } from "../tokens-C9Kwy0Gk.cjs";
|
|
2
2
|
export { MintCapabilityTokenOptions, MintRefusalReason, MintRevocationEntryOptions, MintVerdict, RevocationCheck, RevocationEntryVerdict, RevocationEntryVerdictReason, TokenVerdict, TokenVerdictReason, VerifyCapabilityTokenOptions, VerifyRevocationEntryOptions, canGrant, mintCapabilityToken, mintRevocationEntry, verifyCapabilityToken, verifyRevocationEntry };
|
package/dist/domain/tokens.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RevocationCheck, c as TokenVerdict, d as VerifyRevocationEntryOptions, f as canGrant, g as verifyRevocationEntry, h as verifyCapabilityToken, i as MintVerdict, l as TokenVerdictReason, m as mintRevocationEntry, n as MintRefusalReason, o as RevocationEntryVerdict, p as mintCapabilityToken, r as MintRevocationEntryOptions, s as RevocationEntryVerdictReason, t as MintCapabilityTokenOptions, u as VerifyCapabilityTokenOptions } from "../tokens-
|
|
1
|
+
import { a as RevocationCheck, c as TokenVerdict, d as VerifyRevocationEntryOptions, f as canGrant, g as verifyRevocationEntry, h as verifyCapabilityToken, i as MintVerdict, l as TokenVerdictReason, m as mintRevocationEntry, n as MintRefusalReason, o as RevocationEntryVerdict, p as mintCapabilityToken, r as MintRevocationEntryOptions, s as RevocationEntryVerdictReason, t as MintCapabilityTokenOptions, u as VerifyCapabilityTokenOptions } from "../tokens-k172l0Iy.mjs";
|
|
2
2
|
export { MintCapabilityTokenOptions, MintRefusalReason, MintRevocationEntryOptions, MintVerdict, RevocationCheck, RevocationEntryVerdict, RevocationEntryVerdictReason, TokenVerdict, TokenVerdictReason, VerifyCapabilityTokenOptions, VerifyRevocationEntryOptions, canGrant, mintCapabilityToken, mintRevocationEntry, verifyCapabilityToken, verifyRevocationEntry };
|
package/dist/domain/tokens.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as verifyRevocationEntry, i as verifyCapabilityToken, n as mintCapabilityToken, r as mintRevocationEntry, t as canGrant } from "../tokens-
|
|
1
|
+
import { a as verifyRevocationEntry, i as verifyCapabilityToken, n as mintCapabilityToken, r as mintRevocationEntry, t as canGrant } from "../tokens-CdQwzCyJ.mjs";
|
|
2
2
|
export { canGrant, mintCapabilityToken, mintRevocationEntry, verifyCapabilityToken, verifyRevocationEntry };
|
|
@@ -44,6 +44,7 @@ const manageCommandParamsSchema = zod.z.lazy(() => zod.z.union([
|
|
|
44
44
|
zod.z.lazy(() => roomMembersSchema)
|
|
45
45
|
]),
|
|
46
46
|
zod.z.union([zod.z.lazy(() => roomJoinSchema), zod.z.lazy(() => roomInviteSchema)]),
|
|
47
|
+
zod.z.lazy(() => roomRekeySchema),
|
|
47
48
|
zod.z.union([
|
|
48
49
|
zod.z.lazy(() => webrtcOfferSchema),
|
|
49
50
|
zod.z.lazy(() => webrtcAnswerSchema),
|
|
@@ -276,6 +277,11 @@ const roomInviteSchema = zod.z.lazy(() => zod.z.object({
|
|
|
276
277
|
"invitee": zod.z.lazy(() => deviceIdSchema),
|
|
277
278
|
"token": zod.z.lazy(() => capabilityTokenSchema)
|
|
278
279
|
}).catchall(zod.z.unknown()));
|
|
280
|
+
const roomRekeySchema = zod.z.lazy(() => zod.z.object({
|
|
281
|
+
"verb": zod.z.literal("room.rekey"),
|
|
282
|
+
"key-epoch": zod.z.number().int().nonnegative(),
|
|
283
|
+
"wrapped-key": zod.z.union([zod.z.instanceof(Uint8Array), zod.z.array(zod.z.instanceof(Uint8Array))])
|
|
284
|
+
}).catchall(zod.z.unknown()));
|
|
279
285
|
const roomMemberSchema = zod.z.lazy(() => zod.z.object({ "device": zod.z.lazy(() => deviceIdSchema) }).catchall(zod.z.unknown()));
|
|
280
286
|
const roomJoinOkSchema = zod.z.lazy(() => zod.z.object({
|
|
281
287
|
"result": zod.z.literal("ok"),
|
|
@@ -297,7 +303,8 @@ const roomNoticeClaimsSchema = zod.z.lazy(() => zod.z.object({
|
|
|
297
303
|
"content-type": zod.z.string(),
|
|
298
304
|
"content": zod.z.instanceof(Uint8Array),
|
|
299
305
|
"refs": zod.z.array(zod.z.lazy(() => messageRefSchema)).optional(),
|
|
300
|
-
"valid-until": zod.z.number().int().nonnegative().optional()
|
|
306
|
+
"valid-until": zod.z.number().int().nonnegative().optional(),
|
|
307
|
+
"key-epoch": zod.z.number().int().nonnegative().optional()
|
|
301
308
|
}).catchall(zod.z.unknown()));
|
|
302
309
|
const streamSessionSchema = zod.z.lazy(() => zod.z.number().int().nonnegative());
|
|
303
310
|
const streamDataFrameSchema = zod.z.lazy(() => zod.z.object({
|
|
@@ -524,6 +531,7 @@ exports.roomNoticeClaimsSchema = roomNoticeClaimsSchema;
|
|
|
524
531
|
exports.roomNoticeSchema = roomNoticeSchema;
|
|
525
532
|
exports.roomPathSchema = roomPathSchema;
|
|
526
533
|
exports.roomReadSchema = roomReadSchema;
|
|
534
|
+
exports.roomRekeySchema = roomRekeySchema;
|
|
527
535
|
exports.roomSendSchema = roomSendSchema;
|
|
528
536
|
exports.streamAckFrameSchema = streamAckFrameSchema;
|
|
529
537
|
exports.streamDataFrameSchema = streamDataFrameSchema;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as PeerIdentity, $n as
|
|
2
|
-
export { BulkAckFrame, BulkCancel, BulkDataFrame, BulkEndFrame, BulkOpen, BulkResume, CandidateKind, CandidatesFrame, CapabilityGrant, 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, TransferId, WebrtcAnswer, WebrtcIceCandidate, WebrtcOffer, WireCandidate, bulkAckFrameSchema, bulkCancelSchema, bulkDataFrameSchema, bulkEndFrameSchema, bulkOpenSchema, bulkResumeSchema, candidateKindSchema, candidatesFrameSchema, capabilityGrantOkSchema, capabilityGrantSchema, 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, transferIdSchema, webrtcAnswerSchema, webrtcIceCandidateSchema, webrtcOfferSchema, wireCandidateSchema };
|
|
1
|
+
import { $ as PeerIdentity, $n as relayDataFrameSchema, $t as capabilityScopeSchema, A as DomainId, An as manageErrorSchema, At as RoomSend, B as IdentityKey, Bn as peerIdentitySchema, Bt as WebrtcOffer, C as CoseTokenHeaders, Cn as handleClaimsSchema, Cr as tokenClaimsSchema, Ct as RoomMembers, D as DeviceId, Dn as identityKeySchema, Dr as webrtcOfferSchema, Dt as RoomPath, E as DataRequestFrame, En as iceCandidateInitSchema, Er as webrtcIceCandidateSchema, Et as RoomNoticeClaims, F as GossipFrame, Fn as namespacedCapabilitySchema, Ft as SyncPunchFrame, G as ManageRequestFrame, Gn as procSignalSchema, Gt as bulkEndFrameSchema, H as ManageCommandParams, Hn as privateUseCapabilitySchema, Ht as bulkAckFrameSchema, I as HandleClaims, In as namespacedDomainIdSchema, It as TokenClaims, J as NamespacedCapability, Jn as ptyKillSchema, Jt as candidateKindSchema, K as ManageResponseFrame, Kn as procSpawnSchema, Kt as bulkOpenSchema, L as HandleRecord, Ln as observedAddressFrameSchema, Lt as TransferId, M as ExecSessionInfo, Mn as manageRequestFrameSchema, Mt as StreamDataFrame, N as Frame, Nn as manageResponseFrameSchema, Nt as StreamEndFrame, O as DeviceIdHex, On as manageCommandParamsSchema, Or as wireCandidateSchema, Ot as RoomRead, P as FrameVariant, Pn as messageRefSchema, Pt as StreamSession, Q as PeerAdvert, Qn as relayConnectFrameSchema, Qt as capabilityRequestSchema, R as HandshakeFrame, Rn as ownerNamedRoomPathSchema, Rt as WebrtcAnswer, S as CoseSign1, Sn as gossipFrameSchema, Sr as syncPunchFrameSchema, St as RoomMember, T as DataHaveFrame, Tn as handshakeFrameSchema, Tr as webrtcAnswerSchema, Tt as RoomNotice, U as ManageError, Un as privateUseDomainIdSchema, Ut as bulkCancelSchema, V as ManageCommand, Vn as pingFrameSchema, Vt as WireCandidate, W as ManageOk, Wn as procKillSchema, Wt as bulkDataFrameSchema, X as ObservedAddressFrame, Xn as ptySpawnSchema, Xt as capabilityGrantOkSchema, Y as NamespacedDomainId, Yn as ptyResizeSchema, Yt as candidatesFrameSchema, Z as OwnerNamedRoomPath, Zn as ptyWriteSchema, Zt as capabilityGrantSchema, _ as CoreCapability, _n as domainIdSchema, _r as roomSendSchema, _t as RevocationEntry, a as BulkOpen, an as coreDomainNameSchema, ar as roomInviteSchema, at as ProcSpawn, b as CoseHeaderKid, bn as frameSchema, br as streamEndFrameSchema, bt as RoomJoinOk, c as CandidatesFrame, cn as coseHeaderLabelSchema, cr as roomLeaveSchema, ct as PtyResize, d as CapabilityRequest, dn as dataEntriesFrameSchema, dr as roomMembersSchema, dt as RelayConnectFrame, en as capabilityTokenSchema, er as relayInboundFrameSchema, et as PingFrame, f as CapabilityScope, fn as dataHaveFrameSchema, fr as roomNoticeClaimsSchema, ft as RelayDataFrame, g as CoordinatorFrame, gn as dmRoomPathSchema, gr as roomRekeySchema, gt as RevocationClaims, h as CloseFrame, hn as deviceIdSchema, hr as roomReadSchema, ht as RevocationAnnounceFrame, i as BulkEndFrame, in as coreCapabilitySchema, ir as revocationEntrySchema, it as ProcSignal, j as ExecList, jn as manageOkSchema, jt as StreamAckFrame, k as DmRoomPath, kn as manageCommandSchema, kt as RoomRekey, l as CapabilityGrant, ln as coseSign1Schema, lr as roomMemberSchema, lt as PtySpawn, m as CapabilityVerb, mn as deviceIdHexSchema, mr as roomPathSchema, mt as RelayOfferFrame, n as BulkCancel, nn as closeFrameSchema, nr as revocationAnnounceFrameSchema, nt as PrivateUseDomainId, o as BulkResume, on as coseHeaderAlgSchema, or as roomJoinOkSchema, ot as ProtocolVersion, p as CapabilityToken, pn as dataRequestFrameSchema, pr as roomNoticeSchema, pt as RelayInboundFrame, q as MessageRef, qn as protocolVersionSchema, qt as bulkResumeSchema, r as BulkDataFrame, rn as coordinatorFrameSchema, rr as revocationClaimsSchema, rt as ProcKill, s as CandidateKind, sn as coseHeaderKidSchema, sr as roomJoinSchema, st as PtyKill, t as BulkAckFrame, tn as capabilityVerbSchema, tr as relayOfferFrameSchema, tt as PrivateUseCapability, u as CapabilityGrantOk, un as coseTokenHeadersSchema, ur as roomMembersOkSchema, ut as PtyWrite, v as CoreDomainName, vn as execListSchema, vr as streamAckFrameSchema, vt as RoomInvite, w as DataEntriesFrame, wn as handleRecordSchema, wr as transferIdSchema, wt as RoomMembersOk, x as CoseHeaderLabel, xn as frameVariantSchema, xr as streamSessionSchema, xt as RoomLeave, y as CoseHeaderAlg, yn as execSessionInfoSchema, yr as streamDataFrameSchema, yt as RoomJoin, z as IceCandidateInit, zn as peerAdvertSchema, zt as WebrtcIceCandidate } from "../protocol-gbXtNeOc.cjs";
|
|
2
|
+
export { BulkAckFrame, BulkCancel, BulkDataFrame, BulkEndFrame, BulkOpen, BulkResume, CandidateKind, CandidatesFrame, CapabilityGrant, 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, RoomRekey, RoomSend, StreamAckFrame, StreamDataFrame, StreamEndFrame, StreamSession, SyncPunchFrame, TokenClaims, TransferId, WebrtcAnswer, WebrtcIceCandidate, WebrtcOffer, WireCandidate, bulkAckFrameSchema, bulkCancelSchema, bulkDataFrameSchema, bulkEndFrameSchema, bulkOpenSchema, bulkResumeSchema, candidateKindSchema, candidatesFrameSchema, capabilityGrantOkSchema, capabilityGrantSchema, 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, roomRekeySchema, roomSendSchema, streamAckFrameSchema, streamDataFrameSchema, streamEndFrameSchema, streamSessionSchema, syncPunchFrameSchema, tokenClaimsSchema, transferIdSchema, webrtcAnswerSchema, webrtcIceCandidateSchema, webrtcOfferSchema, wireCandidateSchema };
|