@canonmsg/agent-sdk 11.2.1 → 12.1.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/README.md +248 -523
- package/dist/chunks/chunk-7N6OPPW4.js +5430 -0
- package/dist/chunks/chunk-N722GWCP.js +4897 -0
- package/dist/chunks/chunk-QZ4PPRQW.js +14247 -0
- package/dist/chunks/mls-crypto-LMNQZOS6.js +10 -0
- package/dist/cli.js +572 -0
- package/dist/drivers/claude.d.ts +42 -0
- package/dist/drivers/code.d.ts +18 -0
- package/dist/drivers/codex.d.ts +46 -0
- package/dist/drivers/connector.d.ts +34 -0
- package/dist/index.d.ts +20 -25
- package/dist/index.js +91 -13
- package/dist/internal/backend-contracts/agentBehaviorPolicy.d.ts +122 -0
- package/dist/internal/backend-contracts/agentDirectory.d.ts +32 -0
- package/dist/internal/backend-contracts/agentOrigin.d.ts +23 -0
- package/dist/internal/backend-contracts/agentSearch.d.ts +17 -0
- package/dist/internal/backend-contracts/api-origins.generated.d.ts +4 -0
- package/dist/internal/backend-contracts/apiErrors.d.ts +1 -0
- package/dist/internal/backend-contracts/artifactActions.d.ts +8 -0
- package/dist/internal/backend-contracts/artifacts.d.ts +386 -0
- package/dist/internal/backend-contracts/clientFloor.d.ts +41 -0
- package/dist/internal/backend-contracts/communication.d.ts +146 -0
- package/dist/internal/backend-contracts/connectorRelay.d.ts +179 -0
- package/dist/internal/backend-contracts/conversationMembership.d.ts +28 -0
- package/dist/internal/backend-contracts/deliveryObservation.d.ts +23 -0
- package/dist/internal/backend-contracts/diffRedaction.d.ts +6 -0
- package/dist/internal/backend-contracts/endpoint-unread.d.ts +4 -0
- package/dist/internal/backend-contracts/endpoint.d.ts +120 -0
- package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +48 -0
- package/dist/internal/backend-contracts/environment.d.ts +20 -0
- package/dist/internal/backend-contracts/externalInbound.d.ts +24 -0
- package/dist/internal/backend-contracts/firestoreValues.d.ts +9 -0
- package/dist/internal/backend-contracts/index.d.ts +54 -0
- package/dist/internal/backend-contracts/media-url.d.ts +20 -0
- package/dist/internal/backend-contracts/media.d.ts +51 -0
- package/dist/internal/backend-contracts/mediaDelivery.d.ts +46 -0
- package/dist/internal/backend-contracts/mediaTransferProtocol.d.ts +17 -0
- package/dist/internal/backend-contracts/membershipChange.d.ts +21 -0
- package/dist/internal/backend-contracts/message.d.ts +86 -0
- package/dist/internal/backend-contracts/messageText.d.ts +6 -0
- package/dist/internal/backend-contracts/mlsDevApplication.d.ts +161 -0
- package/dist/internal/backend-contracts/mlsDevCredential.d.ts +78 -0
- package/dist/internal/backend-contracts/mlsDevCredentialReconciliation.d.ts +45 -0
- package/dist/internal/backend-contracts/mlsDevDeviceCustody.d.ts +52 -0
- package/dist/internal/backend-contracts/mlsDevEnrollment.d.ts +75 -0
- package/dist/internal/backend-contracts/mlsDevFeedReceipt.d.ts +43 -0
- package/dist/internal/backend-contracts/mlsDevGroup.d.ts +321 -0
- package/dist/internal/backend-contracts/mlsDevGroupFeed.d.ts +51 -0
- package/dist/internal/backend-contracts/mlsDevInteraction.d.ts +159 -0
- package/dist/internal/backend-contracts/mlsDevKeyPackage.d.ts +42 -0
- package/dist/internal/backend-contracts/mlsDevKeyPackages.d.ts +55 -0
- package/dist/internal/backend-contracts/mlsEnvironment.d.ts +35 -0
- package/dist/internal/backend-contracts/mlsPrincipalAlias.d.ts +23 -0
- package/dist/internal/backend-contracts/moderation.d.ts +7 -0
- package/dist/internal/backend-contracts/plaintextProcessors.d.ts +63 -0
- package/dist/internal/backend-contracts/preparedContent.d.ts +54 -0
- package/dist/internal/backend-contracts/replyAuthority.d.ts +14 -0
- package/dist/internal/backend-contracts/runtimeCardFields.d.ts +66 -0
- package/dist/internal/backend-contracts/runtimeCardStorage.d.ts +3 -0
- package/dist/internal/backend-contracts/runtimeDescriptor.d.ts +88 -0
- package/dist/internal/backend-contracts/selfContext.d.ts +9 -0
- package/dist/internal/backend-contracts/turnProtocol.d.ts +43 -0
- package/dist/internal/backend-contracts/upload-mime-types.d.ts +17 -0
- package/dist/internal/backend-contracts/verbContract.d.ts +856 -0
- package/dist/internal/backend-contracts/verbSchemas.d.ts +1717 -0
- package/dist/internal/backend-contracts/verbWire.d.ts +493 -0
- package/dist/internal/backend-contracts/webAuth.d.ts +8 -0
- package/dist/internal/core/agent-profiles.d.ts +65 -0
- package/dist/internal/core/approval-format.d.ts +22 -0
- package/dist/internal/core/approval-manager.d.ts +43 -0
- package/dist/internal/core/approval-types.d.ts +73 -0
- package/dist/internal/core/base-url.d.ts +1 -0
- package/dist/internal/core/cli-metadata.d.ts +13 -0
- package/dist/internal/core/client.d.ts +432 -0
- package/dist/internal/core/completed-output-journal.d.ts +39 -0
- package/dist/internal/core/constants.d.ts +1 -0
- package/dist/internal/core/endpoint-client.d.ts +56 -0
- package/dist/internal/core/execution-environment-mode.d.ts +6 -0
- package/dist/internal/core/gifs.d.ts +29 -0
- package/dist/internal/core/host-runtime.d.ts +53 -0
- package/dist/internal/core/index.d.ts +68 -0
- package/dist/internal/core/node-media.d.ts +6 -0
- package/dist/internal/core/policy.d.ts +2 -0
- package/dist/internal/core/registration-profile.d.ts +10 -0
- package/dist/internal/core/registration-session.d.ts +55 -0
- package/dist/internal/core/registration.d.ts +5 -0
- package/dist/internal/core/retry.d.ts +113 -0
- package/dist/internal/core/rtdb-rest.d.ts +141 -0
- package/dist/internal/core/runtime-cards.d.ts +286 -0
- package/dist/internal/core/runtime-descriptor.d.ts +16 -0
- package/dist/internal/core/runtime-endpoints.d.ts +26 -0
- package/dist/internal/core/runtime-heartbeat.d.ts +29 -0
- package/dist/internal/core/runtime-presentation.d.ts +9 -0
- package/dist/internal/core/runtime-request-manager.d.ts +283 -0
- package/dist/internal/core/runtime-state-publisher.d.ts +42 -0
- package/dist/internal/core/self-context.d.ts +22 -0
- package/dist/internal/core/silent-turn.d.ts +49 -0
- package/dist/internal/core/stream.d.ts +78 -0
- package/dist/internal/core/turn-protocol.d.ts +28 -0
- package/dist/internal/core/turn-verbosity.d.ts +85 -0
- package/dist/internal/core/types.d.ts +964 -0
- package/dist/internal/core/unified-diff.d.ts +35 -0
- package/dist/internal/endpoint/artifact-images.d.ts +60 -0
- package/dist/internal/endpoint/artifact-reducer.d.ts +35 -0
- package/dist/internal/endpoint/artifact-views.d.ts +113 -0
- package/dist/internal/endpoint/artifacts.d.ts +75 -0
- package/dist/internal/endpoint/delivery.d.ts +47 -0
- package/dist/internal/endpoint/engine.d.ts +249 -0
- package/dist/internal/endpoint/ephemeral.d.ts +8 -0
- package/dist/internal/endpoint/events.d.ts +32 -0
- package/dist/internal/endpoint/external-inbound.d.ts +36 -0
- package/dist/internal/endpoint/handoff.d.ts +50 -0
- package/dist/internal/endpoint/history.d.ts +22 -0
- package/dist/internal/endpoint/image-generation-errors.d.ts +2 -0
- package/dist/internal/endpoint/inbound.d.ts +29 -0
- package/dist/internal/endpoint/index.d.ts +32 -0
- package/dist/internal/endpoint/media.d.ts +177 -0
- package/dist/internal/endpoint/migration.d.ts +50 -0
- package/dist/internal/endpoint/mls-crypto.d.ts +32 -0
- package/dist/internal/endpoint/mls-dev-client.d.ts +52 -0
- package/dist/internal/endpoint/mls-dev-device.d.ts +69 -0
- package/dist/internal/endpoint/mls-dev-groups.d.ts +174 -0
- package/dist/internal/endpoint/mls-dev-interactions.d.ts +99 -0
- package/dist/internal/endpoint/mls-dev-key-package-service.d.ts +46 -0
- package/dist/internal/endpoint/mls-dev-key-packages.d.ts +62 -0
- package/dist/internal/endpoint/mls-dev-text.d.ts +67 -0
- package/dist/internal/endpoint/mls-dev-transport.d.ts +38 -0
- package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +29 -0
- package/dist/internal/endpoint/node-mls-custody.d.ts +15 -0
- package/dist/internal/endpoint/node.d.ts +7 -0
- package/dist/internal/endpoint/observe-query.d.ts +17 -0
- package/dist/internal/endpoint/portable-node-mls-custody.d.ts +23 -0
- package/dist/internal/endpoint/queue.d.ts +22 -0
- package/dist/internal/endpoint/recovery.d.ts +27 -0
- package/dist/internal/endpoint/retention.d.ts +7 -0
- package/dist/internal/endpoint/store.d.ts +22 -0
- package/dist/internal/endpoint/sync.d.ts +33 -0
- package/dist/internal/endpoint/transient-publisher.d.ts +8 -0
- package/dist/internal/endpoint/transport.d.ts +63 -0
- package/dist/media.d.ts +1 -1
- package/dist/media.js +42 -541
- package/dist/runner/errands.d.ts +118 -0
- package/dist/runner/mls.d.ts +97 -0
- package/dist/runner/relay.d.ts +87 -0
- package/dist/runner/runner.d.ts +98 -0
- package/dist/runner/types.d.ts +215 -0
- package/package.json +18 -5
- package/dist/attached-session.d.ts +0 -58
- package/dist/attached-session.js +0 -638
- package/dist/bounded-file-read.d.ts +0 -14
- package/dist/bounded-file-read.js +0 -34
- package/dist/canon-agent.d.ts +0 -236
- package/dist/canon-agent.js +0 -2531
- package/dist/debouncer.d.ts +0 -18
- package/dist/debouncer.js +0 -133
- package/dist/inbound-handoff.d.ts +0 -6
- package/dist/inbound-handoff.js +0 -17
- package/dist/managed-session-host.d.ts +0 -27
- package/dist/managed-session-host.js +0 -195
- package/dist/managed-session-setup.d.ts +0 -99
- package/dist/managed-session-setup.js +0 -234
- package/dist/realtime.d.ts +0 -62
- package/dist/realtime.js +0 -193
- package/dist/runtime-card.d.ts +0 -48
- package/dist/runtime-card.js +0 -64
- package/dist/session-manager.d.ts +0 -77
- package/dist/session-manager.js +0 -285
- package/dist/turn-streaming-request.d.ts +0 -17
- package/dist/turn-streaming-request.js +0 -22
- package/dist/turn-verbosity-option.d.ts +0 -33
- package/dist/turn-verbosity-option.js +0 -23
- package/dist/types.d.ts +0 -387
- package/dist/types.js +0 -1
- package/dist/work-session-coordination.d.ts +0 -21
- package/dist/work-session-coordination.js +0 -53
- package/dist/work-session-host.d.ts +0 -31
- package/dist/work-session-host.js +0 -617
- package/dist/work-session-interactions.d.ts +0 -12
- package/dist/work-session-interactions.js +0 -173
- package/dist/work-session-state.d.ts +0 -36
- package/dist/work-session-state.js +0 -62
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { type MlsDevTextProtocol, type MlsDevInteractionBinding, type MlsDevItem, type MlsDevTextPayload, type MlsDevApplicationEnvelope, type MlsDevApplicationPreconditions } from './mlsDevApplication.js';
|
|
2
|
+
import { type MlsDevGroupFeedApplicationEntry } from './mlsDevGroupFeed.js';
|
|
3
|
+
import { type MlsDevFeedReceiptProof } from './mlsDevFeedReceipt.js';
|
|
4
|
+
import { type MlsDevEnrollmentDevice } from './mlsDevEnrollment.js';
|
|
5
|
+
import { type MlsDevKeyPackageClaimReceipt } from './mlsDevKeyPackages.js';
|
|
6
|
+
import { type MlsEnvironmentId } from './mlsEnvironment.js';
|
|
7
|
+
export declare const MLS_DEV_GROUP_ROSTER_MAX = 32;
|
|
8
|
+
export declare const MLS_DEV_GROUP_TLS_MAX_BYTES: number;
|
|
9
|
+
export declare const MLS_DEV_GROUP_CONTROL_MAX_BYTES: number;
|
|
10
|
+
export declare const MLS_DEV_GROUP_WRAPPED_MAX_BYTES: number;
|
|
11
|
+
export declare const MLS_DEV_GROUP_PREPARATION_MAX_BYTES: number;
|
|
12
|
+
export declare const MLS_DEV_GROUP_QUERY_MAX_BYTES: number;
|
|
13
|
+
export declare const MLS_DEV_GROUP_QUERY_MAX_CONTROLS = 4;
|
|
14
|
+
export interface MlsDevGroupCreateConversation {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly memberIds: readonly string[];
|
|
17
|
+
readonly mlsDev: {
|
|
18
|
+
readonly version: 1;
|
|
19
|
+
readonly conversationId: string;
|
|
20
|
+
readonly credential: string;
|
|
21
|
+
readonly protocol?: MlsDevTextProtocol;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface MlsDevGroupHead {
|
|
25
|
+
readonly sequence: number;
|
|
26
|
+
readonly epoch: number;
|
|
27
|
+
readonly hash: string;
|
|
28
|
+
}
|
|
29
|
+
export interface MlsDevGroupMarker {
|
|
30
|
+
readonly version: 1;
|
|
31
|
+
readonly groupId: string;
|
|
32
|
+
readonly head: MlsDevGroupHead;
|
|
33
|
+
}
|
|
34
|
+
export interface MlsDevGroupRosterEntry {
|
|
35
|
+
readonly device: MlsDevEnrollmentDevice;
|
|
36
|
+
readonly admissionId: string;
|
|
37
|
+
}
|
|
38
|
+
export interface MlsDevGroupPreconditions {
|
|
39
|
+
readonly membershipRevision: number;
|
|
40
|
+
readonly admissionId: string;
|
|
41
|
+
readonly targetAdmissionId: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface MlsDevGroupUnsignedControl {
|
|
44
|
+
readonly version: 1;
|
|
45
|
+
readonly environmentId: MlsEnvironmentId;
|
|
46
|
+
readonly kind: 'create' | 'add' | 'remove';
|
|
47
|
+
readonly conversationId: string;
|
|
48
|
+
readonly groupId: string;
|
|
49
|
+
readonly senderCredential: string;
|
|
50
|
+
readonly expectedHead: MlsDevGroupHead | null;
|
|
51
|
+
readonly epoch: number;
|
|
52
|
+
readonly preconditions: MlsDevGroupPreconditions;
|
|
53
|
+
readonly roster: readonly MlsDevGroupRosterEntry[];
|
|
54
|
+
readonly groupInfo: string | null;
|
|
55
|
+
readonly commit: string | null;
|
|
56
|
+
readonly welcome: string | null;
|
|
57
|
+
readonly keyPackageClaim: MlsDevKeyPackageClaimReceipt | null;
|
|
58
|
+
readonly removedDeviceId: string | null;
|
|
59
|
+
}
|
|
60
|
+
/** The device signs the closed public control plus the existing outer endpoint
|
|
61
|
+
* operation ID. Neither the signature nor an issuer credential grants membership. */
|
|
62
|
+
export interface MlsDevGroupControl extends MlsDevGroupUnsignedControl {
|
|
63
|
+
readonly proof: string;
|
|
64
|
+
}
|
|
65
|
+
export interface MlsDevGroupAcceptedControl {
|
|
66
|
+
readonly version: 1;
|
|
67
|
+
readonly authorization: 'group_control_only';
|
|
68
|
+
readonly operationId: string;
|
|
69
|
+
readonly control: MlsDevGroupControl;
|
|
70
|
+
readonly head: MlsDevGroupHead;
|
|
71
|
+
readonly acceptedAtMs: number;
|
|
72
|
+
readonly membershipRevision: number;
|
|
73
|
+
}
|
|
74
|
+
/** Which current members' devices a room still needs to admit (mls-rooms-by-default.md §2.4), asked by an admitted device. */
|
|
75
|
+
export interface MlsDevGroupAdmissionsQuery {
|
|
76
|
+
readonly version: 1;
|
|
77
|
+
readonly conversationId: string;
|
|
78
|
+
readonly credential: string;
|
|
79
|
+
}
|
|
80
|
+
export interface MlsDevGroupAdmissionCandidate {
|
|
81
|
+
readonly principal: {
|
|
82
|
+
readonly type: 'human' | 'ai_agent';
|
|
83
|
+
readonly id: string;
|
|
84
|
+
};
|
|
85
|
+
readonly deviceId: string;
|
|
86
|
+
/** The member's admission, the `targetAdmissionId` a claim for this device names. */
|
|
87
|
+
readonly targetAdmissionId: string;
|
|
88
|
+
}
|
|
89
|
+
export interface MlsDevGroupAdmissionsResult {
|
|
90
|
+
readonly version: 1;
|
|
91
|
+
readonly conversationId: string;
|
|
92
|
+
readonly membershipRevision: number;
|
|
93
|
+
/** Registered, eligible devices of current members that are not in the group and have a KeyPackage available. */
|
|
94
|
+
readonly candidates: readonly MlsDevGroupAdmissionCandidate[];
|
|
95
|
+
/** Current members with no device in the group (whether or not one is a candidate): the room's send hold (D2). */
|
|
96
|
+
readonly waitingPrincipalIds: readonly string[];
|
|
97
|
+
}
|
|
98
|
+
export declare const MLS_DEV_GROUP_ADMISSION_MAX_CANDIDATES = 64;
|
|
99
|
+
export interface MlsDevGroupQuery {
|
|
100
|
+
readonly version: 1;
|
|
101
|
+
readonly conversationId: string;
|
|
102
|
+
readonly credential: string;
|
|
103
|
+
readonly afterSequence: number;
|
|
104
|
+
readonly limit: number;
|
|
105
|
+
}
|
|
106
|
+
export interface MlsDevGroupQueryResult {
|
|
107
|
+
readonly version: 1;
|
|
108
|
+
readonly conversationId: string;
|
|
109
|
+
readonly marker: MlsDevGroupMarker | null;
|
|
110
|
+
readonly membershipRevision: number;
|
|
111
|
+
readonly admissionId: string;
|
|
112
|
+
readonly roster: readonly MlsDevGroupRosterEntry[];
|
|
113
|
+
readonly controls: readonly MlsDevGroupAcceptedControl[];
|
|
114
|
+
readonly nextSequence: number;
|
|
115
|
+
readonly hasMore: boolean;
|
|
116
|
+
/** True exposes only the caller's bounded removal history, never later rows. */
|
|
117
|
+
readonly terminal: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface MlsDevGroupContext {
|
|
120
|
+
readonly version: 1;
|
|
121
|
+
readonly environmentId: MlsEnvironmentId;
|
|
122
|
+
readonly conversationId: string;
|
|
123
|
+
readonly groupId: string;
|
|
124
|
+
readonly deviceId: string;
|
|
125
|
+
readonly installationId: string;
|
|
126
|
+
/** Local protected-state revision, distinct from server sequence and MLS epoch. */
|
|
127
|
+
readonly revision: number;
|
|
128
|
+
readonly protocol?: MlsDevTextProtocol;
|
|
129
|
+
}
|
|
130
|
+
export type MlsDevGroupCommand = {
|
|
131
|
+
readonly op: 'encrypt_text';
|
|
132
|
+
readonly operationId: string;
|
|
133
|
+
readonly messageId: string;
|
|
134
|
+
readonly credential: string;
|
|
135
|
+
readonly expectedHead: MlsDevGroupHead;
|
|
136
|
+
readonly preconditions: MlsDevApplicationPreconditions;
|
|
137
|
+
readonly text: string;
|
|
138
|
+
/** v3 rooms only (mls-payload-v3.md §2); native refuses either in a v1 or v2 room. */
|
|
139
|
+
readonly replyTo?: MlsDevTextPayload['replyTo'];
|
|
140
|
+
readonly mentions?: MlsDevTextPayload['mentions'];
|
|
141
|
+
} | {
|
|
142
|
+
/** v3 rooms only (mls-payload-v3.md §2): native carries the item as an opaque object this contract validates. */
|
|
143
|
+
readonly op: 'encrypt_item';
|
|
144
|
+
readonly operationId: string;
|
|
145
|
+
readonly messageId: string;
|
|
146
|
+
readonly credential: string;
|
|
147
|
+
readonly expectedHead: MlsDevGroupHead;
|
|
148
|
+
readonly preconditions: MlsDevApplicationPreconditions;
|
|
149
|
+
readonly item: MlsDevItem;
|
|
150
|
+
} | {
|
|
151
|
+
readonly op: 'process_application';
|
|
152
|
+
readonly entry: MlsDevGroupFeedApplicationEntry;
|
|
153
|
+
} | {
|
|
154
|
+
/** v2 only (encrypted-interactions.md §2.3). `body` is the payload's `interaction` object; native adds a secret
|
|
155
|
+
* request's one-time `secretKey`, and with `seal` seals the answer text into `answer.sealed` for the requester. */
|
|
156
|
+
readonly op: 'encrypt_interaction';
|
|
157
|
+
readonly operationId: string;
|
|
158
|
+
readonly messageId: string;
|
|
159
|
+
readonly credential: string;
|
|
160
|
+
readonly expectedHead: MlsDevGroupHead;
|
|
161
|
+
readonly preconditions: MlsDevApplicationPreconditions;
|
|
162
|
+
readonly interaction: MlsDevInteractionBinding;
|
|
163
|
+
readonly body: Readonly<Record<string, unknown>>;
|
|
164
|
+
readonly seal: {
|
|
165
|
+
readonly text: string;
|
|
166
|
+
readonly publicKey: string;
|
|
167
|
+
readonly requesterDeviceId: string;
|
|
168
|
+
} | null;
|
|
169
|
+
} | {
|
|
170
|
+
/** The requester opens a sealed answer once; native removes the request's key from the state it returns (§2.5). */
|
|
171
|
+
readonly op: 'open_secret_answer';
|
|
172
|
+
readonly requestId: string;
|
|
173
|
+
readonly responderId: string;
|
|
174
|
+
readonly responderDeviceId: string;
|
|
175
|
+
readonly sealed: {
|
|
176
|
+
readonly enc: string;
|
|
177
|
+
readonly ciphertext: string;
|
|
178
|
+
};
|
|
179
|
+
} | {
|
|
180
|
+
readonly op: 'create';
|
|
181
|
+
readonly operationId: string;
|
|
182
|
+
readonly credential: string;
|
|
183
|
+
readonly preconditions: MlsDevGroupPreconditions;
|
|
184
|
+
} | {
|
|
185
|
+
readonly op: 'add';
|
|
186
|
+
readonly operationId: string;
|
|
187
|
+
readonly credential: string;
|
|
188
|
+
readonly expectedHead: MlsDevGroupHead;
|
|
189
|
+
readonly preconditions: MlsDevGroupPreconditions;
|
|
190
|
+
readonly keyPackageClaim: MlsDevKeyPackageClaimReceipt;
|
|
191
|
+
} | {
|
|
192
|
+
readonly op: 'remove';
|
|
193
|
+
readonly operationId: string;
|
|
194
|
+
readonly credential: string;
|
|
195
|
+
readonly expectedHead: MlsDevGroupHead;
|
|
196
|
+
readonly preconditions: MlsDevGroupPreconditions;
|
|
197
|
+
readonly removedDeviceId: string;
|
|
198
|
+
} | {
|
|
199
|
+
readonly op: 'finalize';
|
|
200
|
+
readonly accepted: MlsDevGroupAcceptedControl;
|
|
201
|
+
} | {
|
|
202
|
+
readonly op: 'discard';
|
|
203
|
+
readonly operationId: string;
|
|
204
|
+
readonly control: MlsDevGroupControl;
|
|
205
|
+
} | {
|
|
206
|
+
readonly op: 'join';
|
|
207
|
+
readonly credential: string;
|
|
208
|
+
readonly accepted: MlsDevGroupAcceptedControl;
|
|
209
|
+
/** Canon's signed acceptance time for the control at `feedOrdinal` (mls-signed-acceptance.md). */
|
|
210
|
+
readonly receiptProof: MlsDevFeedReceiptProof;
|
|
211
|
+
readonly feedOrdinal: number;
|
|
212
|
+
readonly keyPackageId: string;
|
|
213
|
+
} | {
|
|
214
|
+
readonly op: 'process';
|
|
215
|
+
readonly credential: string;
|
|
216
|
+
readonly accepted: MlsDevGroupAcceptedControl;
|
|
217
|
+
readonly receiptProof: MlsDevFeedReceiptProof;
|
|
218
|
+
readonly feedOrdinal: number;
|
|
219
|
+
};
|
|
220
|
+
export type MlsDevGroupPayload = {
|
|
221
|
+
readonly kind: 'application';
|
|
222
|
+
readonly envelope: MlsDevApplicationEnvelope;
|
|
223
|
+
/** `encrypt_item` only: the exact authored item plaintext, the endpoint's own copy. */
|
|
224
|
+
readonly payload?: string;
|
|
225
|
+
} | {
|
|
226
|
+
/** A received item: its exact plaintext JSON, which the endpoint parses (`parseMlsDevItemPayload`). */
|
|
227
|
+
readonly kind: 'item';
|
|
228
|
+
readonly messageId: string;
|
|
229
|
+
readonly operationId: string;
|
|
230
|
+
readonly senderDeviceId: string;
|
|
231
|
+
readonly payload: string;
|
|
232
|
+
readonly feedOrdinal: number;
|
|
233
|
+
} | {
|
|
234
|
+
readonly kind: 'text';
|
|
235
|
+
readonly messageId: string;
|
|
236
|
+
readonly operationId: string;
|
|
237
|
+
readonly senderDeviceId: string;
|
|
238
|
+
readonly text: string;
|
|
239
|
+
readonly replyTo?: MlsDevTextPayload['replyTo'];
|
|
240
|
+
readonly mentions?: MlsDevTextPayload['mentions'];
|
|
241
|
+
readonly feedOrdinal: number;
|
|
242
|
+
} | {
|
|
243
|
+
/** `payload` is the exact authored plaintext JSON: a secret request's public key, or only a sealed answer. */
|
|
244
|
+
readonly kind: 'interaction_application';
|
|
245
|
+
readonly envelope: MlsDevApplicationEnvelope;
|
|
246
|
+
readonly payload: string;
|
|
247
|
+
} | {
|
|
248
|
+
readonly kind: 'interaction';
|
|
249
|
+
readonly messageId: string;
|
|
250
|
+
readonly operationId: string;
|
|
251
|
+
readonly senderDeviceId: string;
|
|
252
|
+
readonly payload: string;
|
|
253
|
+
readonly feedOrdinal: number;
|
|
254
|
+
} | {
|
|
255
|
+
/** v2 only: content that failed native checks after an authenticated receive. Consumed, logged, never applied. */
|
|
256
|
+
readonly kind: 'invalid';
|
|
257
|
+
readonly messageId: string;
|
|
258
|
+
readonly operationId: string;
|
|
259
|
+
readonly senderDeviceId: string;
|
|
260
|
+
readonly feedOrdinal: number;
|
|
261
|
+
} | {
|
|
262
|
+
readonly kind: 'secret';
|
|
263
|
+
readonly requestId: string;
|
|
264
|
+
readonly text: string;
|
|
265
|
+
} | {
|
|
266
|
+
readonly kind: 'discarded';
|
|
267
|
+
readonly operationId: string;
|
|
268
|
+
readonly head: MlsDevGroupHead | null;
|
|
269
|
+
} | {
|
|
270
|
+
readonly kind: 'control';
|
|
271
|
+
readonly control: MlsDevGroupControl;
|
|
272
|
+
} | {
|
|
273
|
+
readonly kind: 'applied';
|
|
274
|
+
readonly head: MlsDevGroupHead;
|
|
275
|
+
readonly roster: readonly MlsDevGroupRosterEntry[];
|
|
276
|
+
readonly removed: boolean;
|
|
277
|
+
readonly consumedKeyPackageId: string | null;
|
|
278
|
+
};
|
|
279
|
+
export interface MlsDevGroupPreparation {
|
|
280
|
+
readonly wrappedState: string;
|
|
281
|
+
readonly payload: MlsDevGroupPayload;
|
|
282
|
+
}
|
|
283
|
+
export declare class MlsDevGroupValidationError extends Error {
|
|
284
|
+
readonly code = "INVALID_MLS_DEV_GROUP";
|
|
285
|
+
constructor();
|
|
286
|
+
}
|
|
287
|
+
export declare function parseMlsDevGroupCreateConversation(value: unknown): MlsDevGroupCreateConversation;
|
|
288
|
+
export declare function parseMlsDevGroupHead(value: unknown): MlsDevGroupHead;
|
|
289
|
+
export declare function parseMlsDevGroupMarker(value: unknown): MlsDevGroupMarker;
|
|
290
|
+
export declare function parseMlsDevGroupRoster(value: unknown): readonly MlsDevGroupRosterEntry[];
|
|
291
|
+
/** Hold, then close (owner ruling 2026-10-16; mls-dev-groups.md): how long an erased member's devices wait for a commit. */
|
|
292
|
+
export declare const MLS_DEV_ROOM_REMOVAL_DEADLINE_MS: number;
|
|
293
|
+
export interface MlsDevRoomRemovalEntry {
|
|
294
|
+
readonly principalId: string;
|
|
295
|
+
/** The erased principal's devices still in the MLS roster; any other admitted device may commit their removal. */
|
|
296
|
+
readonly deviceIds: readonly string[];
|
|
297
|
+
readonly deadlineAtMs: number;
|
|
298
|
+
}
|
|
299
|
+
/** `conversations/{id}.mlsRemoval`: `pending` holds every send; `closing` and `closed` refuse every later send and roster
|
|
300
|
+
* change. `closing` still lists the erased principals whose Canon membership the scheduler has yet to remove. */
|
|
301
|
+
export interface MlsDevRoomRemoval {
|
|
302
|
+
readonly version: 1;
|
|
303
|
+
readonly status: 'pending' | 'closing' | 'closed';
|
|
304
|
+
readonly pending: readonly MlsDevRoomRemovalEntry[];
|
|
305
|
+
readonly closedAtMs: number | null;
|
|
306
|
+
}
|
|
307
|
+
export declare function parseMlsDevRoomRemoval(value: unknown): MlsDevRoomRemoval;
|
|
308
|
+
export declare function parseMlsDevGroupPreconditions(value: unknown): MlsDevGroupPreconditions;
|
|
309
|
+
export declare function parseMlsDevGroupUnsignedControl(value: unknown): MlsDevGroupUnsignedControl;
|
|
310
|
+
export declare function parseMlsDevGroupControl(value: unknown): MlsDevGroupControl;
|
|
311
|
+
export declare function parseMlsDevGroupAcceptedControl(value: unknown): MlsDevGroupAcceptedControl;
|
|
312
|
+
export declare function parseMlsDevGroupAdmissionsQuery(value: unknown): MlsDevGroupAdmissionsQuery;
|
|
313
|
+
export declare function parseMlsDevGroupAdmissionsResult(value: unknown): MlsDevGroupAdmissionsResult;
|
|
314
|
+
export declare function parseMlsDevGroupQuery(value: unknown): MlsDevGroupQuery;
|
|
315
|
+
export declare function parseMlsDevGroupQueryResult(value: unknown): MlsDevGroupQueryResult;
|
|
316
|
+
export declare function parseMlsDevGroupContext(value: unknown): MlsDevGroupContext;
|
|
317
|
+
export declare function parseMlsDevGroupCommand(value: unknown): MlsDevGroupCommand;
|
|
318
|
+
export declare function parseMlsDevGroupPreparation(value: unknown): MlsDevGroupPreparation;
|
|
319
|
+
export declare function encodeMlsDevGroupControlProof(value: unknown, operationId: string): Uint8Array;
|
|
320
|
+
/** Hash these exact bytes with SHA-256 for the accepted control head. */
|
|
321
|
+
export declare function encodeMlsDevGroupHead(value: unknown, operationId: string): Uint8Array;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type MlsDevGroupAcceptedControl, type MlsDevGroupMarker, type MlsDevGroupRosterEntry } from './mlsDevGroup.js';
|
|
2
|
+
import { type MlsDevTextProtocol, type MlsDevApplicationEnvelope, type MlsDevApplicationReceipt } from './mlsDevApplication.js';
|
|
3
|
+
import { type MlsDevFeedReceiptProof } from './mlsDevFeedReceipt.js';
|
|
4
|
+
export declare const MLS_DEV_GROUP_FEED_MAX_ENTRIES = 4;
|
|
5
|
+
export declare const MLS_DEV_GROUP_FEED_MAX_BYTES: number;
|
|
6
|
+
export interface MlsDevGroupFeedControlEntry {
|
|
7
|
+
readonly version: 1;
|
|
8
|
+
readonly ordinal: number;
|
|
9
|
+
readonly kind: 'control';
|
|
10
|
+
readonly accepted: MlsDevGroupAcceptedControl;
|
|
11
|
+
/** Canon's signature over the time it accepted this entry (mls-signed-acceptance.md). */
|
|
12
|
+
readonly receiptProof?: MlsDevFeedReceiptProof;
|
|
13
|
+
}
|
|
14
|
+
export interface MlsDevGroupFeedApplicationEntry {
|
|
15
|
+
readonly version: 1;
|
|
16
|
+
readonly ordinal: number;
|
|
17
|
+
readonly kind: 'application';
|
|
18
|
+
readonly receipt: MlsDevApplicationReceipt;
|
|
19
|
+
readonly envelope: MlsDevApplicationEnvelope;
|
|
20
|
+
readonly receiptProof?: MlsDevFeedReceiptProof;
|
|
21
|
+
}
|
|
22
|
+
export type MlsDevGroupFeedEntry = MlsDevGroupFeedControlEntry | MlsDevGroupFeedApplicationEntry;
|
|
23
|
+
export interface MlsDevGroupFeedQuery {
|
|
24
|
+
readonly version: 1;
|
|
25
|
+
readonly conversationId: string;
|
|
26
|
+
readonly credential: string;
|
|
27
|
+
readonly afterOrdinal: number;
|
|
28
|
+
readonly limit: number;
|
|
29
|
+
}
|
|
30
|
+
export interface MlsDevGroupFeedResult {
|
|
31
|
+
readonly version: 1;
|
|
32
|
+
readonly protocol: MlsDevTextProtocol;
|
|
33
|
+
readonly conversationId: string;
|
|
34
|
+
readonly marker: MlsDevGroupMarker | null;
|
|
35
|
+
readonly membershipRevision: number;
|
|
36
|
+
readonly admissionId: string;
|
|
37
|
+
readonly roster: readonly MlsDevGroupRosterEntry[];
|
|
38
|
+
readonly minimumOrdinal: number | null;
|
|
39
|
+
readonly latestOrdinal: number;
|
|
40
|
+
readonly nextOrdinal: number;
|
|
41
|
+
readonly entries: readonly MlsDevGroupFeedEntry[];
|
|
42
|
+
readonly hasMore: boolean;
|
|
43
|
+
readonly terminal: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare class MlsDevGroupFeedValidationError extends Error {
|
|
46
|
+
readonly code = "INVALID_MLS_DEV_GROUP_FEED";
|
|
47
|
+
constructor();
|
|
48
|
+
}
|
|
49
|
+
export declare function parseMlsDevGroupFeedEntry(value: unknown): MlsDevGroupFeedEntry;
|
|
50
|
+
export declare function parseMlsDevGroupFeedQuery(value: unknown): MlsDevGroupFeedQuery;
|
|
51
|
+
export declare function parseMlsDevGroupFeedResult(value: unknown): MlsDevGroupFeedResult;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { type MlsDevInteractionBinding, type MlsDevInteractionKind, type MlsDevItemPayload, type MlsDevTextPayload } from './mlsDevApplication.js';
|
|
2
|
+
import { type MlsDevGroupHead } from './mlsDevGroup.js';
|
|
3
|
+
/**
|
|
4
|
+
* Encrypted approvals and questions in `canon.mls.dev-text.v2` rooms (docs/design/encrypted-interactions.md §2.3–§2.4).
|
|
5
|
+
* The MLS plaintext is a closed union on `kind`; every variant carries the text payload's shared ids. These parsers run
|
|
6
|
+
* in the sender's endpoint before encryption and in every recipient after decryption. Native custody treats an
|
|
7
|
+
* interaction body as canonical JSON and checks only the shared ids, kind and size.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MLS_DEV_INTERACTION_LIMITS: Readonly<{
|
|
10
|
+
title: 200;
|
|
11
|
+
details: 8000;
|
|
12
|
+
options: 10;
|
|
13
|
+
optionLabel: 120;
|
|
14
|
+
text: 4000;
|
|
15
|
+
}>;
|
|
16
|
+
/** RFC 9180 base mode, DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, AES-128-GCM: MLS suite 1's primitives. */
|
|
17
|
+
export declare const MLS_DEV_SECRET_ANSWER_SUITE: "x25519-hkdf-sha256-aes128gcm";
|
|
18
|
+
/** UTF-8 of at most 4,000 code points (4 bytes each) plus the AES-GCM tag. */
|
|
19
|
+
export declare const MLS_DEV_SECRET_ANSWER_MAX_BYTES: number;
|
|
20
|
+
export declare const MLS_DEV_INTERACTION_WITHDRAW_REASONS: readonly ["stopped", "turn_ended", "expired", "restart"];
|
|
21
|
+
export type MlsDevInteractionWithdrawReason = typeof MLS_DEV_INTERACTION_WITHDRAW_REASONS[number];
|
|
22
|
+
export interface MlsDevInteractionOption {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly label: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MlsDevInteractionRequestBody {
|
|
27
|
+
readonly requestId: string;
|
|
28
|
+
readonly kind: MlsDevInteractionKind;
|
|
29
|
+
readonly title: string;
|
|
30
|
+
readonly details?: string;
|
|
31
|
+
readonly options?: readonly MlsDevInteractionOption[];
|
|
32
|
+
readonly multiple?: boolean;
|
|
33
|
+
readonly risk?: 'normal' | 'destructive';
|
|
34
|
+
readonly allowSession?: boolean;
|
|
35
|
+
readonly scopeKey?: string;
|
|
36
|
+
readonly responderIds: readonly [string];
|
|
37
|
+
readonly expiresAtMs: number;
|
|
38
|
+
/** A secret request's one-time HPKE recipient key, generated and held by the requesting device's custody (§2.5). */
|
|
39
|
+
readonly secretKey?: {
|
|
40
|
+
readonly kem: 'x25519';
|
|
41
|
+
readonly publicKey: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export type MlsDevInteractionAnswer = {
|
|
45
|
+
readonly decision: 'allow' | 'deny';
|
|
46
|
+
readonly scope: 'once' | 'session';
|
|
47
|
+
} | {
|
|
48
|
+
readonly choices: readonly string[];
|
|
49
|
+
} | {
|
|
50
|
+
readonly text: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly sealed: {
|
|
53
|
+
readonly enc: string;
|
|
54
|
+
readonly ciphertext: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** The responder's Cancel/Skip on a question or secret card (review of #1081). */
|
|
58
|
+
| {
|
|
59
|
+
readonly cancelled: true;
|
|
60
|
+
};
|
|
61
|
+
export interface MlsDevInteractionResponseBody {
|
|
62
|
+
readonly requestId: string;
|
|
63
|
+
readonly agentId: string;
|
|
64
|
+
readonly answer: MlsDevInteractionAnswer;
|
|
65
|
+
}
|
|
66
|
+
export interface MlsDevInteractionWithdrawBody {
|
|
67
|
+
readonly requestId: string;
|
|
68
|
+
readonly reason: MlsDevInteractionWithdrawReason;
|
|
69
|
+
}
|
|
70
|
+
interface MlsDevApplicationPayloadIds {
|
|
71
|
+
readonly version: 1;
|
|
72
|
+
readonly conversationId: string;
|
|
73
|
+
readonly groupId: string;
|
|
74
|
+
readonly messageId: string;
|
|
75
|
+
readonly operationId: string;
|
|
76
|
+
readonly senderDeviceId: string;
|
|
77
|
+
}
|
|
78
|
+
export type MlsDevInteractionPayload = (MlsDevApplicationPayloadIds & {
|
|
79
|
+
readonly kind: 'interaction.request';
|
|
80
|
+
readonly interaction: MlsDevInteractionRequestBody;
|
|
81
|
+
}) | (MlsDevApplicationPayloadIds & {
|
|
82
|
+
readonly kind: 'interaction.response';
|
|
83
|
+
readonly interaction: MlsDevInteractionResponseBody;
|
|
84
|
+
}) | (MlsDevApplicationPayloadIds & {
|
|
85
|
+
readonly kind: 'interaction.withdraw';
|
|
86
|
+
readonly interaction: MlsDevInteractionWithdrawBody;
|
|
87
|
+
});
|
|
88
|
+
export type MlsDevApplicationPayload = MlsDevTextPayload | MlsDevItemPayload | MlsDevInteractionPayload;
|
|
89
|
+
export type MlsDevInteractionPayloadKind = MlsDevInteractionPayload['kind'];
|
|
90
|
+
export declare const MLS_DEV_INTERACTION_PAYLOAD_KINDS: readonly ["interaction.request", "interaction.response", "interaction.withdraw"];
|
|
91
|
+
/** The server's metadata-only record (§2.4): no title, options, decision, scope or answer. */
|
|
92
|
+
export interface MlsDevInteractionRecord {
|
|
93
|
+
readonly version: 1;
|
|
94
|
+
readonly conversationId: string;
|
|
95
|
+
readonly agentId: string;
|
|
96
|
+
readonly requesterDeviceId: string;
|
|
97
|
+
readonly requestId: string;
|
|
98
|
+
readonly kind: MlsDevInteractionKind;
|
|
99
|
+
readonly responderIds: readonly [string];
|
|
100
|
+
readonly expiresAtMs: number;
|
|
101
|
+
readonly status: 'pending' | 'answered' | 'withdrawn';
|
|
102
|
+
readonly binding: {
|
|
103
|
+
readonly groupId: string;
|
|
104
|
+
readonly head: MlsDevGroupHead;
|
|
105
|
+
readonly membershipRevision: number;
|
|
106
|
+
readonly requestMessageId: string;
|
|
107
|
+
readonly requestOrdinal: number;
|
|
108
|
+
};
|
|
109
|
+
readonly answer?: {
|
|
110
|
+
readonly responderId: string;
|
|
111
|
+
readonly responderDeviceId: string;
|
|
112
|
+
readonly messageId: string;
|
|
113
|
+
readonly ordinal: number;
|
|
114
|
+
readonly acceptedAtMs: number;
|
|
115
|
+
};
|
|
116
|
+
readonly withdrawal?: {
|
|
117
|
+
readonly messageId: string;
|
|
118
|
+
readonly ordinal: number;
|
|
119
|
+
readonly acceptedAtMs: number;
|
|
120
|
+
};
|
|
121
|
+
readonly createdAtMs: number;
|
|
122
|
+
}
|
|
123
|
+
export interface MlsDevInteractionsQuery {
|
|
124
|
+
readonly version: 1;
|
|
125
|
+
readonly conversationId?: string;
|
|
126
|
+
}
|
|
127
|
+
/** The caller's answerable pending requests, for badges and web's content-free waiting notice. */
|
|
128
|
+
export interface MlsDevInteractionsResult {
|
|
129
|
+
readonly version: 1;
|
|
130
|
+
readonly interactions: readonly {
|
|
131
|
+
readonly conversationId: string;
|
|
132
|
+
readonly agentId: string;
|
|
133
|
+
readonly requestId: string;
|
|
134
|
+
readonly kind: MlsDevInteractionKind;
|
|
135
|
+
readonly expiresAtMs: number;
|
|
136
|
+
}[];
|
|
137
|
+
}
|
|
138
|
+
export declare const MLS_DEV_INTERACTIONS_QUERY_MAX = 50;
|
|
139
|
+
export declare class MlsDevInteractionValidationError extends Error {
|
|
140
|
+
readonly code = "INVALID_MLS_DEV_INTERACTION";
|
|
141
|
+
constructor();
|
|
142
|
+
}
|
|
143
|
+
export declare function parseMlsDevInteractionRequestBody(value: unknown): MlsDevInteractionRequestBody;
|
|
144
|
+
export declare function parseMlsDevInteractionAnswer(value: unknown): MlsDevInteractionAnswer;
|
|
145
|
+
export declare function parseMlsDevInteractionResponseBody(value: unknown): MlsDevInteractionResponseBody;
|
|
146
|
+
export declare function parseMlsDevInteractionWithdrawBody(value: unknown): MlsDevInteractionWithdrawBody;
|
|
147
|
+
/** The closed v2 plaintext union. A v1 room accepts only `kind: 'text'` (`parseMlsDevTextPayload`). */
|
|
148
|
+
export declare function parseMlsDevApplicationPayload(value: unknown): MlsDevApplicationPayload;
|
|
149
|
+
/** Receipt-time check (`applyApplication`): the encrypted payload repeats exactly what its public binding announced. */
|
|
150
|
+
export declare function assertMlsDevInteractionPayloadBinding(payload: MlsDevApplicationPayload, binding: MlsDevInteractionBinding | undefined): void;
|
|
151
|
+
/**
|
|
152
|
+
* Whether an answer has the shape its request allows. A session-scoped decision needs a request that offered a session
|
|
153
|
+
* rule (`allowSession`; a destructive action never does, §3); the runner also counts one only from the agent's owner.
|
|
154
|
+
*/
|
|
155
|
+
export declare function isMlsDevInteractionAnswerAllowed(request: MlsDevInteractionRequestBody, answer: MlsDevInteractionAnswer): boolean;
|
|
156
|
+
export declare function parseMlsDevInteractionRecord(value: unknown): MlsDevInteractionRecord;
|
|
157
|
+
export declare function parseMlsDevInteractionsQuery(value: unknown): MlsDevInteractionsQuery;
|
|
158
|
+
export declare function parseMlsDevInteractionsResult(value: unknown): MlsDevInteractionsResult;
|
|
159
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const MLS_DEV_KEY_PACKAGE_COMMAND_MAX_BYTES = 16384;
|
|
2
|
+
export declare const MLS_DEV_KEY_PACKAGE_WIRE_MAX_BYTES = 16384;
|
|
3
|
+
export declare const MLS_DEV_KEY_PACKAGE_WRAPPED_STATE_MAX_BYTES: number;
|
|
4
|
+
export declare const MLS_DEV_KEY_PACKAGE_PREPARATION_MAX_BYTES: number;
|
|
5
|
+
/** Typed local preparation only; neither this command nor its output grants
|
|
6
|
+
* publication, room membership, or current device authority. */
|
|
7
|
+
export interface MlsDevKeyPackageCommand {
|
|
8
|
+
readonly version: 1;
|
|
9
|
+
readonly op: 'key_package';
|
|
10
|
+
readonly keyPackageId: string;
|
|
11
|
+
readonly credential: string;
|
|
12
|
+
}
|
|
13
|
+
export interface MlsDevKeyPackagePayload {
|
|
14
|
+
readonly version: 1;
|
|
15
|
+
readonly keyPackageId: string;
|
|
16
|
+
readonly deviceId: string;
|
|
17
|
+
readonly credentialId: string;
|
|
18
|
+
readonly credentialGeneration: number;
|
|
19
|
+
readonly ciphersuite: 1;
|
|
20
|
+
readonly signaturePublicKey: string;
|
|
21
|
+
/** Canonical base64url TLS MLSMessage carrying one KeyPackage. */
|
|
22
|
+
readonly keyPackage: string;
|
|
23
|
+
/** MLS RefHash, not a hash of the enclosing MLSMessage. */
|
|
24
|
+
readonly keyPackageRef: string;
|
|
25
|
+
/** The encoded MLS lifetime expressed as a half-open interval in milliseconds. */
|
|
26
|
+
readonly notBeforeMs: number;
|
|
27
|
+
readonly expiresAtMs: number;
|
|
28
|
+
}
|
|
29
|
+
export interface MlsDevKeyPackagePreparation {
|
|
30
|
+
readonly wrappedState: string;
|
|
31
|
+
readonly payload: MlsDevKeyPackagePayload;
|
|
32
|
+
}
|
|
33
|
+
export declare class MlsDevKeyPackageValidationError extends Error {
|
|
34
|
+
readonly code = "INVALID_MLS_DEV_KEY_PACKAGE";
|
|
35
|
+
constructor();
|
|
36
|
+
}
|
|
37
|
+
export declare function parseMlsDevKeyPackageId(value: unknown): string;
|
|
38
|
+
export declare function parseMlsDevKeyPackageCommand(value: unknown): MlsDevKeyPackageCommand;
|
|
39
|
+
export declare function parseMlsDevKeyPackagePayload(value: unknown): MlsDevKeyPackagePayload;
|
|
40
|
+
/** Structural validation. Only the native boundary can authenticate ciphertext
|
|
41
|
+
* or inspect the MLS leaf/signature; callers independently verify issuer trust. */
|
|
42
|
+
export declare function parseMlsDevKeyPackagePreparation(value: unknown): MlsDevKeyPackagePreparation;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare const MLS_DEV_KEY_PACKAGES_MAX_BYTES = 32768;
|
|
2
|
+
export declare const MLS_DEV_KEY_PACKAGE_TLS_MAX_BYTES = 16384;
|
|
3
|
+
export interface MlsDevKeyPackagePublishRequest {
|
|
4
|
+
readonly version: 1;
|
|
5
|
+
readonly requestId: string;
|
|
6
|
+
readonly keyPackage: string;
|
|
7
|
+
}
|
|
8
|
+
export interface MlsDevKeyPackagePublicationReceipt {
|
|
9
|
+
readonly version: 1;
|
|
10
|
+
readonly authorization: 'key_package_publication_only';
|
|
11
|
+
readonly requestId: string;
|
|
12
|
+
readonly keyPackageRef: string;
|
|
13
|
+
readonly deviceId: string;
|
|
14
|
+
readonly publishedAtMs: number;
|
|
15
|
+
readonly expiresAtMs: number;
|
|
16
|
+
}
|
|
17
|
+
export interface MlsDevKeyPackageClaimPreconditions {
|
|
18
|
+
readonly conversationId: string;
|
|
19
|
+
readonly membershipRevision: number;
|
|
20
|
+
readonly admissionId: string;
|
|
21
|
+
readonly targetAdmissionId: string;
|
|
22
|
+
}
|
|
23
|
+
export interface MlsDevKeyPackageClaimRequest {
|
|
24
|
+
readonly version: 1;
|
|
25
|
+
readonly requestId: string;
|
|
26
|
+
readonly claimantCredential: string;
|
|
27
|
+
readonly recipientDeviceId: string;
|
|
28
|
+
readonly preconditions: MlsDevKeyPackageClaimPreconditions;
|
|
29
|
+
}
|
|
30
|
+
/** A bounded, authenticated delivery receipt. It grants neither membership nor
|
|
31
|
+
* permission to accept the peer: the receiving MLS implementation must validate
|
|
32
|
+
* the package again when preparing Add. */
|
|
33
|
+
export interface MlsDevKeyPackageClaimReceipt {
|
|
34
|
+
readonly version: 1;
|
|
35
|
+
readonly authorization: 'key_package_claim_only';
|
|
36
|
+
readonly requestId: string;
|
|
37
|
+
readonly preconditions: MlsDevKeyPackageClaimPreconditions;
|
|
38
|
+
readonly claimantDeviceId: string;
|
|
39
|
+
readonly recipientDeviceId: string;
|
|
40
|
+
readonly keyPackageRef: string;
|
|
41
|
+
readonly keyPackage: string;
|
|
42
|
+
readonly claimedAtMs: number;
|
|
43
|
+
}
|
|
44
|
+
export declare class MlsDevKeyPackagesValidationError extends Error {
|
|
45
|
+
readonly code = "INVALID_MLS_DEV_KEY_PACKAGES";
|
|
46
|
+
constructor();
|
|
47
|
+
}
|
|
48
|
+
/** Structural encoding validation only; the server's OpenMLS validator parses
|
|
49
|
+
* and authenticates the actual TLS message before publication. */
|
|
50
|
+
export declare function parseMlsDevKeyPackageWire(value: unknown): string;
|
|
51
|
+
export declare function parseMlsDevKeyPackageClaimPreconditions(value: unknown): MlsDevKeyPackageClaimPreconditions;
|
|
52
|
+
export declare function parseMlsDevKeyPackagePublish(value: unknown): MlsDevKeyPackagePublishRequest;
|
|
53
|
+
export declare function parseMlsDevKeyPackagePublicationReceipt(value: unknown): MlsDevKeyPackagePublicationReceipt;
|
|
54
|
+
export declare function parseMlsDevKeyPackageClaim(value: unknown): MlsDevKeyPackageClaimRequest;
|
|
55
|
+
export declare function parseMlsDevKeyPackageClaimReceipt(value: unknown): MlsDevKeyPackageClaimReceipt;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Each environment's MLS identity: the values signed into its credentials, group controls and application AAD. A
|
|
3
|
+
* production device, credential or group can never verify as Dev (or the reverse) because these differ. Dev's values
|
|
4
|
+
* are today's literals, so Dev bytes are unchanged. A declared profile only defines the wire; whether an environment
|
|
5
|
+
* runs MLS is decided by its deployment (Functions gates, configuration, native builds), never here.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MLS_ENVIRONMENT_PROFILES: Readonly<{
|
|
8
|
+
readonly 'canon-dev-v1': Readonly<{
|
|
9
|
+
issuer: "canon-mls-dev-v1";
|
|
10
|
+
credentialType: "canon-mls-dev-credential+jws";
|
|
11
|
+
issuerKeyPath: "projects/canonmail-dev/locations/europe-west1/keyRings/canon-mls/cryptoKeys/device-issuer";
|
|
12
|
+
receiptKeyPath: "projects/canonmail-dev/locations/europe-west1/keyRings/canon-mls/cryptoKeys/feed-receipt";
|
|
13
|
+
}>;
|
|
14
|
+
readonly 'canon-prod-v1': Readonly<{
|
|
15
|
+
issuer: "canon-mls-prod-v1";
|
|
16
|
+
credentialType: "canon-mls-prod-credential+jws";
|
|
17
|
+
issuerKeyPath: "projects/canonmail-prod/locations/europe-west1/keyRings/canon-mls/cryptoKeys/device-issuer";
|
|
18
|
+
receiptKeyPath: "projects/canonmail-prod/locations/europe-west1/keyRings/canon-mls/cryptoKeys/feed-receipt";
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
export type MlsEnvironmentId = keyof typeof MLS_ENVIRONMENT_PROFILES;
|
|
22
|
+
export type MlsEnvironmentProfile = (typeof MLS_ENVIRONMENT_PROFILES)[MlsEnvironmentId];
|
|
23
|
+
export type MlsIssuerId = MlsEnvironmentProfile['issuer'];
|
|
24
|
+
/**
|
|
25
|
+
* Exact match only: no trimming or case folding, so an alias never reaches signed bytes. Throws the shared internal
|
|
26
|
+
* parser error, which each public boundary replaces with its own.
|
|
27
|
+
*/
|
|
28
|
+
export declare function requireMlsEnvironmentId(value: unknown): MlsEnvironmentId;
|
|
29
|
+
/** The same exact match as a predicate, for callers that refuse with their own error. */
|
|
30
|
+
export declare function isMlsEnvironmentId(value: unknown): value is MlsEnvironmentId;
|
|
31
|
+
export declare function mlsEnvironmentProfile(environmentId: MlsEnvironmentId): MlsEnvironmentProfile;
|
|
32
|
+
/** The environment whose issuer key a KMS key-version path names, or undefined for any other path. */
|
|
33
|
+
export declare function mlsEnvironmentOfIssuerKeyVersion(value: string): MlsEnvironmentId | undefined;
|
|
34
|
+
/** The environment whose feed-receipt key (mls-signed-acceptance.md) a KMS key-version path names, or undefined. */
|
|
35
|
+
export declare function mlsEnvironmentOfReceiptKeyVersion(value: string): MlsEnvironmentId | undefined;
|