@kumiai/mls 0.10.0 → 0.10.2
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/lib/anchor.d.ts +10 -4
- package/lib/anchor.js +26 -2
- package/lib/authentication.d.ts +24 -12
- package/lib/authentication.js +192 -83
- package/lib/capability.d.ts +37 -0
- package/lib/capability.js +141 -0
- package/lib/credential.d.ts +7 -7
- package/lib/credential.js +15 -10
- package/lib/device-proof.d.ts +2 -0
- package/lib/device-proof.js +8 -12
- package/lib/envelope-fold.d.ts +16 -1
- package/lib/envelope-fold.js +49 -9
- package/lib/errors.d.ts +18 -0
- package/lib/errors.js +33 -0
- package/lib/group-commit.d.ts +24 -35
- package/lib/group-commit.js +139 -110
- package/lib/group-context.d.ts +6 -2
- package/lib/group-context.js +11 -4
- package/lib/group-create.js +56 -11
- package/lib/group-credential.d.ts +3 -1
- package/lib/group-credential.js +17 -3
- package/lib/group-device.js +34 -21
- package/lib/group-handle.d.ts +31 -8
- package/lib/group-handle.js +275 -58
- package/lib/group-lifecycle.d.ts +49 -0
- package/lib/group-lifecycle.js +341 -0
- package/lib/group-membership.js +7 -3
- package/lib/group-welcome.d.ts +11 -2
- package/lib/group-welcome.js +122 -22
- package/lib/group.d.ts +2 -1
- package/lib/group.js +1 -0
- package/lib/history.d.ts +6 -0
- package/lib/history.js +26 -0
- package/lib/index.d.ts +12 -5
- package/lib/index.js +10 -3
- package/lib/lifecycle-proof.d.ts +33 -0
- package/lib/lifecycle-proof.js +218 -0
- package/lib/lifecycle.d.ts +46 -0
- package/lib/lifecycle.js +410 -0
- package/lib/policy.d.ts +20 -0
- package/lib/policy.js +8 -5
- package/lib/recovery-verdict.d.ts +43 -0
- package/lib/recovery-verdict.js +135 -0
- package/lib/recovery.d.ts +70 -0
- package/lib/recovery.js +110 -36
- package/lib/registry.d.ts +34 -7
- package/lib/registry.js +113 -15
- package/lib/roster.d.ts +1 -1
- package/lib/roster.js +2 -2
- package/lib/secret-tree.d.ts +3 -0
- package/lib/secret-tree.js +60 -0
- package/lib/types.d.ts +13 -8
- package/package.json +5 -5
package/lib/credential.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export type ControllerBinding = {
|
|
|
33
33
|
id: string;
|
|
34
34
|
prefix: Array<SignedEvent>;
|
|
35
35
|
capability: string;
|
|
36
|
+
/** The leaf holder's direct controller grant, required for chained capabilities. */
|
|
37
|
+
holderGrant?: string;
|
|
36
38
|
};
|
|
37
39
|
export type MLSCredentialIdentity = {
|
|
38
40
|
v?: 1;
|
|
@@ -63,21 +65,19 @@ export type GroupMember = {
|
|
|
63
65
|
};
|
|
64
66
|
export declare function parseMLSCredentialIdentity(identity: Uint8Array): MLSCredentialIdentity;
|
|
65
67
|
/**
|
|
66
|
-
* The normalized DID an MLS leaf credential names, or `
|
|
68
|
+
* The normalized DID an MLS leaf credential names, or `null` when it names none.
|
|
67
69
|
*
|
|
68
70
|
* Total by contract. The receive-side commit policy calls this on a leaf inside an untrusted
|
|
69
71
|
* commit, and `defaultCommitPolicy` is pure and total — a malformed credential must read as
|
|
70
72
|
* "no DID", never throw past the policy boundary. Every rejection `parseMLSCredentialIdentity`
|
|
71
|
-
* raises collapses to `
|
|
73
|
+
* raises collapses to `null` here: non-JSON bytes, a non-object value, an unsupported `v`, a
|
|
72
74
|
* non-string `id`, a non-string `longForm`.
|
|
73
75
|
*
|
|
74
76
|
* `credentialType !== basic` does not narrow on its own: `CredentialCustom.credentialType` is a
|
|
75
77
|
* bare `number`, so the compiler cannot rule it out. ts-mls's own guard can.
|
|
76
78
|
*
|
|
77
|
-
*
|
|
79
|
+
* An empty `id` names no DID and returns `null`.
|
|
80
|
+
* Syntax is not validated. An identity naming an arbitrary non-empty string returns that string, which no
|
|
78
81
|
* roster grants — a lookup miss, and deliberately distinct from a credential that names nothing.
|
|
79
|
-
*
|
|
80
|
-
* Not re-exported from the package index: `policy.ts` is the only consumer today, and widening the
|
|
81
|
-
* surface is cheap to do later and impossible to undo.
|
|
82
82
|
*/
|
|
83
|
-
export declare function didFromCredential(credential: Credential): string |
|
|
83
|
+
export declare function didFromCredential(credential: Credential): string | null;
|
package/lib/credential.js
CHANGED
|
@@ -50,40 +50,45 @@ export function parseMLSCredentialIdentity(identity) {
|
|
|
50
50
|
if (!Array.isArray(cc.prefix)) {
|
|
51
51
|
throw new Error('Invalid MLS credential: controller.prefix must be an array');
|
|
52
52
|
}
|
|
53
|
+
if ('holderGrant' in cc && typeof cc.holderGrant !== 'string') {
|
|
54
|
+
throw new Error('Invalid MLS credential: controller.holderGrant must be a string');
|
|
55
|
+
}
|
|
53
56
|
// Structural only — the prefix events are validated cryptographically by the fold in
|
|
54
57
|
// validateCredential, never here (parse stays pure/structural, like longForm).
|
|
55
58
|
result.controller = {
|
|
56
59
|
id: cc.id,
|
|
57
60
|
prefix: cc.prefix,
|
|
58
|
-
capability: cc.capability
|
|
61
|
+
capability: cc.capability,
|
|
62
|
+
...typeof cc.holderGrant === 'string' ? {
|
|
63
|
+
holderGrant: cc.holderGrant
|
|
64
|
+
} : {}
|
|
59
65
|
};
|
|
60
66
|
}
|
|
61
67
|
return result;
|
|
62
68
|
}
|
|
63
69
|
/**
|
|
64
|
-
* The normalized DID an MLS leaf credential names, or `
|
|
70
|
+
* The normalized DID an MLS leaf credential names, or `null` when it names none.
|
|
65
71
|
*
|
|
66
72
|
* Total by contract. The receive-side commit policy calls this on a leaf inside an untrusted
|
|
67
73
|
* commit, and `defaultCommitPolicy` is pure and total — a malformed credential must read as
|
|
68
74
|
* "no DID", never throw past the policy boundary. Every rejection `parseMLSCredentialIdentity`
|
|
69
|
-
* raises collapses to `
|
|
75
|
+
* raises collapses to `null` here: non-JSON bytes, a non-object value, an unsupported `v`, a
|
|
70
76
|
* non-string `id`, a non-string `longForm`.
|
|
71
77
|
*
|
|
72
78
|
* `credentialType !== basic` does not narrow on its own: `CredentialCustom.credentialType` is a
|
|
73
79
|
* bare `number`, so the compiler cannot rule it out. ts-mls's own guard can.
|
|
74
80
|
*
|
|
75
|
-
*
|
|
81
|
+
* An empty `id` names no DID and returns `null`.
|
|
82
|
+
* Syntax is not validated. An identity naming an arbitrary non-empty string returns that string, which no
|
|
76
83
|
* roster grants — a lookup miss, and deliberately distinct from a credential that names nothing.
|
|
77
|
-
*
|
|
78
|
-
* Not re-exported from the package index: `policy.ts` is the only consumer today, and widening the
|
|
79
|
-
* surface is cheap to do later and impossible to undo.
|
|
80
84
|
*/ export function didFromCredential(credential) {
|
|
81
85
|
if (!isDefaultCredential(credential) || credential.credentialType !== defaultCredentialTypes.basic) {
|
|
82
|
-
return
|
|
86
|
+
return null;
|
|
83
87
|
}
|
|
84
88
|
try {
|
|
85
|
-
|
|
89
|
+
const id = parseMLSCredentialIdentity(credential.identity).id;
|
|
90
|
+
return id === '' ? null : normalizeDID(id);
|
|
86
91
|
} catch {
|
|
87
|
-
return
|
|
92
|
+
return null;
|
|
88
93
|
}
|
|
89
94
|
}
|
package/lib/device-proof.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export type LeafBinding = {
|
|
|
7
7
|
controller?: string;
|
|
8
8
|
/** The embedded controller log prefix (present iff bound), for resolving a capability signature. */
|
|
9
9
|
prefix?: Array<SignedEvent>;
|
|
10
|
+
capability?: string;
|
|
11
|
+
holderGrant?: string;
|
|
10
12
|
/** The leaf's MLS signature public key. */
|
|
11
13
|
leafKey: Uint8Array;
|
|
12
14
|
};
|
package/lib/device-proof.js
CHANGED
|
@@ -26,23 +26,19 @@ import { verifyManagementCapability } from './authentication.js';
|
|
|
26
26
|
if (binding?.controller == null) return false;
|
|
27
27
|
return normalizeDID(binding.controller) === subject;
|
|
28
28
|
}
|
|
29
|
+
if (value.op === 'reset' || value.op === 'clock' || value.proof !== undefined) return false;
|
|
30
|
+
const recordedController = ctx.controllerOf(subject);
|
|
31
|
+
const subjectBinding = ctx.bindingOfDID(subject);
|
|
32
|
+
const subjectController = value.op === 'register' || value.op === 'add' ? value.controller : recordedController;
|
|
33
|
+
if (subjectController == null) return false;
|
|
34
|
+
if (recordedController != null && normalizeDID(recordedController) !== normalizeDID(subjectController)) return false;
|
|
35
|
+
if (subjectBinding != null && (subjectBinding.controller == null || normalizeDID(subjectBinding.controller) !== normalizeDID(subjectController))) return false;
|
|
29
36
|
if (value.op === 'register' && subject === issuer) {
|
|
30
37
|
const binding = ctx.bindingOfDID(issuer);
|
|
31
38
|
if (binding?.controller == null || value.controller == null) return false;
|
|
32
39
|
return normalizeDID(binding.controller) === normalizeDID(value.controller);
|
|
33
40
|
}
|
|
34
|
-
const authorizedProfile =
|
|
35
|
-
;
|
|
36
|
-
if (authorizedProfile == null) return false;
|
|
37
|
-
// Cross-profile rebind guard: a register/add must never overwrite a subject already bound to a
|
|
38
|
-
// DIFFERENT controller. Without this, a manager of profile P could re-bind another profile Q's
|
|
39
|
-
// active device to P (flipping its authority), then revoke it — evicting Q's device in two
|
|
40
|
-
// commits. Self-register (subject === issuer) returned earlier; a brand-new subject
|
|
41
|
-
// (controllerOf undefined) and a same-controller re-register both stay allowed.
|
|
42
|
-
if (value.op === 'register' || value.op === 'add') {
|
|
43
|
-
const existingController = ctx.controllerOf(subject);
|
|
44
|
-
if (existingController != null && existingController !== authorizedProfile) return false;
|
|
45
|
-
}
|
|
41
|
+
const authorizedProfile = normalizeDID(subjectController);
|
|
46
42
|
const binding = ctx.bindingOfDID(issuer);
|
|
47
43
|
if (binding?.controller == null || binding.prefix == null) return false;
|
|
48
44
|
if (normalizeDID(binding.controller) !== authorizedProfile) return false;
|
package/lib/envelope-fold.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RevokeProofError } from './errors.js';
|
|
1
2
|
import type { FoldInput } from './fold.js';
|
|
2
3
|
import type { VerifiedLedgerEntry } from './ledger.js';
|
|
3
4
|
import { type DeviceRegistry } from './registry.js';
|
|
@@ -18,8 +19,22 @@ export type EnvelopeFoldResult = {
|
|
|
18
19
|
ok: false;
|
|
19
20
|
reason: string;
|
|
20
21
|
entryID: string;
|
|
22
|
+
error?: RevokeProofError;
|
|
21
23
|
};
|
|
22
24
|
export declare const GROUP_TYPE_PREFIX = "kumiai.";
|
|
25
|
+
/** Present for a lifecycle group: consumer entries must come from a controller-bound leaf. */
|
|
26
|
+
export type FoldEnvelopeContext = {
|
|
27
|
+
controllerID: string;
|
|
28
|
+
/** The controller bound to the issuer's pre-commit leaf, if any. */
|
|
29
|
+
memberController: (did: string) => string | undefined;
|
|
30
|
+
};
|
|
31
|
+
export type FoldEnvelopeParams = {
|
|
32
|
+
baseRoster: RosterState;
|
|
33
|
+
baseRegistry: DeviceRegistry;
|
|
34
|
+
entries: Array<FoldInput>;
|
|
35
|
+
groupID: string;
|
|
36
|
+
context?: FoldEnvelopeContext;
|
|
37
|
+
};
|
|
23
38
|
/**
|
|
24
39
|
* Fold an envelope's verified entries against a base roster, enforcing that every
|
|
25
40
|
* entry is admin-authored in state-so-far. Pure, never throws.
|
|
@@ -36,4 +51,4 @@ export declare const GROUP_TYPE_PREFIX = "kumiai.";
|
|
|
36
51
|
* subsumes `kumiai.role`'s own authority rule. State-so-far, not a pre-commit
|
|
37
52
|
* snapshot, so an envelope of `[promote Bob, entry-issued-by-Bob]` is accepted.
|
|
38
53
|
*/
|
|
39
|
-
export declare function foldEnvelope(
|
|
54
|
+
export declare function foldEnvelope(params: FoldEnvelopeParams): EnvelopeFoldResult;
|
package/lib/envelope-fold.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { normalizeDID } from '@kokuin/token';
|
|
2
|
+
import { RevokeProofError } from './errors.js';
|
|
3
|
+
import { authority, DEVICE_ENTRY_TYPE, isDeviceValue, isLifecycleDeviceValue, registryApply } from './registry.js';
|
|
2
4
|
import { adminCount, ROLE_ENTRY_TYPE, roleReducer } from './roster.js';
|
|
3
5
|
export const GROUP_TYPE_PREFIX = 'kumiai.';
|
|
4
6
|
function isRoleValue(value) {
|
|
@@ -19,7 +21,8 @@ function isRoleValue(value) {
|
|
|
19
21
|
* entry's issuer must be an admin at its own position — the universal invariant that
|
|
20
22
|
* subsumes `kumiai.role`'s own authority rule. State-so-far, not a pre-commit
|
|
21
23
|
* snapshot, so an envelope of `[promote Bob, entry-issued-by-Bob]` is accepted.
|
|
22
|
-
*/ export function foldEnvelope(
|
|
24
|
+
*/ export function foldEnvelope(params) {
|
|
25
|
+
const { baseRoster, baseRegistry, entries, groupID, context } = params;
|
|
23
26
|
let workingRoster = {
|
|
24
27
|
roles: new Map(baseRoster.roles)
|
|
25
28
|
};
|
|
@@ -50,13 +53,50 @@ function isRoleValue(value) {
|
|
|
50
53
|
};
|
|
51
54
|
}
|
|
52
55
|
const value = entry.value;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}
|
|
56
|
+
if (context != null ? !isLifecycleDeviceValue(value) : value.op === 'reset' || value.op === 'clock' || value.proof !== undefined) {
|
|
57
|
+
return {
|
|
58
|
+
ok: false,
|
|
59
|
+
reason: 'device operation is not allowed in this group',
|
|
60
|
+
entryID
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
workingRegistry = registryApply({
|
|
65
|
+
issuer,
|
|
66
|
+
entry: {
|
|
67
|
+
...entry,
|
|
68
|
+
value
|
|
69
|
+
}
|
|
70
|
+
}, workingRegistry, context?.controllerID);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
return {
|
|
73
|
+
ok: false,
|
|
74
|
+
reason: 'invalid lifecycle proof',
|
|
75
|
+
entryID,
|
|
76
|
+
...error instanceof RevokeProofError ? {
|
|
77
|
+
error
|
|
78
|
+
} : {}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (context != null) {
|
|
84
|
+
if (entry.type.startsWith(GROUP_TYPE_PREFIX)) {
|
|
85
|
+
return {
|
|
86
|
+
ok: false,
|
|
87
|
+
reason: 'reserved lifecycle entry type',
|
|
88
|
+
entryID
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const bound = context.memberController(normalizeDID(issuer));
|
|
92
|
+
if (bound == null || normalizeDID(bound) !== normalizeDID(context.controllerID)) {
|
|
93
|
+
return {
|
|
94
|
+
ok: false,
|
|
95
|
+
reason: 'issuer has no pre-commit controller-bound leaf',
|
|
96
|
+
entryID
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
surfaced.push(verified);
|
|
60
100
|
continue;
|
|
61
101
|
}
|
|
62
102
|
// The universal invariant, now authority-aware: the issuer's AUTHORITY (controller ?? id,
|
package/lib/errors.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type LeafBindingReason = 'missing-holder-evidence' | 'holder-evidence-mismatch' | 'issuer-mismatch' | 'audience-mismatch' | 'permission-denied' | 'signature-invalid' | 'confirmation-invalid' | 'subject-mismatch' | 'chain-depth' | 'self-issued' | 'child-outlives-parent' | 'denied-issuer' | 'denied-id' | 'renewal-order' | 'lifetime-cap' | 'generation-floor' | 'identity-change' | 'controller-mismatch' | 'floating-refused' | 'history-horizon';
|
|
2
|
+
export declare class LeafBindingError extends Error {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(reason: LeafBindingReason);
|
|
5
|
+
get reason(): LeafBindingReason;
|
|
6
|
+
}
|
|
7
|
+
export type LeafLapsedReason = 'lapsed';
|
|
8
|
+
export declare class LeafLapsedError extends Error {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(reason: LeafLapsedReason);
|
|
11
|
+
get reason(): LeafLapsedReason;
|
|
12
|
+
}
|
|
13
|
+
export type RevokeProofReason = 'no-rev' | 'wrong-controller' | 'not-authority-signed' | 'generation-floor' | 'too-large' | 'detached' | 'needs-reset' | 'time-regression' | 'effects-mismatch' | 'removes-mismatch';
|
|
14
|
+
export declare class RevokeProofError extends Error {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(reason: RevokeProofReason);
|
|
17
|
+
get reason(): RevokeProofReason;
|
|
18
|
+
}
|
package/lib/errors.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class LeafBindingError extends Error {
|
|
2
|
+
#reason;
|
|
3
|
+
constructor(reason){
|
|
4
|
+
super(`Invalid leaf binding: ${reason}`);
|
|
5
|
+
this.name = 'LeafBindingError';
|
|
6
|
+
this.#reason = reason;
|
|
7
|
+
}
|
|
8
|
+
get reason() {
|
|
9
|
+
return this.#reason;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class LeafLapsedError extends Error {
|
|
13
|
+
#reason;
|
|
14
|
+
constructor(reason){
|
|
15
|
+
super(`Leaf lapsed: ${reason}`);
|
|
16
|
+
this.name = 'LeafLapsedError';
|
|
17
|
+
this.#reason = reason;
|
|
18
|
+
}
|
|
19
|
+
get reason() {
|
|
20
|
+
return this.#reason;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class RevokeProofError extends Error {
|
|
24
|
+
#reason;
|
|
25
|
+
constructor(reason){
|
|
26
|
+
super(`Invalid revoke proof: ${reason}`);
|
|
27
|
+
this.name = 'RevokeProofError';
|
|
28
|
+
this.#reason = reason;
|
|
29
|
+
}
|
|
30
|
+
get reason() {
|
|
31
|
+
return this.#reason;
|
|
32
|
+
}
|
|
33
|
+
}
|
package/lib/group-commit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type SigningIdentity } from '@kokuin/token';
|
|
2
|
-
import { createCommit, type DefaultProposal, type KeyPackage } from 'ts-mls';
|
|
2
|
+
import { type ClientState, createCommit, type DefaultProposal, type KeyPackage, type UnappliedProposals } from 'ts-mls';
|
|
3
3
|
import { type GroupHandle } from './group-handle.js';
|
|
4
4
|
import { type GroupPermission } from './roster.js';
|
|
5
5
|
import type { Invite } from './types.js';
|
|
@@ -8,30 +8,12 @@ export type InviteRecipientMismatchErrorParams = {
|
|
|
8
8
|
expectedDID: string;
|
|
9
9
|
actualDID: string;
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
12
|
-
* Thrown by {@link commitInvite} when the supplied key package's credential DID is not the
|
|
13
|
-
* identity the invite's enacted role entry grants a role to.
|
|
14
|
-
*
|
|
15
|
-
* Distinct from an ordinary rejection on purpose: the expected trigger is a key-package store
|
|
16
|
-
* that served the wrong owner's package, and adding the package anyway would put a different
|
|
17
|
-
* identity in the group than the one the roster grants the role to. A host should alert on this.
|
|
18
|
-
*
|
|
19
|
-
* The same error also fires for any invite whose trailing `kumiai.role` entry names someone
|
|
20
|
-
* other than the intended invitee — hand-built, tampered, or reordered — with an otherwise
|
|
21
|
-
* honest key package. A host seeing this should not assume a store compromise on that basis
|
|
22
|
-
* alone.
|
|
23
|
-
*
|
|
24
|
-
* The receive-side add rule in {@link defaultCommitPolicy} does NOT close this residual, though it
|
|
25
|
-
* is easy to assume it would. That rule rejects an Add whose DID the candidate roster grants
|
|
26
|
-
* nothing; in the reordered case the trailing grant's subject IS granted, so the Add passes and the
|
|
27
|
-
* intended invitee is left holding a grant it never joined against. Closing it needs this binding to
|
|
28
|
-
* seek the enacted entry matching the key package's DID rather than reading the last one.
|
|
29
|
-
*/
|
|
11
|
+
/** The supplied key package names a different identity from the invite's recipient. */
|
|
30
12
|
export declare class InviteRecipientMismatchError extends Error {
|
|
31
13
|
#private;
|
|
32
14
|
constructor(params: InviteRecipientMismatchErrorParams);
|
|
33
15
|
get groupID(): string;
|
|
34
|
-
/** DID the invite
|
|
16
|
+
/** DID the invite names. */
|
|
35
17
|
get expectedDID(): string;
|
|
36
18
|
/** DID the supplied key package presents. */
|
|
37
19
|
get actualDID(): string;
|
|
@@ -40,20 +22,30 @@ export type CreateInviteParams = {
|
|
|
40
22
|
group: GroupHandle;
|
|
41
23
|
identity: SigningIdentity;
|
|
42
24
|
recipientDID: string;
|
|
25
|
+
} & ({
|
|
43
26
|
permission: GroupPermission;
|
|
44
|
-
|
|
27
|
+
entries?: never;
|
|
28
|
+
} | {
|
|
29
|
+
permission?: never;
|
|
30
|
+
entries?: Array<string>;
|
|
31
|
+
});
|
|
45
32
|
export type CreateInviteResult = {
|
|
46
33
|
invite: Invite;
|
|
47
34
|
};
|
|
48
|
-
/**
|
|
49
|
-
* Create an invite for a new member. Does NOT add them — call commitInvite with
|
|
50
|
-
* their key package for that.
|
|
51
|
-
*
|
|
52
|
-
* Only an admin may invite: a role entry from a non-admin issuer is dropped by every
|
|
53
|
-
* receiver's fold, so refusing here turns a silent downstream rejection into a local
|
|
54
|
-
* error.
|
|
55
|
-
*/
|
|
35
|
+
/** Create an invite without adding its recipient; commitInvite enacts the admission. */
|
|
56
36
|
export declare function createInvite(params: CreateInviteParams): Promise<CreateInviteResult>;
|
|
37
|
+
export type CommitWithEntriesParams = {
|
|
38
|
+
group: GroupHandle;
|
|
39
|
+
extraProposals: Array<DefaultProposal>;
|
|
40
|
+
/** Pending proposals to commit by reference, retaining their authenticated senders. */
|
|
41
|
+
pendingProposals?: UnappliedProposals;
|
|
42
|
+
enacted: Array<string>;
|
|
43
|
+
ratchetTreeExtension?: boolean;
|
|
44
|
+
/** Defaults to true; device and lifecycle entries carry their own authority. */
|
|
45
|
+
requireAdmin?: boolean;
|
|
46
|
+
/** State to commit from instead of the live one, e.g. a tree with a renewed own leaf. */
|
|
47
|
+
commitState?: ClientState;
|
|
48
|
+
};
|
|
57
49
|
/**
|
|
58
50
|
* The one place a commit carrying control-ledger entries is built: `commitInvite`,
|
|
59
51
|
* `removeMember`, and `commitLedgerEntries` all route through it, so envelope and
|
|
@@ -73,10 +65,7 @@ export declare function createInvite(params: CreateInviteParams): Promise<Create
|
|
|
73
65
|
* proposal advancing the head by exactly those ids, in envelope order. An empty list
|
|
74
66
|
* moves no head and carries no envelope.
|
|
75
67
|
*/
|
|
76
|
-
export declare function commitWithEntries(
|
|
77
|
-
ratchetTreeExtension?: boolean;
|
|
78
|
-
requireAdmin?: boolean;
|
|
79
|
-
}): Promise<Awaited<ReturnType<typeof createCommit>>>;
|
|
68
|
+
export declare function commitWithEntries(params: CommitWithEntriesParams): Promise<Awaited<ReturnType<typeof createCommit>>>;
|
|
80
69
|
export type CommitLedgerEntriesResult = {
|
|
81
70
|
/** Framed MLSMessage bytes. Broadcast to existing members via the DS. */
|
|
82
71
|
commitMessage: Uint8Array;
|
|
@@ -119,7 +108,7 @@ export type CommitInviteResult = {
|
|
|
119
108
|
*
|
|
120
109
|
* The invite's ledger entries are enacted here: their content ids ride the commit's
|
|
121
110
|
* control envelope and advance the head by exactly those ids, so every receiver folds
|
|
122
|
-
* the
|
|
111
|
+
* the appended entries as it applies the Add. The envelope carries ids, not
|
|
123
112
|
* bodies — a receiver holding neither the entry nor a `resolveLedgerEntries` resolver
|
|
124
113
|
* throws MissingLedgerEntriesError.
|
|
125
114
|
*
|