@koolbase/core 12.45.0 → 12.47.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.
@@ -429,9 +429,18 @@ export declare class KoolbaseAuth {
429
429
  }>;
430
430
  /** Turns MFA on and returns ten recovery codes, shown this once only. Other devices are signed out. */
431
431
  confirmMfaEnrollment(code: string): Promise<string[]>;
432
+ /**
433
+ * Whether two-step sign-in is on, how many recovery codes are left, and
434
+ * what the app's two-step setting allows: `offered` (false when the app
435
+ * does not offer it, so nothing can turn it on) and `required` (nothing
436
+ * can turn it off). An API before 12.46.0 sends neither: offered, not
437
+ * required.
438
+ */
432
439
  mfaStatus(): Promise<{
433
440
  enabled: boolean;
434
441
  recoveryCodesRemaining: number;
442
+ offered: boolean;
443
+ required: boolean;
435
444
  }>;
436
445
  /** Re-confirms the second factor, opening ten minutes to change MFA. */
437
446
  stepUpMfa(params: {
package/dist/cjs/auth.js CHANGED
@@ -921,6 +921,10 @@ class KoolbaseAuth {
921
921
  createdAt: String(r.created_at),
922
922
  expiresAt: String(r.expires_at),
923
923
  isCurrent: Boolean(r.is_current),
924
+ // An API before these sends none of these: the row's own times.
925
+ device: typeof r.device === 'string' && r.device ? r.device : 'Unknown device',
926
+ lastActiveAt: String(r.last_active_at ?? r.created_at),
927
+ signedInAt: String(r.signed_in_at ?? r.created_at),
924
928
  };
925
929
  });
926
930
  }
@@ -1217,11 +1221,23 @@ class KoolbaseAuth {
1217
1221
  await this.checkResponse(res);
1218
1222
  return (await res.json()).recovery_codes;
1219
1223
  }
1224
+ /**
1225
+ * Whether two-step sign-in is on, how many recovery codes are left, and
1226
+ * what the app's two-step setting allows: `offered` (false when the app
1227
+ * does not offer it, so nothing can turn it on) and `required` (nothing
1228
+ * can turn it off). An API before 12.46.0 sends neither: offered, not
1229
+ * required.
1230
+ */
1220
1231
  async mfaStatus() {
1221
1232
  const res = await this.authRequest('/v1/sdk/auth/mfa', { method: 'GET', includeAuth: true });
1222
1233
  await this.checkResponse(res);
1223
1234
  const d = await res.json();
1224
- return { enabled: !!d.enabled, recoveryCodesRemaining: Number(d.recovery_codes_remaining ?? 0) };
1235
+ return {
1236
+ enabled: !!d.enabled,
1237
+ recoveryCodesRemaining: Number(d.recovery_codes_remaining ?? 0),
1238
+ offered: d.offered !== false,
1239
+ required: d.required === true,
1240
+ };
1225
1241
  }
1226
1242
  /** Re-confirms the second factor, opening ten minutes to change MFA. */
1227
1243
  async stepUpMfa(params) {
@@ -135,6 +135,15 @@ export interface KoolbaseSessionInfo {
135
135
  * exclude.
136
136
  */
137
137
  isCurrent: boolean;
138
+ /**
139
+ * The device, named for a person: "Chrome on macOS", "iOS 18.1".
140
+ * "Unknown device" from an API that does not name it.
141
+ */
142
+ device: string;
143
+ /** When the device last used this session (its last renewal). */
144
+ lastActiveAt: string;
145
+ /** When its owner last signed in on it. */
146
+ signedInAt: string;
138
147
  }
139
148
  /**
140
149
  * One thing that happened to this account.
@@ -429,9 +429,18 @@ export declare class KoolbaseAuth {
429
429
  }>;
430
430
  /** Turns MFA on and returns ten recovery codes, shown this once only. Other devices are signed out. */
431
431
  confirmMfaEnrollment(code: string): Promise<string[]>;
432
+ /**
433
+ * Whether two-step sign-in is on, how many recovery codes are left, and
434
+ * what the app's two-step setting allows: `offered` (false when the app
435
+ * does not offer it, so nothing can turn it on) and `required` (nothing
436
+ * can turn it off). An API before 12.46.0 sends neither: offered, not
437
+ * required.
438
+ */
432
439
  mfaStatus(): Promise<{
433
440
  enabled: boolean;
434
441
  recoveryCodesRemaining: number;
442
+ offered: boolean;
443
+ required: boolean;
435
444
  }>;
436
445
  /** Re-confirms the second factor, opening ten minutes to change MFA. */
437
446
  stepUpMfa(params: {
package/dist/esm/auth.js CHANGED
@@ -918,6 +918,10 @@ export class KoolbaseAuth {
918
918
  createdAt: String(r.created_at),
919
919
  expiresAt: String(r.expires_at),
920
920
  isCurrent: Boolean(r.is_current),
921
+ // An API before these sends none of these: the row's own times.
922
+ device: typeof r.device === 'string' && r.device ? r.device : 'Unknown device',
923
+ lastActiveAt: String(r.last_active_at ?? r.created_at),
924
+ signedInAt: String(r.signed_in_at ?? r.created_at),
921
925
  };
922
926
  });
923
927
  }
@@ -1214,11 +1218,23 @@ export class KoolbaseAuth {
1214
1218
  await this.checkResponse(res);
1215
1219
  return (await res.json()).recovery_codes;
1216
1220
  }
1221
+ /**
1222
+ * Whether two-step sign-in is on, how many recovery codes are left, and
1223
+ * what the app's two-step setting allows: `offered` (false when the app
1224
+ * does not offer it, so nothing can turn it on) and `required` (nothing
1225
+ * can turn it off). An API before 12.46.0 sends neither: offered, not
1226
+ * required.
1227
+ */
1217
1228
  async mfaStatus() {
1218
1229
  const res = await this.authRequest('/v1/sdk/auth/mfa', { method: 'GET', includeAuth: true });
1219
1230
  await this.checkResponse(res);
1220
1231
  const d = await res.json();
1221
- return { enabled: !!d.enabled, recoveryCodesRemaining: Number(d.recovery_codes_remaining ?? 0) };
1232
+ return {
1233
+ enabled: !!d.enabled,
1234
+ recoveryCodesRemaining: Number(d.recovery_codes_remaining ?? 0),
1235
+ offered: d.offered !== false,
1236
+ required: d.required === true,
1237
+ };
1222
1238
  }
1223
1239
  /** Re-confirms the second factor, opening ten minutes to change MFA. */
1224
1240
  async stepUpMfa(params) {
@@ -135,6 +135,15 @@ export interface KoolbaseSessionInfo {
135
135
  * exclude.
136
136
  */
137
137
  isCurrent: boolean;
138
+ /**
139
+ * The device, named for a person: "Chrome on macOS", "iOS 18.1".
140
+ * "Unknown device" from an API that does not name it.
141
+ */
142
+ device: string;
143
+ /** When the device last used this session (its last renewal). */
144
+ lastActiveAt: string;
145
+ /** When its owner last signed in on it. */
146
+ signedInAt: string;
138
147
  }
139
148
  /**
140
149
  * One thing that happened to this account.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/core",
3
- "version": "12.45.0",
3
+ "version": "12.47.0",
4
4
  "description": "Koolbase SDK core \u2014 shared behaviour behind @koolbase/react-native and @koolbase/js. Install one of those, not this.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/esm/index.d.ts",