wire-mesh-core 3.5.1 → 3.6.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.
|
@@ -10,7 +10,8 @@ import { RoomNoticeVerdictReason } from "./room.cjs";
|
|
|
10
10
|
*/
|
|
11
11
|
export interface RoomKeyStore {
|
|
12
12
|
get: (room: string, epoch: number) => Promise<Uint8Array | undefined>;
|
|
13
|
-
|
|
13
|
+
/** May be asynchronous, as storing a key durably is; callers wait for it before relying on the key being held. */
|
|
14
|
+
set: (room: string, epoch: number, key: Uint8Array) => Promise<void> | void;
|
|
14
15
|
/** The highest epoch held for a room -- what postEncryptedNotice stamps a new notice with. */
|
|
15
16
|
currentEpoch: (room: string) => Promise<number | undefined>;
|
|
16
17
|
}
|
|
@@ -10,7 +10,8 @@ import { RoomNoticeVerdictReason } from "./room.mjs";
|
|
|
10
10
|
*/
|
|
11
11
|
export interface RoomKeyStore {
|
|
12
12
|
get: (room: string, epoch: number) => Promise<Uint8Array | undefined>;
|
|
13
|
-
|
|
13
|
+
/** May be asynchronous, as storing a key durably is; callers wait for it before relying on the key being held. */
|
|
14
|
+
set: (room: string, epoch: number, key: Uint8Array) => Promise<void> | void;
|
|
14
15
|
/** The highest epoch held for a room -- what postEncryptedNotice stamps a new notice with. */
|
|
15
16
|
currentEpoch: (room: string) => Promise<number | undefined>;
|
|
16
17
|
}
|
|
@@ -25,8 +25,8 @@ export interface CreateRoomRekeyHandlerOptions {
|
|
|
25
25
|
revocation: RevocationCheck;
|
|
26
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
27
|
ownRoomMemberToken: CapabilityToken;
|
|
28
|
-
/** Called once per successfully unwrapped room.rekey. */
|
|
29
|
-
onRekey: (event: Readonly<RoomRekeyEvent>) => void;
|
|
28
|
+
/** Called once per successfully unwrapped room.rekey, after the sender has been told it succeeded. May be asynchronous, as storing a key durably is; the handler waits for it, so a failure to store reaches whoever awaits the handler. */
|
|
29
|
+
onRekey: (event: Readonly<RoomRekeyEvent>) => Promise<void> | void;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
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.
|
|
@@ -25,8 +25,8 @@ export interface CreateRoomRekeyHandlerOptions {
|
|
|
25
25
|
revocation: RevocationCheck;
|
|
26
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
27
|
ownRoomMemberToken: CapabilityToken;
|
|
28
|
-
/** Called once per successfully unwrapped room.rekey. */
|
|
29
|
-
onRekey: (event: Readonly<RoomRekeyEvent>) => void;
|
|
28
|
+
/** Called once per successfully unwrapped room.rekey, after the sender has been told it succeeded. May be asynchronous, as storing a key durably is; the handler waits for it, so a failure to store reaches whoever awaits the handler. */
|
|
29
|
+
onRekey: (event: Readonly<RoomRekeyEvent>) => Promise<void> | void;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
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.
|