@kumiai/mls 0.13.3 → 0.13.4

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.
@@ -1,5 +1,6 @@
1
1
  import { type CapabilityPayload } from '@kokuin/capability';
2
2
  import { type SignedToken, type SigningIdentity } from '@kokuin/token';
3
+ import type { Now } from '@sozai/runtime';
3
4
  /** The action a device capability must grant for a leaf to authenticate as a kumiai MLS leaf. */
4
5
  export declare const MLS_LEAF_ACT = "authenticate";
5
6
  /** The resource half of that grant — kumiai-namespaced, group-independent. */
@@ -24,7 +25,7 @@ export declare function assertCapabilityLifetime(payload: CapabilityTimeClaims,
24
25
  export declare function capabilityKey(payload: CapabilityPayload): import("@kokuin/controller").TaggedKey;
25
26
  export declare function assertControllerGrant(payload: CapabilityPayload, controllerID: string): void;
26
27
  export type MintLeafCapabilityParams = {
27
- nowSeconds?: number;
28
+ now: Now;
28
29
  signer: SigningIdentity;
29
30
  controllerID: string;
30
31
  audience: string;
package/lib/capability.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { audienceConfirmation, hasPermission } from '@kokuin/capability';
2
2
  import { tryDecodeKey } from '@kokuin/controller';
3
- import { isSignedToken, normalizeDID, now, stringifyToken } from '@kokuin/token';
3
+ import { isSignedToken, normalizeDID, stringifyToken } from '@kokuin/token';
4
4
  import { b64uToJSON } from '@sozai/codec';
5
5
  import { LeafBindingError } from './errors.js';
6
6
  /** The action a device capability must grant for a leaf to authenticate as a kumiai MLS leaf. */ export const MLS_LEAF_ACT = 'authenticate';
@@ -66,7 +66,7 @@ function issuingPayload(params, maximum) {
66
66
  if (!params.controllerID.startsWith('did:kokuin:')) {
67
67
  throw new LeafBindingError('controller-mismatch');
68
68
  }
69
- const { nowSeconds: iat = now() } = params;
69
+ const iat = Math.floor(params.now() / 1000);
70
70
  assertCapabilityLifetime({
71
71
  iat,
72
72
  exp: params.exp
@@ -1,5 +1,6 @@
1
1
  import type { ControllerLog } from '@kokuin/controller';
2
2
  import { type SigningIdentity } from '@kokuin/token';
3
+ import type { Now } from '@sozai/runtime';
3
4
  import { type ClientState, createCommit, type DefaultProposal, type KeyPackage, type ProposalWithSender, type UnappliedProposals } from 'ts-mls';
4
5
  import { type GroupHandle } from './group-handle.js';
5
6
  import { type GroupPermission } from './roster.js';
@@ -117,6 +118,8 @@ export type CommitInviteResult = {
117
118
  epoch: bigint;
118
119
  };
119
120
  export type CommitInviteParams = YieldOptions & {
121
+ /** Clock for the author-time check of the invitee's binding, read once. */
122
+ now: Now;
120
123
  group: GroupHandle;
121
124
  keyPackage: KeyPackage;
122
125
  invite: Invite;
@@ -143,4 +146,4 @@ export type CommitInviteParams = YieldOptions & {
143
146
  * The mutex only serializes concurrent calls against one handle; it does not make a
144
147
  * second commit from a superseded handle safe.
145
148
  */
146
- export declare function commitInvite({ group, keyPackage, invite, ...options }: CommitInviteParams): Promise<CommitInviteResult>;
149
+ export declare function commitInvite({ now, group, keyPackage, invite, ...options }: CommitInviteParams): Promise<CommitInviteResult>;
@@ -341,9 +341,6 @@ export function proposedTree(state, proposals) {
341
341
  for (const proposal of proposals){
342
342
  if (proposal.proposalType === defaultProposalTypes.add) {
343
343
  const leaf = proposal.add.keyPackage.leafNode;
344
- if (isDefaultCredential(leaf.credential) && leaf.credential.credentialType === defaultCredentialTypes.basic) {
345
- assertBindingAuthorTime(parseMLSCredentialIdentity(leaf.credential.identity).controller);
346
- }
347
344
  await validateEntry(group, leaf, undefined, {
348
345
  registry: fold.registry,
349
346
  stage: 'full',
@@ -475,7 +472,7 @@ export function proposedTree(state, proposals) {
475
472
  * commit: two commits from the same source handle both frame at its epoch and diverge.
476
473
  * The mutex only serializes concurrent calls against one handle; it does not make a
477
474
  * second commit from a superseded handle safe.
478
- */ export async function commitInvite({ group, keyPackage, invite, ...options }) {
475
+ */ export async function commitInvite({ now, group, keyPackage, invite, ...options }) {
479
476
  return mutexFor(group).run(async ()=>{
480
477
  if (invite.groupID !== group.groupID) {
481
478
  throw new Error(`commitInvite: invite is for group ${invite.groupID}, not ${group.groupID}`);
@@ -531,6 +528,10 @@ export function proposedTree(state, proposals) {
531
528
  keyPackage
532
529
  }
533
530
  };
531
+ assertBindingAuthorTime({
532
+ controller: parseMLSCredentialIdentity(credential.identity).controller,
533
+ nowSeconds: Math.floor(now() / 1000)
534
+ });
534
535
  // A lifecycle group re-admitting a device replaces the leaf it still holds for that DID.
535
536
  const stale = group.anchor.controller == null ? undefined : staleLeafIndex(group.state.ratchetTree, keyPackage.leafNode);
536
537
  const result = await commitWithEntries({
@@ -1,4 +1,5 @@
1
1
  import { type OwnIdentity } from '@kokuin/token';
2
+ import type { Now } from '@sozai/runtime';
2
3
  import { type ClientState } from 'ts-mls';
3
4
  import type { MemberCredential } from './credential.js';
4
5
  import { GroupHandle } from './group-handle.js';
@@ -10,9 +11,11 @@ export type CreateGroupResult = {
10
11
  export type CreateGroupParams = {
11
12
  identity: OwnIdentity;
12
13
  groupID: string;
14
+ /** Clock for the author-time check of the creator's binding, read once. */
15
+ now: Now;
13
16
  } & GroupOptions & YieldOptions;
14
17
  /** Create a new MLS group. The identity becomes the sole member and admin. */
15
- export declare function createGroup({ identity, groupID, ...options }: CreateGroupParams): Promise<CreateGroupResult>;
18
+ export declare function createGroup({ identity, groupID, now, ...options }: CreateGroupParams): Promise<CreateGroupResult>;
16
19
  export type RestoreGroupParams = YieldOptions & {
17
20
  state: ClientState;
18
21
  credential: MemberCredential;
@@ -10,8 +10,11 @@ import { GroupHandle } from './group-handle.js';
10
10
  import { buildLedgerHeadExtension, extendHead, genesisHead } from './head.js';
11
11
  import { ledgerEntryDigest, signLedgerEntry } from './ledger.js';
12
12
  import { DEVICE_ENTRY_TYPE, registryForLog } from './registry.js';
13
- /** Create a new MLS group. The identity becomes the sole member and admin. */ export async function createGroup({ identity, groupID, ...options }) {
14
- assertBindingAuthorTime(options?.controller);
13
+ /** Create a new MLS group. The identity becomes the sole member and admin. */ export async function createGroup({ identity, groupID, now, ...options }) {
14
+ assertBindingAuthorTime({
15
+ controller: options?.controller,
16
+ nowSeconds: Math.floor(now() / 1000)
17
+ });
15
18
  // A binding enriches a supplied anchor before genesis; standard anchor bytes stay untouched.
16
19
  // Existing lifecycle fields must agree with the authored policy before the tree is validated.
17
20
  const extensions = [
@@ -1,4 +1,5 @@
1
1
  import { type OwnIdentity } from '@kokuin/token';
2
+ import type { Now } from '@sozai/runtime';
2
3
  import { type Credential } from 'ts-mls';
3
4
  import type { ControllerBinding } from './credential.js';
4
5
  import type { GroupOptions, KeyPackageBundle } from './types.js';
@@ -7,7 +8,11 @@ export type MakeMLSCredentialParams = {
7
8
  controller?: ControllerBinding;
8
9
  };
9
10
  export declare function makeMLSCredential({ identity, controller }: MakeMLSCredentialParams): Credential;
10
- export declare function assertBindingAuthorTime(controller?: ControllerBinding, nowSeconds?: number): void;
11
+ export type AssertBindingAuthorTimeParams = {
12
+ controller?: ControllerBinding;
13
+ nowSeconds: number;
14
+ };
15
+ export declare function assertBindingAuthorTime({ controller, nowSeconds, }: AssertBindingAuthorTimeParams): void;
11
16
  /**
12
17
  * How long an ordinary, single-use key package stays valid, in days.
13
18
  *
@@ -19,10 +24,10 @@ export declare function assertBindingAuthorTime(controller?: ControllerBinding,
19
24
  export declare const ORDINARY_KEY_PACKAGE_LIFETIME_DAYS = 30;
20
25
  export type CreateKeyPackageBundleParams = {
21
26
  identity: OwnIdentity;
22
- nowSeconds?: number;
27
+ now: Now;
23
28
  } & GroupOptions;
24
29
  /** Generate a key package for joining groups. */
25
- export declare function createKeyPackageBundle({ identity, nowSeconds, ...options }: CreateKeyPackageBundleParams): Promise<KeyPackageBundle>;
30
+ export declare function createKeyPackageBundle({ identity, now, ...options }: CreateKeyPackageBundleParams): Promise<KeyPackageBundle>;
26
31
  /**
27
32
  * The `last_resort` KeyPackage extension from draft-ietf-mls-extensions (NOT RFC 9420, which has
28
33
  * no such extension). Its presence marks a key package as reusable by design; its data is empty.
@@ -54,7 +59,7 @@ export declare const LAST_RESORT_EXTENSION_TYPE = 10;
54
59
  export declare const LAST_RESORT_LIFETIME_DAYS = 90;
55
60
  export type CreateLastResortKeyPackageBundleParams = {
56
61
  identity: OwnIdentity;
57
- nowSeconds?: number;
62
+ now: Now;
58
63
  } & GroupOptions;
59
64
  /**
60
65
  * Generate a reusable last-resort key package for joining groups.
@@ -73,4 +78,4 @@ export type CreateLastResortKeyPackageBundleParams = {
73
78
  * package stops working while the hub still reports the slot as full and keeps serving it. Both
74
79
  * obligations fail the same way: silently, and precisely when the floor is needed.
75
80
  */
76
- export declare function createLastResortKeyPackageBundle({ identity, nowSeconds, ...options }: CreateLastResortKeyPackageBundleParams): Promise<KeyPackageBundle>;
81
+ export declare function createLastResortKeyPackageBundle({ identity, now, ...options }: CreateLastResortKeyPackageBundleParams): Promise<KeyPackageBundle>;
@@ -7,7 +7,6 @@ import { LeafBindingError } from './errors.js';
7
7
  import { resolveMlsContext } from './group-context.js';
8
8
  import { memberRootsOf } from './member-root.js';
9
9
  import { registryForLog } from './registry.js';
10
- const currentSeconds = ()=>Math.floor(Date.now() / 1000);
11
10
  export function makeMLSCredential({ identity, controller }) {
12
11
  const id = identity.id;
13
12
  const isPeer = isPeer4(id);
@@ -27,7 +26,7 @@ export function makeMLSCredential({ identity, controller }) {
27
26
  identity: new TextEncoder().encode(JSON.stringify(payload))
28
27
  };
29
28
  }
30
- export function assertBindingAuthorTime(controller, nowSeconds = currentSeconds()) {
29
+ export function assertBindingAuthorTime({ controller, nowSeconds }) {
31
30
  if (controller == null) return;
32
31
  if (controller.member != null) {
33
32
  if (controller.iat == null || !Number.isFinite(controller.iat) || controller.iat > nowSeconds) {
@@ -50,8 +49,11 @@ export function assertBindingAuthorTime(controller, nowSeconds = currentSeconds(
50
49
  * `extensions` is left genuinely absent (not passed as `undefined`) when the caller supplies none,
51
50
  * so `generateKeyPackageWithKey`'s own `params.extensions ?? greaseExtensions(...)` default still
52
51
  * applies for the ordinary path.
53
- */ async function buildBundle(identity, options, overrides = {}, nowSeconds) {
54
- assertBindingAuthorTime(options?.controller, nowSeconds);
52
+ */ async function buildBundle(identity, options, overrides, nowSeconds) {
53
+ assertBindingAuthorTime({
54
+ controller: options?.controller,
55
+ nowSeconds
56
+ });
55
57
  const credential = makeMLSCredential({
56
58
  identity,
57
59
  controller: options?.controller
@@ -112,7 +114,8 @@ export function assertBindingAuthorTime(controller, nowSeconds = currentSeconds(
112
114
  notAfter: BigInt(nowSeconds + ORDINARY_KEY_PACKAGE_LIFETIME_DAYS * 86_400)
113
115
  };
114
116
  }
115
- /** Generate a key package for joining groups. */ export async function createKeyPackageBundle({ identity, nowSeconds = currentSeconds(), ...options }) {
117
+ /** Generate a key package for joining groups. */ export async function createKeyPackageBundle({ identity, now, ...options }) {
118
+ const nowSeconds = Math.floor(now() / 1000);
116
119
  return buildBundle(identity, options, {
117
120
  lifetime: ordinaryLifetime(nowSeconds)
118
121
  }, nowSeconds);
@@ -166,7 +169,8 @@ export function assertBindingAuthorTime(controller, nowSeconds = currentSeconds(
166
169
  * carries an MLS lifetime, and an inviter validates it when building the Add — so an unrotated
167
170
  * package stops working while the hub still reports the slot as full and keeps serving it. Both
168
171
  * obligations fail the same way: silently, and precisely when the floor is needed.
169
- */ export async function createLastResortKeyPackageBundle({ identity, nowSeconds = currentSeconds(), ...options }) {
172
+ */ export async function createLastResortKeyPackageBundle({ identity, now, ...options }) {
173
+ const nowSeconds = Math.floor(now() / 1000);
170
174
  return buildBundle(identity, options, {
171
175
  // Supplying `extensions` at all suppresses ts-mls's own default of
172
176
  // `greaseExtensions(defaultGreaseConfig)`. `defaultGreaseConfig` is not exported, so its 0.1
@@ -1,4 +1,5 @@
1
1
  import { type SigningIdentity } from '@kokuin/token';
2
+ import type { Now } from '@sozai/runtime';
2
3
  import { type KeyPackage } from 'ts-mls';
3
4
  import { type GroupHandle } from './group-handle.js';
4
5
  import type { YieldOptions } from './types.js';
@@ -36,6 +37,8 @@ export type LabelDeviceParams = GroupSigner & {
36
37
  */
37
38
  export declare function labelDevice({ group, identity, ...params }: LabelDeviceParams): Promise<DeviceWriteResult>;
38
39
  export type AddDeviceParams = GroupSigner & {
40
+ /** Clock for the author-time check of the added leaf's binding, read once. */
41
+ now: Now;
39
42
  keyPackage: KeyPackage;
40
43
  device: string;
41
44
  controller: string;
@@ -47,7 +50,7 @@ export type AddDeviceParams = GroupSigner & {
47
50
  * capability. Binds the added leaf to `device`/`controller` (the key package must present `device`).
48
51
  * Returns the Commit + Welcome bytes.
49
52
  */
50
- export declare function addDevice({ group, identity, ...params }: AddDeviceParams): Promise<DeviceWriteResult & {
53
+ export declare function addDevice({ now, group, identity, ...params }: AddDeviceParams): Promise<DeviceWriteResult & {
51
54
  welcomeMessage: Uint8Array;
52
55
  }>;
53
56
  export type RevokeDeviceParams = GroupSigner & {
@@ -2,6 +2,7 @@ import { normalizeDID } from '@kokuin/token';
2
2
  import { defaultCredentialTypes, defaultProposalTypes, encode, isDefaultCredential, mlsMessageEncoder } from 'ts-mls';
3
3
  import { parseMLSCredentialIdentity } from './credential.js';
4
4
  import { commitWithEntries } from './group-commit.js';
5
+ import { assertBindingAuthorTime } from './group-credential.js';
5
6
  import { deriveGroup, mutexFor } from './group-handle.js';
6
7
  import { signLedgerEntry } from './ledger.js';
7
8
  import { DEVICE_ENTRY_TYPE } from './registry.js';
@@ -88,7 +89,7 @@ import { DEVICE_ENTRY_TYPE } from './registry.js';
88
89
  * package plus a `kumiai.device` `add` entry, both authorized by the profile's management
89
90
  * capability. Binds the added leaf to `device`/`controller` (the key package must present `device`).
90
91
  * Returns the Commit + Welcome bytes.
91
- */ export async function addDevice({ group, identity, ...params }) {
92
+ */ export async function addDevice({ now, group, identity, ...params }) {
92
93
  return mutexFor(group).run(async ()=>{
93
94
  // Bind the added leaf to the entry's subject — the key package must present `device`.
94
95
  const credential = params.keyPackage.leafNode.credential;
@@ -113,6 +114,10 @@ import { DEVICE_ENTRY_TYPE } from './registry.js';
113
114
  }
114
115
  }
115
116
  });
117
+ assertBindingAuthorTime({
118
+ controller: parseMLSCredentialIdentity(credential.identity).controller,
119
+ nowSeconds: Math.floor(now() / 1000)
120
+ });
116
121
  const addProposal = {
117
122
  proposalType: defaultProposalTypes.add,
118
123
  add: {
@@ -1,5 +1,6 @@
1
1
  import { type ControllerLog } from '@kokuin/controller';
2
2
  import { type CryptoOptions } from '@kokuin/token';
3
+ import type { Now } from '@sozai/runtime';
3
4
  import { type ClientState } from 'ts-mls';
4
5
  import { type ControllerBinding } from './credential.js';
5
6
  import { type RevokeProofReason } from './errors.js';
@@ -56,15 +57,17 @@ export type PreservationClockParams = YieldOptions & {
56
57
  export declare function preservationClock({ group, candidateTree, candidateRegistry, ...options }: PreservationClockParams): Promise<Array<string>>;
57
58
  export type AttestTreeTimeParams = YieldOptions & {
58
59
  group: GroupHandle;
59
- time?: number;
60
+ now: Now;
60
61
  };
61
- export declare function attestTreeTime({ group, time, ...options }: AttestTreeTimeParams): Promise<DeviceWriteResult | null>;
62
+ export declare function attestTreeTime({ group, now, ...options }: AttestTreeTimeParams): Promise<DeviceWriteResult | null>;
62
63
  export type RenewLeafParams = YieldOptions & {
64
+ /** Clock for the author-time check of the new binding, read once. */
65
+ now: Now;
63
66
  group: GroupHandle;
64
67
  binding: ControllerBinding;
65
68
  controllerLog?: ControllerLog;
66
69
  };
67
- export declare function renewLeaf({ group, binding, ...options }: RenewLeafParams): Promise<DeviceWriteResult>;
70
+ export declare function renewLeaf({ now, group, binding, ...options }: RenewLeafParams): Promise<DeviceWriteResult>;
68
71
  export type RemoveLapsedLeavesResult = {
69
72
  removed: Array<string>;
70
73
  /** Absent when no leaf had lapsed. */
@@ -193,7 +193,8 @@ export async function preservationClock({ group, candidateTree, candidateRegistr
193
193
  })
194
194
  ];
195
195
  }
196
- export async function attestTreeTime({ group, time = Date.now() / 1000, ...options }) {
196
+ export async function attestTreeTime({ group, now, ...options }) {
197
+ const time = now() / 1000;
197
198
  return mutexFor(group).run(async ()=>{
198
199
  const controller = group.anchor.controller;
199
200
  if (controller == null) return null;
@@ -252,9 +253,12 @@ async function buildResult(params) {
252
253
  epoch: newGroup.epoch
253
254
  };
254
255
  }
255
- export async function renewLeaf({ group, binding, ...options }) {
256
+ export async function renewLeaf({ now, group, binding, ...options }) {
256
257
  return mutexFor(group).run(async ()=>{
257
- assertBindingAuthorTime(binding);
258
+ assertBindingAuthorTime({
259
+ controller: binding,
260
+ nowSeconds: Math.floor(now() / 1000)
261
+ });
258
262
  const index = group.state.privatePath.leafIndex * 2;
259
263
  const tree = group.state.ratchetTree.slice();
260
264
  const original = tree[index];
@@ -1,4 +1,5 @@
1
1
  import { type OwnIdentity } from '@kokuin/token';
2
+ import type { Now } from '@sozai/runtime';
2
3
  import { type ClientState, type Welcome } from 'ts-mls';
3
4
  import { type ControllerBinding, type MemberCredential } from './credential.js';
4
5
  import { GroupHandle } from './group-handle.js';
@@ -49,6 +50,8 @@ export type JoinGroupExternalParamsBeforeBindingParams = {
49
50
  source: GroupHandle;
50
51
  };
51
52
  export type JoinGroupExternalParams = YieldOptions & {
53
+ /** Clock for the author-time check of the replacement binding, read once. */
54
+ now: Now;
52
55
  identity: OwnIdentity;
53
56
  /** Framed MLSMessage(GroupInfo) bytes from exportGroupInfo. */
54
57
  groupInfo: Uint8Array;
@@ -290,7 +290,10 @@ export async function processWelcome(params) {
290
290
  source: before
291
291
  });
292
292
  if (anchor.controller != null && controller == null) throw new LeafBindingError('floating-refused');
293
- assertBindingAuthorTime(controller);
293
+ assertBindingAuthorTime({
294
+ controller: controller,
295
+ nowSeconds: Math.floor(params.now() / 1000)
296
+ });
294
297
  const gate = await prepareLifecycleGate({
295
298
  yield: params.yield,
296
299
  group: before,
@@ -1,4 +1,5 @@
1
1
  import { type CryptoOptions, type OwnIdentity } from '@kokuin/token';
2
+ import type { Now } from '@sozai/runtime';
2
3
  import { type ClientState, type GroupContextExtension, type IncomingMessageCallback, type LeafNode } from 'ts-mls';
3
4
  import { type JudgingContext } from './authentication.js';
4
5
  import { type ControllerBinding } from './credential.js';
@@ -51,6 +52,8 @@ export type AssertSenderNotLapsedParams = YieldOptions & {
51
52
  /** Historical messages use the tree and registry authenticated in their own epoch. */
52
53
  export declare function assertSenderNotLapsed(params: AssertSenderNotLapsedParams): Promise<void>;
53
54
  export type AssertRecoveryBindingParams = YieldOptions & {
55
+ /** Clock for the author-time check of the replacement binding, read once. */
56
+ now: Now;
54
57
  group: GroupHandle;
55
58
  identity: OwnIdentity;
56
59
  controller: ControllerBinding;
package/lib/lifecycle.js CHANGED
@@ -613,7 +613,10 @@ export async function validateWelcomeTree(group, judging = {
613
613
  }
614
614
  /** @internal Check a replacement against the complete external admission predicates. */ export async function assertRecoveryBinding(params) {
615
615
  const { group, identity: ownIdentity, controller } = params;
616
- assertBindingAuthorTime(controller);
616
+ assertBindingAuthorTime({
617
+ controller: controller,
618
+ nowSeconds: Math.floor(params.now() / 1000)
619
+ });
617
620
  const index = group.findMemberLeafIndex(normalizeDID(ownIdentity.id));
618
621
  const old = index == null ? undefined : leafAt(group.state.ratchetTree, index);
619
622
  if (old == null || index == null) throw new LeafBindingError('identity-change');
@@ -1,4 +1,5 @@
1
1
  import { type SigningIdentity } from '@kokuin/token';
2
+ import type { Now } from '@sozai/runtime';
2
3
  import type { GroupHandle } from './group-handle.js';
3
4
  import { type OpenSealedGroupInfoParams } from './recovery.js';
4
5
  import type { DeviceRegistry } from './registry.js';
@@ -46,7 +47,7 @@ export type RecoverySignerEligibleParams = {
46
47
  group: GroupHandle;
47
48
  registry: DeviceRegistry;
48
49
  signer: string;
49
- /** Seconds since epoch; defaults to the current time. */
50
- now?: number;
50
+ /** Clock read once for the current time, epoch milliseconds. */
51
+ now: Now;
51
52
  };
52
53
  export declare function recoverySignerEligible(params: RecoverySignerEligibleParams): Promise<boolean>;
@@ -122,7 +122,8 @@ export async function openRecoveryVerdict(params) {
122
122
  };
123
123
  }
124
124
  export async function recoverySignerEligible(params) {
125
- const { group, registry, signer, now = Date.now() / 1000 } = params;
125
+ const { group, registry, signer } = params;
126
+ const nowSeconds = params.now() / 1000;
126
127
  const controller = group.anchor.controller;
127
128
  if (controller == null) return false;
128
129
  const options = {
@@ -179,7 +180,7 @@ export async function recoverySignerEligible(params) {
179
180
  controllerID: controller,
180
181
  ...options
181
182
  });
182
- return expiry >= Math.max(time, now - 300);
183
+ return expiry >= Math.max(time, nowSeconds - 300);
183
184
  } catch {
184
185
  return false;
185
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumiai/mls",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "description": "E2EE group identity and membership for Enkaku using MLS",
5
5
  "keywords": [
6
6
  "mls",