@941design/marmot 0.0.0-stage → 0.2.0-alpha.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/CHANGELOG.md +709 -0
- package/LICENSE +21 -0
- package/README.md +33 -2
- package/dist/account/admin.d.ts +72 -0
- package/dist/account/admin.js +209 -0
- package/dist/account/device-deps.d.ts +379 -0
- package/dist/account/device-deps.js +36 -0
- package/dist/account/device-lineage.d.ts +199 -0
- package/dist/account/device-lineage.js +390 -0
- package/dist/account/device-registry.d.ts +93 -0
- package/dist/account/device-registry.js +1290 -0
- package/dist/account/device-rotation.d.ts +61 -0
- package/dist/account/device-rotation.js +827 -0
- package/dist/account/enrolment.d.ts +339 -0
- package/dist/account/enrolment.js +1247 -0
- package/dist/account/identity-proof.d.ts +79 -0
- package/dist/account/identity-proof.js +264 -0
- package/dist/account/index.d.ts +17 -0
- package/dist/account/index.js +16 -0
- package/dist/account/restore-rotation.d.ts +21 -0
- package/dist/account/restore-rotation.js +22 -0
- package/dist/account/same-account-authorization.d.ts +86 -0
- package/dist/account/same-account-authorization.js +180 -0
- package/dist/account/teardown.d.ts +127 -0
- package/dist/account/teardown.js +856 -0
- package/dist/client/before-create-group.d.ts +18 -0
- package/dist/client/before-create-group.js +65 -0
- package/dist/client/before-publish-hooks.d.ts +121 -0
- package/dist/client/before-publish-hooks.js +180 -0
- package/dist/client/client-config.d.ts +42 -0
- package/dist/client/client-config.js +13 -0
- package/dist/client/commit-redrive.d.ts +68 -0
- package/dist/client/commit-redrive.js +221 -0
- package/dist/client/component-update.d.ts +43 -0
- package/dist/client/component-update.js +53 -0
- package/dist/client/confirm-hooks.d.ts +50 -0
- package/dist/client/confirm-hooks.js +59 -0
- package/dist/client/create-client.d.ts +1022 -0
- package/dist/client/create-client.js +1125 -0
- package/dist/client/group-disband.d.ts +28 -0
- package/dist/client/group-disband.js +64 -0
- package/dist/client/group-history.d.ts +435 -0
- package/dist/client/group-history.js +1295 -0
- package/dist/client/group-profile.d.ts +31 -0
- package/dist/client/group-profile.js +62 -0
- package/dist/client/group-records.d.ts +485 -0
- package/dist/client/group-records.js +1034 -0
- package/dist/client/group-removal.d.ts +36 -0
- package/dist/client/group-removal.js +127 -0
- package/dist/client/group-remove-member.d.ts +49 -0
- package/dist/client/group-remove-member.js +163 -0
- package/dist/client/group-runtime.d.ts +388 -0
- package/dist/client/group-runtime.js +2701 -0
- package/dist/client/group-snapshot.d.ts +98 -0
- package/dist/client/group-snapshot.js +453 -0
- package/dist/client/history-pages.d.ts +107 -0
- package/dist/client/history-pages.js +194 -0
- package/dist/client/inbox-send.d.ts +19 -0
- package/dist/client/inbox-send.js +71 -0
- package/dist/client/index.d.ts +21 -0
- package/dist/client/index.js +13 -0
- package/dist/client/ingest.d.ts +82 -0
- package/dist/client/ingest.js +1550 -0
- package/dist/client/lifecycle-events.d.ts +63 -0
- package/dist/client/lifecycle-events.js +35 -0
- package/dist/client/opaque-candidates.d.ts +81 -0
- package/dist/client/opaque-candidates.js +169 -0
- package/dist/client/own-change-outbox.d.ts +66 -0
- package/dist/client/own-change-outbox.js +156 -0
- package/dist/client/pending-leaf.d.ts +116 -0
- package/dist/client/pending-leaf.js +378 -0
- package/dist/client/permissions.d.ts +9 -0
- package/dist/client/permissions.js +12 -0
- package/dist/client/pipeline.d.ts +554 -0
- package/dist/client/pipeline.js +3545 -0
- package/dist/client/reentrancy-guard.d.ts +96 -0
- package/dist/client/reentrancy-guard.js +153 -0
- package/dist/client/rekey.d.ts +58 -0
- package/dist/client/rekey.js +149 -0
- package/dist/client/transport-policy.d.ts +181 -0
- package/dist/client/transport-policy.js +214 -0
- package/dist/history/equivocation.d.ts +55 -0
- package/dist/history/equivocation.js +113 -0
- package/dist/history/fencing.d.ts +25 -0
- package/dist/history/fencing.js +61 -0
- package/dist/history/hex.d.ts +3 -0
- package/dist/history/hex.js +10 -0
- package/dist/history/index.d.ts +73 -0
- package/dist/history/index.js +31 -0
- package/dist/history/notifications.d.ts +270 -0
- package/dist/history/notifications.js +264 -0
- package/dist/history/ordering-key.d.ts +24 -0
- package/dist/history/ordering-key.js +101 -0
- package/dist/history/own-change-fork.d.ts +112 -0
- package/dist/history/own-change-fork.js +196 -0
- package/dist/history/own-change.d.ts +106 -0
- package/dist/history/own-change.js +146 -0
- package/dist/history/policy.d.ts +48 -0
- package/dist/history/policy.js +52 -0
- package/dist/history/retained-window.d.ts +215 -0
- package/dist/history/retained-window.js +565 -0
- package/dist/inbox/demux.d.ts +90 -0
- package/dist/inbox/demux.js +78 -0
- package/dist/inbox/handler-registry.d.ts +42 -0
- package/dist/inbox/handler-registry.js +37 -0
- package/dist/inbox/index.d.ts +11 -0
- package/dist/inbox/index.js +10 -0
- package/dist/inbox/seen-set.d.ts +82 -0
- package/dist/inbox/seen-set.js +202 -0
- package/dist/inbox/subscription.d.ts +236 -0
- package/dist/inbox/subscription.js +644 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +9 -0
- package/dist/invitations/competing-welcome.d.ts +223 -0
- package/dist/invitations/competing-welcome.js +128 -0
- package/dist/invitations/decline.d.ts +61 -0
- package/dist/invitations/decline.js +143 -0
- package/dist/invitations/expect-welcome.d.ts +66 -0
- package/dist/invitations/expect-welcome.js +138 -0
- package/dist/invitations/index.d.ts +16 -0
- package/dist/invitations/index.js +16 -0
- package/dist/invitations/invite.d.ts +303 -0
- package/dist/invitations/invite.js +966 -0
- package/dist/invitations/offers.d.ts +79 -0
- package/dist/invitations/offers.js +115 -0
- package/dist/invitations/on-proposal.d.ts +47 -0
- package/dist/invitations/on-proposal.js +40 -0
- package/dist/invitations/pending-proposal-policy.d.ts +52 -0
- package/dist/invitations/pending-proposal-policy.js +139 -0
- package/dist/invitations/proposal-deadline.d.ts +133 -0
- package/dist/invitations/proposal-deadline.js +164 -0
- package/dist/invitations/relay-planes.d.ts +43 -0
- package/dist/invitations/relay-planes.js +70 -0
- package/dist/invitations/welcome-processor.d.ts +253 -0
- package/dist/invitations/welcome-processor.js +1180 -0
- package/dist/key-packages/device-key.d.ts +131 -0
- package/dist/key-packages/device-key.js +272 -0
- package/dist/key-packages/device-rotation-records.d.ts +83 -0
- package/dist/key-packages/device-rotation-records.js +173 -0
- package/dist/key-packages/group-refs.d.ts +40 -0
- package/dist/key-packages/group-refs.js +79 -0
- package/dist/key-packages/index.d.ts +18 -0
- package/dist/key-packages/index.js +18 -0
- package/dist/key-packages/key-package-ref.d.ts +16 -0
- package/dist/key-packages/key-package-ref.js +21 -0
- package/dist/key-packages/observation-stream.d.ts +4 -0
- package/dist/key-packages/observation-stream.js +120 -0
- package/dist/key-packages/offer-rumor.d.ts +26 -0
- package/dist/key-packages/offer-rumor.js +69 -0
- package/dist/key-packages/publisher.d.ts +174 -0
- package/dist/key-packages/publisher.js +1247 -0
- package/dist/key-packages/select-key-package.d.ts +24 -0
- package/dist/key-packages/select-key-package.js +90 -0
- package/dist/key-packages/slot-manager.d.ts +167 -0
- package/dist/key-packages/slot-manager.js +327 -0
- package/dist/key-packages/validate-key-package-event.d.ts +3 -0
- package/dist/key-packages/validate-key-package-event.js +49 -0
- package/dist/media/cache.d.ts +14 -0
- package/dist/media/cache.js +10 -0
- package/dist/media/index.d.ts +52 -0
- package/dist/media/index.js +71 -0
- package/dist/mls.d.ts +15 -0
- package/dist/mls.js +15 -0
- package/dist/shared/account-pubkey.d.ts +4 -0
- package/dist/shared/account-pubkey.js +10 -0
- package/dist/shared/errors.d.ts +21 -0
- package/dist/shared/errors.js +85 -0
- package/dist/shared/hex.d.ts +4 -0
- package/dist/shared/hex.js +13 -0
- package/dist/shared/index.d.ts +14 -0
- package/dist/shared/index.js +14 -0
- package/dist/shared/kinds.d.ts +8 -0
- package/dist/shared/kinds.js +28 -0
- package/dist/shared/publish-classification.d.ts +26 -0
- package/dist/shared/publish-classification.js +31 -0
- package/dist/storage/envelope.d.ts +39 -0
- package/dist/storage/envelope.js +201 -0
- package/dist/storage/index.d.ts +227 -0
- package/dist/storage/index.js +459 -0
- package/dist/storage/indexeddb/idb-types.d.ts +68 -0
- package/dist/storage/indexeddb/idb-types.js +1 -0
- package/dist/storage/indexeddb/index.d.ts +17 -0
- package/dist/storage/indexeddb/index.js +141 -0
- package/dist/storage/lease.d.ts +41 -0
- package/dist/storage/lease.js +117 -0
- package/dist/storage/memory/deterministic-signer.d.ts +27 -0
- package/dist/storage/memory/deterministic-signer.js +65 -0
- package/dist/storage/memory/index.d.ts +32 -0
- package/dist/storage/memory/index.js +87 -0
- package/dist/storage/memory/lock-manager.d.ts +8 -0
- package/dist/storage/memory/lock-manager.js +71 -0
- package/package.json +66 -3
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { DeviceKeyRotationGroupOutcome, DeviceKeyRotationRecord } from '../key-packages/index.js';
|
|
2
|
+
import { type DeviceServiceDeps } from './device-deps.js';
|
|
3
|
+
/** Groups of one rotation driven at the same time. Each group's own queue serialises its operations; this bounds the load. */
|
|
4
|
+
export declare const ROTATION_CONCURRENCY = 4;
|
|
5
|
+
/**
|
|
6
|
+
* Blocked KeyPackage retirements counted before the step is given up (the rotation settles without it). A block is counted at
|
|
7
|
+
* most once per {@link RESUME_BACKOFF_MS} window: passes are started by `devices.list()`, every inbox pass and every rewind, and a
|
|
8
|
+
* publish the publisher itself retries at most once per window must not burn the budget in between.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAX_KEYPACKAGE_ATTEMPTS = 10;
|
|
11
|
+
/** Failed rechecks of the KeyPackage retirement a service instance repeats (each may prompt the signer). */
|
|
12
|
+
export declare const MAX_RECHECK_FAILURES = 3;
|
|
13
|
+
/**
|
|
14
|
+
* How long a group may stay undecided (a convergence window, an own commit pending, a refusal that is not an attempt such as
|
|
15
|
+
* `commit-pending`, a read that fails transiently) before it is `timed-out`. A deadline, not a pass count: passes are started
|
|
16
|
+
* by many callers and their number says nothing about elapsed time. Kept per service instance (a restart restarts it).
|
|
17
|
+
*/
|
|
18
|
+
export declare const ROTATION_WAIT_DEADLINE_MS: number;
|
|
19
|
+
/**
|
|
20
|
+
* `rotating` — the pass still has work; `rotated` — settled with no `timed-out` group (a `cancelled` or `removed` group
|
|
21
|
+
* does not make a rotation incomplete); `gave-up` — settled with at least one `timed-out` group, which keeps its previous
|
|
22
|
+
* key and stays fully operable (the next resume pass or `rotateKey()` retries it).
|
|
23
|
+
*/
|
|
24
|
+
export type DeviceKeyRotationOutcomeStatus = 'rotating' | 'rotated' | 'gave-up';
|
|
25
|
+
/** `devices.rotateKey()` / `devices.rotation()`'s result (AC-ROT-1). */
|
|
26
|
+
export interface DeviceKeyRotationOutcome {
|
|
27
|
+
readonly rotationId: string;
|
|
28
|
+
/** Every key the rotation replaces (the previous device key, and any other key an own leaf carried). */
|
|
29
|
+
readonly from: readonly string[];
|
|
30
|
+
/** The new device (leaf) key. */
|
|
31
|
+
readonly to: string;
|
|
32
|
+
readonly perGroupOutcome: Readonly<Record<string, DeviceKeyRotationGroupOutcome>>;
|
|
33
|
+
/** The rotation is closed: every group is terminal (`status` is not `rotating`). */
|
|
34
|
+
readonly settled: boolean;
|
|
35
|
+
readonly status: DeviceKeyRotationOutcomeStatus;
|
|
36
|
+
}
|
|
37
|
+
/** What the rotation driver needs from the device service. */
|
|
38
|
+
export interface RotationSeams {
|
|
39
|
+
/** Throws `disposed` once the service or client is disposed. */
|
|
40
|
+
assertLive(operation: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the local device's OWN forget (`forget:<k>` with `own: true`) is open (`forgetting`, not given up) — and, with
|
|
43
|
+
* `since`, whether one started at or after `since` (a forget that began after the rotation did, settled or not), and with
|
|
44
|
+
* `any`, whether any own forget record exists at all (open, settled or given up: the device was forgotten and has not been
|
|
45
|
+
* enrolled again since, which deletes the record).
|
|
46
|
+
*/
|
|
47
|
+
ownForget(options?: {
|
|
48
|
+
readonly since?: number;
|
|
49
|
+
readonly any?: boolean;
|
|
50
|
+
}): Promise<boolean>;
|
|
51
|
+
}
|
|
52
|
+
export interface RotationDriver {
|
|
53
|
+
rotateKey(): Promise<DeviceKeyRotationOutcome>;
|
|
54
|
+
rotation(): Promise<DeviceKeyRotationOutcome | undefined>;
|
|
55
|
+
/** One resume pass: the open rotation, the sweep toward `self`, the recorded KeyPackage retry. Resolves with whether work is left. */
|
|
56
|
+
resume(): Promise<boolean>;
|
|
57
|
+
/** A group's own leaf may have changed under a rewind or a notification: its "verified on `self`" mark is dropped. */
|
|
58
|
+
invalidate(groupId: string): void;
|
|
59
|
+
}
|
|
60
|
+
export declare function rotationOutcomeOf(record: DeviceKeyRotationRecord): DeviceKeyRotationOutcome;
|
|
61
|
+
export declare function createRotationDriver(deps: DeviceServiceDeps, seams: RotationSeams): RotationDriver;
|