@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,17 @@
|
|
|
1
|
+
export type TransferReceiptDecision = 'result' | 'pending' | 'uncertain' | 'rejected' | 'invalid';
|
|
2
|
+
export interface TransferReceiptIdentity {
|
|
3
|
+
protocol: string;
|
|
4
|
+
operationId: string;
|
|
5
|
+
installationId: string;
|
|
6
|
+
action: string;
|
|
7
|
+
}
|
|
8
|
+
/** A transport failure is local attention, never a remote delivery outcome. */
|
|
9
|
+
export declare function classifyTransferHttpFailure(status: number): 'retry' | 'attention';
|
|
10
|
+
/** A successful mutation with failed restricted-result hydration is still
|
|
11
|
+
* unresolved locally. Never translate an operation rejection into a delivery outcome. */
|
|
12
|
+
export declare function classifyTransferReceipt(value: unknown, expected: TransferReceiptIdentity): TransferReceiptDecision;
|
|
13
|
+
/** Shared native recovery policy. Random is injected so all implementations run
|
|
14
|
+
* the same fixture corpus; a longer server retry hint is never truncated. */
|
|
15
|
+
export declare function transferRetryDelay(attempt: number, random: number, retryAfterMs?: number): number;
|
|
16
|
+
/** Expiry bounds automatic work, not the ability to reconcile an unknown result. */
|
|
17
|
+
export declare function mayAttemptMediaTransfer(nowMs: number, createdAtMs: number, expiresAtMs?: number | null): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** A server-written membership transition stored in the ordinary chat history. */
|
|
2
|
+
export interface MembershipChangeMetadata extends Record<string, unknown> {
|
|
3
|
+
type: 'membership_change';
|
|
4
|
+
action: 'added' | 'removed' | 'left';
|
|
5
|
+
actorId: string | null;
|
|
6
|
+
actorName: string | null;
|
|
7
|
+
memberId: string | null;
|
|
8
|
+
memberName: string;
|
|
9
|
+
membershipRevision: number;
|
|
10
|
+
turnSemantics: 'control';
|
|
11
|
+
replyBehavior: 'suppress_auto_reply';
|
|
12
|
+
}
|
|
13
|
+
/** Recognize the reserved marker even when the remaining metadata is malformed. */
|
|
14
|
+
export declare function isMembershipChangeMessage(message: {
|
|
15
|
+
metadata?: unknown;
|
|
16
|
+
}): boolean;
|
|
17
|
+
/** Membership revisions own these document IDs; user messages cannot claim them. */
|
|
18
|
+
export declare function isMembershipChangeMessageId(messageId: unknown): boolean;
|
|
19
|
+
export declare function readMembershipChangeMetadata(metadata: unknown): MembershipChangeMetadata | null;
|
|
20
|
+
/** Uses stored names so the notice remains readable after a profile leaves the roster. */
|
|
21
|
+
export declare function formatMembershipChangeNotice(metadata: MembershipChangeMetadata, currentUserId?: string): string;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { MediaAttachment } from './media.js';
|
|
2
|
+
import { type MlsDevMessageReference } from './mlsDevApplication.js';
|
|
3
|
+
export type SerializedSenderType = 'human' | 'ai_agent';
|
|
4
|
+
/** Canonical agent client identifiers shared by Canon services and clients. */
|
|
5
|
+
export declare const AGENT_CLIENT_TYPES: readonly ["claude-code", "codex", "hermes", "generic"];
|
|
6
|
+
export type SerializedAgentClientType = typeof AGENT_CLIENT_TYPES[number];
|
|
7
|
+
export type SerializedContentType = 'text' | 'image' | 'audio' | 'video' | 'file' | 'contact_card' | 'interaction';
|
|
8
|
+
export interface ForwardedFrom {
|
|
9
|
+
sourceConversationId: string;
|
|
10
|
+
messageId: string;
|
|
11
|
+
}
|
|
12
|
+
export type SerializedReactions = Record<string, string[]>;
|
|
13
|
+
export interface SerializedContactCard {
|
|
14
|
+
userId: string;
|
|
15
|
+
canonContactId?: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
avatarUrl: string | null;
|
|
18
|
+
userType: SerializedSenderType;
|
|
19
|
+
clientType?: SerializedAgentClientType;
|
|
20
|
+
about?: string;
|
|
21
|
+
isActive?: boolean;
|
|
22
|
+
ownerId?: string;
|
|
23
|
+
ownerName?: string;
|
|
24
|
+
lifecycleState?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SerializedMessage {
|
|
27
|
+
/** Public encrypted-message hint; content is read only from the authenticated MLS feed. */
|
|
28
|
+
mls?: MlsDevMessageReference;
|
|
29
|
+
id: string;
|
|
30
|
+
senderId: string;
|
|
31
|
+
senderName?: string;
|
|
32
|
+
senderType: SerializedSenderType;
|
|
33
|
+
isOwner: boolean;
|
|
34
|
+
contentType: SerializedContentType;
|
|
35
|
+
text: string | null;
|
|
36
|
+
attachments: MediaAttachment[];
|
|
37
|
+
mentions: string[];
|
|
38
|
+
replyTo: string | null;
|
|
39
|
+
replyToPosition: number | null;
|
|
40
|
+
forwarded?: boolean;
|
|
41
|
+
forwardedFrom?: ForwardedFrom;
|
|
42
|
+
status: 'sent' | 'read';
|
|
43
|
+
createdAt: string;
|
|
44
|
+
metadata?: Record<string, unknown>;
|
|
45
|
+
contactCard?: SerializedContactCard;
|
|
46
|
+
/** Durable canon.card.v1 runtime card content, passed through opaquely. */
|
|
47
|
+
runtimeCard?: Record<string, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Plaintext, server-authorized interaction envelope for `contentType:
|
|
50
|
+
* 'interaction'` messages (card / input / approval / plan / contact). The
|
|
51
|
+
* authorization contract (`response`) and preview live here; the opaque
|
|
52
|
+
* request payload rides in `body`.
|
|
53
|
+
*/
|
|
54
|
+
interaction?: SerializedInteraction;
|
|
55
|
+
/** Opaque interaction payload (JSON string or ciphertext); never parsed here. */
|
|
56
|
+
body?: string;
|
|
57
|
+
reactions?: SerializedReactions;
|
|
58
|
+
}
|
|
59
|
+
export type SerializedInteractionKind = 'contact' | 'approval' | 'input' | 'plan' | 'card';
|
|
60
|
+
export interface SerializedInteraction {
|
|
61
|
+
kind: SerializedInteractionKind;
|
|
62
|
+
requestId: string;
|
|
63
|
+
interactive: boolean;
|
|
64
|
+
responseUserId?: string;
|
|
65
|
+
expiresAt?: string;
|
|
66
|
+
schemaVersion?: string;
|
|
67
|
+
preview?: {
|
|
68
|
+
title?: string;
|
|
69
|
+
blockKinds?: string[];
|
|
70
|
+
};
|
|
71
|
+
response?: {
|
|
72
|
+
actionIds?: string[];
|
|
73
|
+
actionFields?: Record<string, unknown>;
|
|
74
|
+
questions?: Array<{
|
|
75
|
+
id: string;
|
|
76
|
+
sensitive?: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface SerializeMessageInput {
|
|
81
|
+
id: string;
|
|
82
|
+
data: Record<string, unknown>;
|
|
83
|
+
senderName?: string;
|
|
84
|
+
isOwner: boolean;
|
|
85
|
+
}
|
|
86
|
+
export declare function serializeStoredMessage(input: SerializeMessageInput): SerializedMessage;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Maximum UTF-8 payload size for a human-authored message. */
|
|
2
|
+
export declare const HUMAN_MESSAGE_TEXT_MAX_BYTES: number;
|
|
3
|
+
/** Returns the encoded UTF-8 size used by the message API. */
|
|
4
|
+
export declare function messageTextUtf8ByteLength(value: string): number;
|
|
5
|
+
/** Whether human-authored message text fits the API's UTF-8 byte budget. */
|
|
6
|
+
export declare function isHumanMessageTextWithinLimit(value: string): boolean;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { type MlsDevGroupHead } from './mlsDevGroup.js';
|
|
2
|
+
import { type MlsEnvironmentId } from './mlsEnvironment.js';
|
|
3
|
+
export declare const MLS_DEV_TEXT_PROTOCOL: "canon.mls.dev-text.v1";
|
|
4
|
+
/** Text plus encrypted interactions (docs/design/encrypted-interactions.md §2.1). Fresh rooms only, immutable from birth. */
|
|
5
|
+
export declare const MLS_DEV_TEXT_PROTOCOL_V2: "canon.mls.dev-text.v2";
|
|
6
|
+
/** v2 plus a text's reply and mentions inside the ciphertext (docs/design/mls-payload-v3.md §2). What Canon births. */
|
|
7
|
+
export declare const MLS_DEV_TEXT_PROTOCOL_V3: "canon.mls.dev-text.v3";
|
|
8
|
+
export declare const MLS_DEV_TEXT_PROTOCOLS: readonly ["canon.mls.dev-text.v1", "canon.mls.dev-text.v2", "canon.mls.dev-text.v3"];
|
|
9
|
+
export type MlsDevTextProtocol = typeof MLS_DEV_TEXT_PROTOCOLS[number];
|
|
10
|
+
export declare function isMlsDevTextProtocol(value: unknown): value is MlsDevTextProtocol;
|
|
11
|
+
/** Whether a room carries encrypted cards: v2, and v3, which is v2 with richer text. */
|
|
12
|
+
export declare function mlsDevProtocolCarriesCards(value: unknown): boolean;
|
|
13
|
+
export declare const MLS_DEV_REPLY_QUOTE_MAX_CHARACTERS = 1024;
|
|
14
|
+
export declare const MLS_DEV_MENTIONS_MAX = 32;
|
|
15
|
+
/** Shared with Functions' runtime request ids (`RUNTIME_ID_PATTERN`): the runner's `ask-<sha256>` fits. */
|
|
16
|
+
export declare const MLS_DEV_INTERACTION_ID_PATTERN: RegExp;
|
|
17
|
+
export declare const MLS_DEV_INTERACTION_KINDS: readonly ["approval", "question", "secret"];
|
|
18
|
+
export type MlsDevInteractionKind = typeof MLS_DEV_INTERACTION_KINDS[number];
|
|
19
|
+
export declare const MLS_DEV_APPLICATION_TLS_MAX_BYTES: number;
|
|
20
|
+
export declare const MLS_DEV_APPLICATION_MAX_BYTES: number;
|
|
21
|
+
export declare const MLS_DEV_TEXT_MAX_BYTES: number;
|
|
22
|
+
export interface MlsDevApplicationPreconditions {
|
|
23
|
+
readonly membershipRevision: number;
|
|
24
|
+
readonly admissionId: string;
|
|
25
|
+
}
|
|
26
|
+
/** Public, device-signed and MLS-authenticated interaction routing (§2.2). Only a v2 room accepts it. The requester is
|
|
27
|
+
* the authenticated sender principal; titles, options, answers, decisions and scope stay in the encrypted payload. */
|
|
28
|
+
export type MlsDevInteractionBinding = {
|
|
29
|
+
readonly role: 'request';
|
|
30
|
+
readonly requestId: string;
|
|
31
|
+
readonly kind: MlsDevInteractionKind;
|
|
32
|
+
readonly responderIds: readonly [string];
|
|
33
|
+
readonly expiresAtMs: number;
|
|
34
|
+
} | {
|
|
35
|
+
readonly role: 'response';
|
|
36
|
+
readonly requestId: string;
|
|
37
|
+
readonly agentId: string;
|
|
38
|
+
} | {
|
|
39
|
+
readonly role: 'withdraw';
|
|
40
|
+
readonly requestId: string;
|
|
41
|
+
};
|
|
42
|
+
export interface MlsDevApplicationBinding {
|
|
43
|
+
readonly version: 1;
|
|
44
|
+
readonly environmentId: MlsEnvironmentId;
|
|
45
|
+
readonly conversationId: string;
|
|
46
|
+
readonly groupId: string;
|
|
47
|
+
readonly messageId: string;
|
|
48
|
+
readonly senderCredential: string;
|
|
49
|
+
readonly expectedHead: MlsDevGroupHead;
|
|
50
|
+
readonly preconditions: MlsDevApplicationPreconditions;
|
|
51
|
+
/** Absent for text. Framed after `preconditions` into the proof, envelope hash and MLS AAD. */
|
|
52
|
+
readonly interaction?: MlsDevInteractionBinding;
|
|
53
|
+
}
|
|
54
|
+
export interface MlsDevApplicationUnsignedEnvelope extends MlsDevApplicationBinding {
|
|
55
|
+
readonly ciphertext: string;
|
|
56
|
+
}
|
|
57
|
+
export interface MlsDevApplicationEnvelope extends MlsDevApplicationUnsignedEnvelope {
|
|
58
|
+
readonly proof: string;
|
|
59
|
+
}
|
|
60
|
+
export interface MlsDevApplicationReceipt {
|
|
61
|
+
readonly version: 1;
|
|
62
|
+
readonly authorization: 'encrypted_text_only';
|
|
63
|
+
readonly operationId: string;
|
|
64
|
+
readonly conversationId: string;
|
|
65
|
+
readonly groupId: string;
|
|
66
|
+
readonly messageId: string;
|
|
67
|
+
readonly feedOrdinal: number;
|
|
68
|
+
readonly head: MlsDevGroupHead;
|
|
69
|
+
readonly acceptedAtMs: number;
|
|
70
|
+
readonly envelopeHash: string;
|
|
71
|
+
}
|
|
72
|
+
export interface MlsDevTextPayload {
|
|
73
|
+
readonly version: 1;
|
|
74
|
+
readonly kind: 'text';
|
|
75
|
+
readonly conversationId: string;
|
|
76
|
+
readonly groupId: string;
|
|
77
|
+
readonly messageId: string;
|
|
78
|
+
readonly operationId: string;
|
|
79
|
+
readonly senderDeviceId: string;
|
|
80
|
+
readonly text: string;
|
|
81
|
+
/** v3 only: the message replied to, with an excerpt a device admitted after it can still show. */
|
|
82
|
+
readonly replyTo?: {
|
|
83
|
+
readonly messageId: string;
|
|
84
|
+
readonly quote: string;
|
|
85
|
+
};
|
|
86
|
+
/** v3 only: the accounts the text mentions, 1 to 32, each once. */
|
|
87
|
+
readonly mentions?: readonly string[];
|
|
88
|
+
}
|
|
89
|
+
/** The media kinds an encrypted item carries (payload v3 §2). Contact cards and artifacts are not items yet. */
|
|
90
|
+
export declare const MLS_DEV_ITEM_TYPES: readonly ["image", "video", "audio", "file"];
|
|
91
|
+
/**
|
|
92
|
+
* An item's reference inside the ciphertext. Its bytes stay in Canon's media pipeline and are not end-to-end
|
|
93
|
+
* encrypted; `url` is the upload's bearer download URL, which only the room's members receive this way. The file
|
|
94
|
+
* name and caption reach Canon only here, encrypted.
|
|
95
|
+
*/
|
|
96
|
+
export interface MlsDevItem {
|
|
97
|
+
readonly type: typeof MLS_DEV_ITEM_TYPES[number];
|
|
98
|
+
readonly uploadId: string;
|
|
99
|
+
readonly url: string;
|
|
100
|
+
readonly mimeType: string;
|
|
101
|
+
readonly sizeBytes: number;
|
|
102
|
+
readonly fileName?: string;
|
|
103
|
+
readonly width?: number;
|
|
104
|
+
readonly height?: number;
|
|
105
|
+
readonly durationMs?: number;
|
|
106
|
+
readonly thumbnailUrl?: string;
|
|
107
|
+
readonly caption?: string;
|
|
108
|
+
/** As a v3 text's: the message replied to, with its excerpt, and the accounts mentioned. They ride inside the item,
|
|
109
|
+
* which native carries opaquely. */
|
|
110
|
+
readonly replyTo?: MlsDevTextPayload['replyTo'];
|
|
111
|
+
readonly mentions?: readonly string[];
|
|
112
|
+
}
|
|
113
|
+
export interface MlsDevItemPayload {
|
|
114
|
+
readonly version: 1;
|
|
115
|
+
readonly kind: 'item';
|
|
116
|
+
readonly conversationId: string;
|
|
117
|
+
readonly groupId: string;
|
|
118
|
+
readonly messageId: string;
|
|
119
|
+
readonly operationId: string;
|
|
120
|
+
readonly senderDeviceId: string;
|
|
121
|
+
readonly item: MlsDevItem;
|
|
122
|
+
}
|
|
123
|
+
/** Public projection only. Plaintext is produced locally after authenticated MLS receive. */
|
|
124
|
+
export interface MlsDevMessageReference {
|
|
125
|
+
readonly version: 1;
|
|
126
|
+
readonly protocol: MlsDevTextProtocol;
|
|
127
|
+
readonly groupId: string;
|
|
128
|
+
readonly messageId: string;
|
|
129
|
+
readonly operationId: string;
|
|
130
|
+
readonly feedOrdinal: number;
|
|
131
|
+
readonly head: MlsDevGroupHead;
|
|
132
|
+
readonly envelopeHash: string;
|
|
133
|
+
/** The public binding's role only, so triggers can withhold previews, pushes and unread counts from answers. */
|
|
134
|
+
readonly interaction?: {
|
|
135
|
+
readonly role: MlsDevInteractionBinding['role'];
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export declare class MlsDevApplicationValidationError extends Error {
|
|
139
|
+
readonly code = "INVALID_MLS_DEV_APPLICATION";
|
|
140
|
+
constructor();
|
|
141
|
+
}
|
|
142
|
+
/** An encrypted message's ID: an endpoint ID that is not a membership notice's (`membership-<revision>`). */
|
|
143
|
+
export declare function isMlsDevMessageId(value: unknown): value is string;
|
|
144
|
+
/** Parses the closed public interaction binding (§2.2); the field order here is the framed order. */
|
|
145
|
+
export declare function parseMlsDevInteractionBinding(value: unknown): MlsDevInteractionBinding;
|
|
146
|
+
export declare function parseMlsDevApplicationWire(value: unknown): string;
|
|
147
|
+
export declare function parseMlsDevApplicationPreconditions(value: unknown): MlsDevApplicationPreconditions;
|
|
148
|
+
export declare function parseMlsDevApplicationBinding(value: unknown): MlsDevApplicationBinding;
|
|
149
|
+
export declare function parseMlsDevApplicationUnsignedEnvelope(value: unknown): MlsDevApplicationUnsignedEnvelope;
|
|
150
|
+
export declare function parseMlsDevApplicationEnvelope(value: unknown): MlsDevApplicationEnvelope;
|
|
151
|
+
export declare function parseMlsDevApplicationReceipt(value: unknown): MlsDevApplicationReceipt;
|
|
152
|
+
export declare function parseMlsDevTextPayload(value: unknown): MlsDevTextPayload;
|
|
153
|
+
/** An encrypted item (payload v3 §2): its reference and caption, as the ciphertext carries them. */
|
|
154
|
+
export declare function parseMlsDevItemPayload(value: unknown): MlsDevItemPayload;
|
|
155
|
+
export declare function parseMlsDevMessageReference(value: unknown): MlsDevMessageReference;
|
|
156
|
+
/** `domain`, then the operation ID and the JSON value, each behind its 4-byte big-endian length: the bytes Canon's MLS
|
|
157
|
+
* proofs sign. */
|
|
158
|
+
export declare function frameMlsDevStatement(domain: string, value: unknown, operationId: string): Uint8Array;
|
|
159
|
+
export declare function encodeMlsDevApplicationProof(value: unknown, operationId: string): Uint8Array;
|
|
160
|
+
export declare function encodeMlsDevApplicationEnvelopeHash(value: unknown, operationId: string): Uint8Array;
|
|
161
|
+
export declare function encodeMlsDevApplicationAad(value: unknown, operationId: string): Uint8Array;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type MlsDevEnrollmentDevice } from './mlsDevEnrollment.js';
|
|
2
|
+
import { type MlsEnvironmentId, type MlsIssuerId } from './mlsEnvironment.js';
|
|
3
|
+
export declare const MLS_DEV_CREDENTIAL_TTL_MS = 86400000;
|
|
4
|
+
export declare const MLS_DEV_CREDENTIAL_CHALLENGE_TTL_MS = 300000;
|
|
5
|
+
export declare const MLS_DEV_CREDENTIAL_MAX_BYTES = 8192;
|
|
6
|
+
export interface MlsDevCredentialClaims {
|
|
7
|
+
readonly version: 1;
|
|
8
|
+
readonly credentialId: string;
|
|
9
|
+
/** The device's environment's issuer (`MLS_ENVIRONMENT_PROFILES`). */
|
|
10
|
+
readonly issuer: MlsIssuerId;
|
|
11
|
+
readonly device: MlsDevEnrollmentDevice;
|
|
12
|
+
readonly generation: number;
|
|
13
|
+
readonly issuedAtMs: number;
|
|
14
|
+
readonly expiresAtMs: number;
|
|
15
|
+
}
|
|
16
|
+
export interface MlsDevCredentialUnsigned {
|
|
17
|
+
readonly keyVersion: string;
|
|
18
|
+
readonly claims: MlsDevCredentialClaims;
|
|
19
|
+
}
|
|
20
|
+
export interface MlsDevCredentialChallenge {
|
|
21
|
+
readonly version: 1;
|
|
22
|
+
readonly challengeId: string;
|
|
23
|
+
readonly nonce: string;
|
|
24
|
+
readonly issuedAtMs: number;
|
|
25
|
+
readonly expiresAtMs: number;
|
|
26
|
+
readonly credential: MlsDevCredentialUnsigned;
|
|
27
|
+
}
|
|
28
|
+
export interface MlsDevCredentialBeginRequest {
|
|
29
|
+
readonly version: 1;
|
|
30
|
+
readonly deviceId: string;
|
|
31
|
+
readonly expectedCredentialGeneration: number;
|
|
32
|
+
}
|
|
33
|
+
export interface MlsDevCredentialCompleteRequest {
|
|
34
|
+
readonly version: 1;
|
|
35
|
+
readonly challengeId: string;
|
|
36
|
+
readonly proof: string;
|
|
37
|
+
}
|
|
38
|
+
export interface MlsDevCredentialReceipt {
|
|
39
|
+
readonly version: 1;
|
|
40
|
+
readonly authorization: 'device_credential_only';
|
|
41
|
+
readonly credential: string;
|
|
42
|
+
}
|
|
43
|
+
export interface MlsDevCredentialRevokeRequest {
|
|
44
|
+
readonly version: 1;
|
|
45
|
+
readonly deviceId: string;
|
|
46
|
+
}
|
|
47
|
+
export interface MlsDevCredentialRevocationReceipt {
|
|
48
|
+
readonly version: 1;
|
|
49
|
+
readonly authorization: 'device_revocation_only';
|
|
50
|
+
readonly deviceId: string;
|
|
51
|
+
readonly revokedAtMs: number;
|
|
52
|
+
}
|
|
53
|
+
export declare class MlsDevCredentialValidationError extends Error {
|
|
54
|
+
readonly code = "INVALID_MLS_DEV_CREDENTIAL";
|
|
55
|
+
constructor();
|
|
56
|
+
}
|
|
57
|
+
/** A version of an environment's issuer key: of `environmentId`'s when given, else of any declared environment's. */
|
|
58
|
+
export declare function parseMlsDevIssuerKeyVersion(value: unknown, environmentId?: MlsEnvironmentId): string;
|
|
59
|
+
export declare function parseMlsDevCredentialClaims(value: unknown): MlsDevCredentialClaims;
|
|
60
|
+
export declare function parseMlsDevCredentialUnsigned(value: unknown): MlsDevCredentialUnsigned;
|
|
61
|
+
export declare function parseMlsDevCredentialChallenge(value: unknown): MlsDevCredentialChallenge;
|
|
62
|
+
export declare function parseMlsDevCredentialBegin(value: unknown): MlsDevCredentialBeginRequest;
|
|
63
|
+
export declare function parseMlsDevCredentialComplete(value: unknown): MlsDevCredentialCompleteRequest;
|
|
64
|
+
export declare function parseMlsDevCredentialRevoke(value: unknown): MlsDevCredentialRevokeRequest;
|
|
65
|
+
export declare function parseMlsDevCredentialRevocationReceipt(value: unknown): MlsDevCredentialRevocationReceipt;
|
|
66
|
+
export declare function createMlsDevCredentialSigningInput(value: MlsDevCredentialUnsigned): string;
|
|
67
|
+
export declare function parseMlsDevCredentialSigningInput(value: unknown): MlsDevCredentialUnsigned;
|
|
68
|
+
export declare function encodeMlsDevCredentialToken(unsigned: MlsDevCredentialUnsigned, signature: string): string;
|
|
69
|
+
/** Structure only. Does not verify the signature, clock, revocation or authority. */
|
|
70
|
+
export declare function parseMlsDevCredentialToken(value: unknown): Readonly<{
|
|
71
|
+
unsigned: MlsDevCredentialUnsigned;
|
|
72
|
+
signature: string;
|
|
73
|
+
signingInput: string;
|
|
74
|
+
}>;
|
|
75
|
+
/** Receipt parsing validates credential structure only, never its authority. */
|
|
76
|
+
export declare function parseMlsDevCredentialReceipt(value: unknown): MlsDevCredentialReceipt;
|
|
77
|
+
/** Device Ed25519 signs these domain-separated bytes directly, without prehash. */
|
|
78
|
+
export declare function encodeMlsDevCredentialProof(value: MlsDevCredentialChallenge): Uint8Array;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type MlsDevEnrollmentDevice } from './mlsDevEnrollment.js';
|
|
2
|
+
/** Observations synchronize an intact device journal; they grant no authority. */
|
|
3
|
+
export declare const MLS_DEV_CREDENTIAL_RECONCILIATION_CHALLENGE_TTL_MS = 300000;
|
|
4
|
+
export declare const MLS_DEV_CREDENTIAL_RECONCILIATION_MAX_BYTES = 8192;
|
|
5
|
+
export interface MlsDevCredentialReconciliationBeginRequest {
|
|
6
|
+
readonly version: 1;
|
|
7
|
+
readonly deviceId: string;
|
|
8
|
+
readonly requestId: string;
|
|
9
|
+
readonly expectedCredentialGeneration: number;
|
|
10
|
+
}
|
|
11
|
+
export interface MlsDevCredentialReconciliationChallenge {
|
|
12
|
+
readonly version: 1;
|
|
13
|
+
readonly challengeId: string;
|
|
14
|
+
readonly requestId: string;
|
|
15
|
+
readonly nonce: string;
|
|
16
|
+
readonly device: MlsDevEnrollmentDevice;
|
|
17
|
+
readonly expectedCredentialGeneration: number;
|
|
18
|
+
readonly issuedAtMs: number;
|
|
19
|
+
readonly expiresAtMs: number;
|
|
20
|
+
}
|
|
21
|
+
export interface MlsDevCredentialReconciliationCompleteRequest {
|
|
22
|
+
readonly version: 1;
|
|
23
|
+
readonly challengeId: string;
|
|
24
|
+
readonly proof: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MlsDevCredentialReconciliationReceipt {
|
|
27
|
+
readonly version: 1;
|
|
28
|
+
readonly authorization: 'credential_generation_observation_only';
|
|
29
|
+
readonly challenge: MlsDevCredentialReconciliationChallenge;
|
|
30
|
+
readonly observedCredentialGeneration: number;
|
|
31
|
+
readonly observedAtMs: number;
|
|
32
|
+
}
|
|
33
|
+
export declare class MlsDevCredentialReconciliationValidationError extends Error {
|
|
34
|
+
readonly code = "INVALID_MLS_DEV_CREDENTIAL_RECONCILIATION";
|
|
35
|
+
constructor();
|
|
36
|
+
}
|
|
37
|
+
export declare function parseMlsDevCredentialReconciliationBegin(value: unknown): MlsDevCredentialReconciliationBeginRequest;
|
|
38
|
+
export declare function parseMlsDevCredentialReconciliationChallenge(value: unknown): MlsDevCredentialReconciliationChallenge;
|
|
39
|
+
export declare function parseMlsDevCredentialReconciliationComplete(value: unknown): MlsDevCredentialReconciliationCompleteRequest;
|
|
40
|
+
/** Structure only. The caller must authenticate the server response separately.
|
|
41
|
+
* Neither this receipt nor its generation establishes credential/current status. */
|
|
42
|
+
export declare function parseMlsDevCredentialReconciliationReceipt(value: unknown): MlsDevCredentialReconciliationReceipt;
|
|
43
|
+
/** Fixed Ed25519, no prehash: domain || u32be(JSON byte length) || closed JSON.
|
|
44
|
+
* Signers reconstruct the canonical challenge; no caller-supplied bytes enter. */
|
|
45
|
+
export declare function encodeMlsDevCredentialReconciliationProof(value: MlsDevCredentialReconciliationChallenge): Uint8Array;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type MlsDevEnrollmentChallenge, type MlsDevEnrollmentPrincipal, type MlsDevEnrollmentResult } from './mlsDevEnrollment.js';
|
|
2
|
+
import { type MlsDevCredentialChallenge } from './mlsDevCredential.js';
|
|
3
|
+
import { type MlsDevCredentialReconciliationChallenge } from './mlsDevCredentialReconciliation.js';
|
|
4
|
+
import { type MlsEnvironmentId } from './mlsEnvironment.js';
|
|
5
|
+
/** Synthetic Dev native bridge contracts; never an issuer or membership grant. */
|
|
6
|
+
export declare const MLS_DEV_DEVICE_CONTEXT_MAX_BYTES = 2048;
|
|
7
|
+
export declare const MLS_DEV_DEVICE_COMMAND_MAX_BYTES = 16384;
|
|
8
|
+
export declare const MLS_DEV_DEVICE_WRAPPED_STATE_MAX_BYTES = 6144;
|
|
9
|
+
export interface MlsDevDeviceBinding {
|
|
10
|
+
readonly version: 1;
|
|
11
|
+
readonly environmentId: MlsEnvironmentId;
|
|
12
|
+
readonly principal: MlsDevEnrollmentPrincipal;
|
|
13
|
+
readonly installationId: string;
|
|
14
|
+
}
|
|
15
|
+
export interface MlsDevDeviceContext extends MlsDevDeviceBinding {
|
|
16
|
+
/** Current committed revision. The native result is wrapped at revision + 1. */
|
|
17
|
+
readonly revision: number;
|
|
18
|
+
}
|
|
19
|
+
export type MlsDevDeviceCommand = {
|
|
20
|
+
readonly op: 'create';
|
|
21
|
+
} | {
|
|
22
|
+
readonly op: 'enrollment_proof';
|
|
23
|
+
readonly challenge: MlsDevEnrollmentChallenge;
|
|
24
|
+
} | {
|
|
25
|
+
readonly op: 'credential_proof';
|
|
26
|
+
readonly challenge: MlsDevCredentialChallenge;
|
|
27
|
+
readonly registrationResult: MlsDevEnrollmentResult;
|
|
28
|
+
readonly expectedCredentialGeneration: number;
|
|
29
|
+
} | {
|
|
30
|
+
readonly op: 'credential_reconciliation_proof';
|
|
31
|
+
readonly challenge: MlsDevCredentialReconciliationChallenge;
|
|
32
|
+
readonly expectedCredentialGeneration: number;
|
|
33
|
+
};
|
|
34
|
+
export interface MlsDevDevicePayload {
|
|
35
|
+
readonly signaturePublicKey: string;
|
|
36
|
+
/** Present only for proof commands; no raw key or private state crosses JS. */
|
|
37
|
+
readonly proof?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface MlsDevDevicePreparation {
|
|
40
|
+
readonly wrappedState: string;
|
|
41
|
+
readonly payload: MlsDevDevicePayload;
|
|
42
|
+
}
|
|
43
|
+
export declare class MlsDevDeviceCustodyValidationError extends Error {
|
|
44
|
+
readonly code = "INVALID_MLS_DEV_DEVICE_CUSTODY";
|
|
45
|
+
constructor();
|
|
46
|
+
}
|
|
47
|
+
export declare function parseMlsDevDeviceBinding(value: unknown): MlsDevDeviceBinding;
|
|
48
|
+
export declare function parseMlsDevDeviceContext(value: unknown): MlsDevDeviceContext;
|
|
49
|
+
/** The host supplies time and private state; neither is accepted from JavaScript. */
|
|
50
|
+
export declare function parseMlsDevDeviceCommand(value: unknown): MlsDevDeviceCommand;
|
|
51
|
+
/** Structural validation only: the native host authenticates wrapped state. */
|
|
52
|
+
export declare function parseMlsDevDevicePreparation(value: unknown, op: MlsDevDeviceCommand['op']): MlsDevDevicePreparation;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type MlsEnvironmentId } from './mlsEnvironment.js';
|
|
2
|
+
/** Dev device-key registration only. These records are not MLS issuer credentials. */
|
|
3
|
+
export declare const MLS_DEV_ENROLLMENT_CHALLENGE_TTL_MS = 300000;
|
|
4
|
+
export declare const MLS_DEV_ENROLLMENT_MAX_BYTES = 4096;
|
|
5
|
+
export type MlsDevEnrollmentPrincipal = {
|
|
6
|
+
readonly type: 'human';
|
|
7
|
+
readonly id: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly type: 'ai_agent';
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly ownershipVersion: number;
|
|
12
|
+
};
|
|
13
|
+
export interface MlsDevEnrollmentBeginRequest {
|
|
14
|
+
readonly version: 1;
|
|
15
|
+
readonly installationId: string;
|
|
16
|
+
readonly signaturePublicKey: string;
|
|
17
|
+
}
|
|
18
|
+
export interface MlsDevEnrollmentCompleteRequest {
|
|
19
|
+
readonly version: 1;
|
|
20
|
+
readonly challengeId: string;
|
|
21
|
+
readonly proof: string;
|
|
22
|
+
}
|
|
23
|
+
export interface MlsDevEnrollmentChallenge {
|
|
24
|
+
readonly version: 1;
|
|
25
|
+
readonly challengeId: string;
|
|
26
|
+
readonly deviceId: string;
|
|
27
|
+
readonly environmentId: MlsEnvironmentId;
|
|
28
|
+
readonly principal: MlsDevEnrollmentPrincipal;
|
|
29
|
+
readonly installationId: string;
|
|
30
|
+
readonly ciphersuite: 1;
|
|
31
|
+
readonly signatureScheme: 'ed25519';
|
|
32
|
+
readonly signaturePublicKey: string;
|
|
33
|
+
readonly nonce: string;
|
|
34
|
+
readonly issuedAtMs: number;
|
|
35
|
+
readonly expiresAtMs: number;
|
|
36
|
+
}
|
|
37
|
+
export interface MlsDevEnrollmentDevice {
|
|
38
|
+
readonly version: 1;
|
|
39
|
+
readonly deviceId: string;
|
|
40
|
+
readonly environmentId: MlsEnvironmentId;
|
|
41
|
+
readonly principal: MlsDevEnrollmentPrincipal;
|
|
42
|
+
readonly installationId: string;
|
|
43
|
+
readonly ciphersuite: 1;
|
|
44
|
+
readonly signatureScheme: 'ed25519';
|
|
45
|
+
readonly signaturePublicKey: string;
|
|
46
|
+
readonly registeredAtMs: number;
|
|
47
|
+
}
|
|
48
|
+
export interface MlsDevEnrollmentResult {
|
|
49
|
+
readonly version: 1;
|
|
50
|
+
readonly authorization: 'registration_only';
|
|
51
|
+
readonly device: MlsDevEnrollmentDevice;
|
|
52
|
+
}
|
|
53
|
+
export declare class MlsDevEnrollmentValidationError extends Error {
|
|
54
|
+
readonly code = "INVALID_MLS_DEV_ENROLLMENT";
|
|
55
|
+
constructor();
|
|
56
|
+
}
|
|
57
|
+
/** Shared exact identity parsing for the separate protected Dev signing boundary. */
|
|
58
|
+
export declare function parseMlsDevEnrollmentPrincipal(value: unknown): MlsDevEnrollmentPrincipal;
|
|
59
|
+
export declare function parseMlsDevInstallationId(value: unknown): string;
|
|
60
|
+
export declare function parseMlsDevEnrollmentBegin(value: unknown): MlsDevEnrollmentBeginRequest;
|
|
61
|
+
export declare function parseMlsDevEnrollmentComplete(value: unknown): MlsDevEnrollmentCompleteRequest;
|
|
62
|
+
export declare function parseMlsDevEnrollmentChallenge(value: unknown): MlsDevEnrollmentChallenge;
|
|
63
|
+
export declare function parseMlsDevEnrollmentResult(value: unknown): MlsDevEnrollmentResult;
|
|
64
|
+
/** Canonical unpadded base64url; uses no Node-only or browser-only APIs. */
|
|
65
|
+
export declare function encodeCanonicalMlsBase64Url(bytes: Uint8Array): string;
|
|
66
|
+
export declare function decodeCanonicalMlsBase64Url(value: unknown, expectedBytes: number): Uint8Array;
|
|
67
|
+
/**
|
|
68
|
+
* Ed25519 signs these bytes directly (no extra prehash). Version 1 uses the
|
|
69
|
+
* domain below, u16 version, LP environment, u8 principal tag (human 0/agent 1),
|
|
70
|
+
* LP principal id, agent-only u64 ownership version, LP installation id, raw
|
|
71
|
+
* UUID device/challenge ids, u16 suite, raw key/nonce, u64 issued/expiry times.
|
|
72
|
+
* LP is u32 byte length followed by UTF-8; all integers are big endian.
|
|
73
|
+
* The signature scheme is fixed by the validated version/suite, not negotiated.
|
|
74
|
+
*/
|
|
75
|
+
export declare function encodeMlsDevEnrollmentProof(value: MlsDevEnrollmentChallenge): Uint8Array;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { MlsDevGroupFeedEntry } from './mlsDevGroupFeed.js';
|
|
2
|
+
import { type MlsEnvironmentId } from './mlsEnvironment.js';
|
|
3
|
+
/**
|
|
4
|
+
* Signed acceptance times (docs/design/mls-signed-acceptance.md): when Canon accepts an MLS feed entry it signs the
|
|
5
|
+
* time, with the environment's feed-receipt key, so a device judges the entry's sender at that time instead of by its
|
|
6
|
+
* own clock. The proof travels beside the entry; the receipt and the accepted control themselves are unchanged.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MLS_DEV_FEED_RECEIPT_DOMAIN = "canon.mls.feed-receipt.v1\0";
|
|
9
|
+
/** What Canon signs for one accepted entry, in this field order. `entryHash` binds the exact accepted bytes: an
|
|
10
|
+
* application's `envelopeHash`, or an accepted control's `head.hash`. */
|
|
11
|
+
export interface MlsDevFeedReceiptStatement {
|
|
12
|
+
readonly environmentId: MlsEnvironmentId;
|
|
13
|
+
readonly conversationId: string;
|
|
14
|
+
readonly groupId: string;
|
|
15
|
+
readonly feedOrdinal: number;
|
|
16
|
+
readonly kind: 'application' | 'control';
|
|
17
|
+
readonly entryHash: string;
|
|
18
|
+
readonly acceptedAtMs: number;
|
|
19
|
+
}
|
|
20
|
+
export interface MlsDevFeedReceiptProof {
|
|
21
|
+
/** A version of the environment's feed-receipt key. */
|
|
22
|
+
readonly keyVersion: string;
|
|
23
|
+
/** Ed25519 over `encodeMlsDevFeedReceipt`, canonical base64url. */
|
|
24
|
+
readonly signature: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class MlsDevFeedReceiptValidationError extends Error {
|
|
27
|
+
readonly code = "INVALID_MLS_DEV_FEED_RECEIPT";
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
|
30
|
+
export declare function parseMlsDevReceiptKeyVersion(value: unknown, environmentId?: MlsEnvironmentId): string;
|
|
31
|
+
export declare function parseMlsDevFeedReceiptProof(value: unknown): MlsDevFeedReceiptProof;
|
|
32
|
+
/** The statement for an accepted feed entry, in the environment that accepted it. */
|
|
33
|
+
export declare function mlsDevFeedReceiptStatement(entry: MlsDevGroupFeedEntry, environmentId: MlsEnvironmentId): {
|
|
34
|
+
statement: MlsDevFeedReceiptStatement;
|
|
35
|
+
operationId: string;
|
|
36
|
+
};
|
|
37
|
+
/** The exact bytes the feed-receipt key signs: the statement framed under its domain and the entry's operation. */
|
|
38
|
+
export declare function encodeMlsDevFeedReceipt(statement: MlsDevFeedReceiptStatement, operationId: string): Uint8Array;
|
|
39
|
+
/** Native refuses, for now, an entry Canon accepted more than 10 minutes ahead of this device's clock: a retryable
|
|
40
|
+
* pause, never a room failure (mls-signed-acceptance.md §2.9). */
|
|
41
|
+
export declare const MLS_DEV_GROUP_RECEIPT_CLOCK_SKEW = "MLS_DEV_GROUP_RECEIPT_CLOCK_SKEW";
|
|
42
|
+
/** Whether a native or custody response is exactly that pause (the portable helper adds `version: 1`). */
|
|
43
|
+
export declare function isMlsDevReceiptClockSkew(value: unknown): boolean;
|