@jwilleke/ngdpbase-types 5.40.0 → 5.41.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.
Files changed (43) hide show
  1. package/lib/packages/ngdpbase-types/index.d.ts +1 -1
  2. package/lib/src/ice/fileHandling.d.ts +6 -1
  3. package/lib/src/ice/runExport.d.ts +41 -0
  4. package/lib/src/ice/runImport.d.ts +16 -7
  5. package/lib/src/ice/shims/csv.d.ts +24 -0
  6. package/lib/src/ice/shims/export.d.ts +23 -0
  7. package/lib/src/ice/shims/index.d.ts +3 -1
  8. package/lib/src/ice/shims/svg.d.ts +27 -0
  9. package/lib/src/ice/shims/takeout.d.ts +83 -0
  10. package/lib/src/ice/types.d.ts +251 -5
  11. package/lib/src/ice/vet.d.ts +19 -0
  12. package/lib/src/managers/AttachmentManager.d.ts +86 -36
  13. package/lib/src/managers/AuthManager.d.ts +117 -7
  14. package/lib/src/managers/AuthManager.js +341 -37
  15. package/lib/src/managers/ExportManager.d.ts +16 -0
  16. package/lib/src/managers/ExportManager.js +25 -0
  17. package/lib/src/managers/FileManager.d.ts +182 -0
  18. package/lib/src/managers/ImportManager.d.ts +264 -16
  19. package/lib/src/managers/MediaManager.d.ts +2 -0
  20. package/lib/src/managers/SharedFolderManager.d.ts +320 -0
  21. package/lib/src/providers/BaseMediaProvider.d.ts +4 -0
  22. package/lib/src/providers/FileSystemMediaProvider.d.ts +6 -0
  23. package/lib/src/security/PolicyDecisionPoint.d.ts +3 -2
  24. package/lib/src/security/permissions.generated.d.ts +3 -3
  25. package/lib/src/types/File.d.ts +90 -0
  26. package/lib/src/types/express.d.ts +3 -1
  27. package/lib/src/types/linkedom.d.ts +2 -0
  28. package/lib/src/utils/auditEventNames.generated.d.ts +2 -0
  29. package/lib/src/utils/auditEventNames.generated.js +2 -0
  30. package/lib/src/utils/auditEvents.d.ts +3 -0
  31. package/lib/src/utils/auditEvents.js +3 -0
  32. package/lib/src/utils/fileMigrationPlan.d.ts +81 -0
  33. package/lib/src/utils/privateStoreAccess.d.ts +21 -0
  34. package/lib/src/utils/privateStoreAccess.js +11 -0
  35. package/lib/src/utils/privateStoreImport.d.ts +0 -10
  36. package/lib/src/utils/privateStorePath.d.ts +12 -0
  37. package/lib/src/utils/privateStorePath.js +18 -0
  38. package/lib/src/utils/recoveryWordsFile.d.ts +54 -0
  39. package/lib/src/utils/sessionEnd.d.ts +1 -0
  40. package/lib/src/utils/sessionEnd.js +4 -0
  41. package/lib/src/utils/sessionIdle.d.ts +4 -0
  42. package/lib/src/utils/sessionIdle.js +6 -0
  43. package/package.json +1 -1
@@ -6,12 +6,14 @@ import { type ActorContext } from '../context/ActorContext.js';
6
6
  * failed" (#1183). A caller refusing a destructive action needs to say which.
7
7
  */
8
8
  export declare const AUDIT_WRITE_FAILED = "EAUDITWRITE";
9
+ import type { AttachmentDetail } from '../utils/auditEvents.js';
9
10
  import type { WikiEngine } from '../types/WikiEngine.js';
10
11
  import type { CatalogSource, CatalogQuery, CatalogPage, CreativeWork, SchemaType, RebuildOpts } from '../types/Schema.js';
11
12
  import type { User } from '../providers/BaseAttachmentProvider.js';
12
13
  import { type AssetQuery, type AssetRecord } from '../types/Asset.js';
13
14
  import type { StoreFileEntry, StoreFileInput, StoreFileLocation } from '../types/Provider.js';
14
15
  import type { OriginalKeep } from '../ice/types.js';
16
+ import type { FilePlace } from '../types/File.js';
15
17
  /**
16
18
  * Base attachment provider interface
17
19
  */
@@ -82,23 +84,24 @@ export interface FileInfo {
82
84
  mimeType: string;
83
85
  size: number;
84
86
  }
87
+ /** A file handed to the write door (#2148): its bytes, and what the uploader said about them. */
88
+ export interface PutFile {
89
+ bytes: Buffer;
90
+ info: FileInfo;
91
+ }
85
92
  /**
86
- * Upload options interface
93
+ * What else a write carries (#2148). None of it decides where the file goes:
94
+ * that is the place the caller passed to `FileManager.put`.
87
95
  */
88
- export interface UploadOptions {
96
+ export interface PutOptions {
97
+ /**
98
+ * The page that shows the file, recorded as a mention (and on the audit
99
+ * record of an unsealed place). Never the place: a page only links to a file.
100
+ */
89
101
  pageName?: string;
90
102
  description?: string;
91
103
  /** WikiContext for the current request — audit IP fallback */
92
104
  wikiContext?: import('../context/WikiContext.js').default;
93
- /**
94
- * Private-store destination (#1396): the upload dialog's checkbox. Decides
95
- * only when `pageName` is not a private page — an upload onto a private page
96
- * is always private, in that page's author's store (#1398). Absent or false
97
- * otherwise keeps the public attachments pool.
98
- */
99
- private?: boolean;
100
- /** Store id when private with no private page; default from ConfigurationManager defaultstoreid */
101
- store?: string;
102
105
  /**
103
106
  * An import's keep at upload (#2061): the `OriginalKeep` the engine handed
104
107
  * the receiver's `keepOriginal`, passed on unchanged. Honoured only while
@@ -115,6 +118,31 @@ export interface UploadOptions {
115
118
  */
116
119
  importedFrom?: string;
117
120
  }
121
+ /**
122
+ * The page-tied upload's options (#1396, #1398): today's callers name the page
123
+ * they upload onto and the dialog's Private tick, and FileManager turns that
124
+ * into a place (`placeForPageUpload`) until #2149/#2150 move them to a place
125
+ * the user chose.
126
+ */
127
+ /**
128
+ * What storage hands back to FileManager (#2149): the stored file's metadata,
129
+ * and what the upload's audit record says about it, which FileManager records.
130
+ */
131
+ export interface StoredInPlace {
132
+ metadata: AttachmentMetadata;
133
+ record: AttachmentDetail;
134
+ }
135
+ export interface UploadOptions extends PutOptions {
136
+ /**
137
+ * Private-store destination (#1396): the upload dialog's checkbox. Decides
138
+ * only when `pageName` is not a private page — an upload onto a private page
139
+ * is always private, in that page's author's store (#1398). Absent or false
140
+ * otherwise keeps the public attachments pool.
141
+ */
142
+ private?: boolean;
143
+ /** Store id when private with no private page; default from ConfigurationManager defaultstoreid */
144
+ store?: string;
145
+ }
118
146
  /**
119
147
  * Mention object (WebPage reference)
120
148
  */
@@ -304,19 +332,39 @@ declare class AttachmentManager extends BaseManager implements CatalogSource {
304
332
  */
305
333
  private writeAttachments;
306
334
  /**
307
- * Upload an attachment
335
+ * Upload a file onto a page: the page-tied path its current callers use
336
+ * (the editor's upload route, imports, NCM image localization, thumbnails).
337
+ *
338
+ * #2148: this decides nothing. Where the file goes is FileManager's
339
+ * (`placeForPageUpload`, kept until #2149/#2150 move these callers to a
340
+ * place the user chose), and the write is FileManager's one door, `put`,
341
+ * which asks the permission for that place and then has this manager store
342
+ * it ({@link storeInPlace}). One write path, not two.
308
343
  *
309
- * @param {Buffer} fileBuffer - File data
310
- * @param {FileInfo} fileInfo - { originalName, mimeType, size }
311
- * @param {UploadOptions} options - Upload options
312
- * @param {string} options.pageName - Page uploaded onto (optional). A private page forces the upload private, into its author's store (#1398)
313
- * @param {string} options.description - File description
314
- * @param {boolean} options.private - Private-store destination for an upload with no private page (#1396)
315
- * @param {string} options.store - Store id when private with no private page; else ConfigurationManager defaultstoreid
344
+ * @param fileBuffer - File data
345
+ * @param fileInfo - { originalName, mimeType, size }
316
346
  * @param ctx - Who is uploading (#1179): the request's subject, or a JobContext for an in-engine caller. Mandatory and positional.
317
- * @returns {Promise<AttachmentMetadata>} Attachment metadata
347
+ * @param options - The page it is uploaded onto, the private tick and store, description, keep, importedFrom
348
+ * @returns Attachment metadata
318
349
  */
319
350
  uploadAttachment(fileBuffer: Buffer, fileInfo: FileInfo, ctx: ActorContext, options?: UploadOptions): Promise<AttachmentMetadata>;
351
+ /** The owner of files (#2148, #2149): every upload goes through its door, and it writes every upload and delete record. */
352
+ private fileManager;
353
+ /**
354
+ * Store a file in `place` (#2148): the storage underneath FileManager's
355
+ * door. Only `FileManager.put` calls this, after it has asked the
356
+ * permission for the place; nothing here decides where a file goes or who
357
+ * may put it there.
358
+ *
359
+ * What it does, as the place requires: the type read from the bytes
360
+ * (#1624); the uploader recorded by identity @id, and nobody uploads
361
+ * anonymously (#1926, #2097); a vault or shared folder keeps the file in its
362
+ * own store, sealed when the store is (#1460, #1394); and an import's kept
363
+ * original honoured only in its user's own vault (#2061). It records
364
+ * nothing (#2149): it returns what the upload's audit record says (a sealed
365
+ * store's file by id only, #2048), and FileManager, the owner, records it.
366
+ */
367
+ storeInPlace(ctx: ActorContext, place: FilePlace, file: PutFile, options?: PutOptions): Promise<StoredInPlace>;
320
368
  /**
321
369
  * The username an upload is recorded under (#1926): the person the context
322
370
  * names. Asked after policy has allowed the upload and before anything is
@@ -354,8 +402,12 @@ declare class AttachmentManager extends BaseManager implements CatalogSource {
354
402
  */
355
403
  private userReference;
356
404
  private static uploaderOf;
357
- /** A file is added to a private page only by someone who may edit it: the page's own decision (#1398). */
358
- private assertMayEditPage;
405
+ /**
406
+ * A file is added to a private page only by someone who may edit it: the
407
+ * page's own decision (#1398). Asked here by `attachToPage`, and by
408
+ * FileManager's page-tied upload (#2148).
409
+ */
410
+ assertMayEditPage(ctx: ActorContext, pageName: string): Promise<void>;
359
411
  /**
360
412
  * One vault as a provider location, opened through `ctx` (#1842). Throws as
361
413
  * `storeFileIO` does: a locked vault, or a sealed kind's vault not yet opened.
@@ -428,9 +480,10 @@ declare class AttachmentManager extends BaseManager implements CatalogSource {
428
480
  /**
429
481
  * May `ctx` do `permission` to `what` in `owner`'s vault `store` (#1539)?
430
482
  * The container rule, then the capability asked with the vault, so
431
- * `vault-owner` decides — the same rule as a vault page.
483
+ * `vault-owner` decides — the same rule as a vault page. FileManager's
484
+ * write door asks it for a vault (#2148), so the rule has one home.
432
485
  */
433
- private mayInVault;
486
+ mayInVault(ctx: ActorContext, permission: string, owner: string, store: string, what: string): Promise<boolean>;
434
487
  /** The requester's own store file and its entry, before the capability is asked — see {@link findOwnStoreFile}. */
435
488
  private locateOwnStoreFile;
436
489
  /**
@@ -487,6 +540,15 @@ declare class AttachmentManager extends BaseManager implements CatalogSource {
487
540
  * differently without reading it twice (#1460).
488
541
  */
489
542
  isOwnPrivateStoreFile(attachmentId: string, ctx: ActorContext): Promise<boolean>;
543
+ /**
544
+ * The files the requester's own store `store` holds, as fingerprint → id,
545
+ * or null when this context cannot open it (#2171). The store's own
546
+ * duplicate check (its index's fingerprints), read without storing or
547
+ * recording anything: a takeout import reads it once per run and asks it
548
+ * before putting a file again, so a file deleted since comes back and one
549
+ * still held writes no second upload record. Only that store is opened.
550
+ */
551
+ ownStoreFingerprints(ctx: ActorContext, store: string): Promise<Map<string, string> | null>;
490
552
  /** The requester's own private-store files uploaded onto `pageName`. */
491
553
  getPrivateStoreAttachmentsForPage(pageName: string, ctx: ActorContext): Promise<AttachmentMetadata[]>;
492
554
  /**
@@ -839,18 +901,6 @@ declare class AttachmentManager extends BaseManager implements CatalogSource {
839
901
  ip?: string;
840
902
  } | null;
841
903
  }): Promise<boolean>;
842
- /**
843
- * Emit an attachment audit event from the manager that owns the resource.
844
- *
845
- * `docs/audit-posture.md` states the rule this implements: an action is
846
- * "emitted through `recordAuditEvent` (or the manager door that calls it)".
847
- * The door is here. Placing it at a route means every future caller has to
848
- * remember, which is the thing #1120 exists to end — being audited must not
849
- * depend on a producer recalling a method.
850
- *
851
- * `critical` decides whether a failure to record stops the action.
852
- */
853
- private recordAttachmentEvent;
854
904
  /** #1204: an attachment's metadata changed; field NAMES only, at the door both edit paths pass through. */
855
905
  private recordAssetEdit;
856
906
  /**
@@ -50,6 +50,12 @@ export interface FactorEntry {
50
50
  aal?: Aal;
51
51
  acr?: PhishingResistance;
52
52
  enabled?: boolean;
53
+ /**
54
+ * Where it comes among the second factors offered, lower first; none comes
55
+ * last (#1523, operator 2026-10-11). A number, because the configuration
56
+ * merge does not keep a custom entry's place in the list.
57
+ */
58
+ preference?: number;
53
59
  }
54
60
  export interface Factor {
55
61
  provider: string;
@@ -126,6 +132,8 @@ export interface PendingSignIn {
126
132
  requestLocation?: string | null;
127
133
  /** Private-store keys unlocked by the password, held until the sign-in completes or is dropped. */
128
134
  privateStoreHandle?: string;
135
+ /** The level this account's roles require (`requiredAalFor`), so the second factors that reach it are offered first (#1523 Q2). */
136
+ requiredAal?: Aal;
129
137
  /** The second factor, once satisfied. */
130
138
  approved?: SatisfiedFactor;
131
139
  /** Refused by the person (Deny). */
@@ -172,7 +180,8 @@ export interface ApprovalVisitor {
172
180
  }
173
181
  /** A second factor a person has enrolled and can use now. */
174
182
  export interface AvailableSecondFactor {
175
- id: 'email-link';
183
+ /** The second step's method: `email-link` for the email link (its entry is `magic-link`), else the provider id. */
184
+ id: string;
176
185
  label: string;
177
186
  /** Where it goes, masked for display (j***@example.com). */
178
187
  target: string;
@@ -453,13 +462,47 @@ export declare function answeredWithPage(mode: ReauthMode): boolean;
453
462
  /**
454
463
  * A step-up asked for and not yet given, kept on the session (#2145): which
455
464
  * permission it was for, where the prompt returns, and whether going there
456
- * does the action again (a page GET) or only brings the person back to it.
465
+ * does the action again (a page GET, or a form POST kept to be redone, #2154)
466
+ * or only brings the person back to it.
457
467
  */
458
468
  export interface PendingStepUp {
459
469
  permission: string;
460
470
  next: string;
461
471
  replays: boolean;
472
+ /** The kept form POST the confirmation releases (#2154). */
473
+ replay?: string;
462
474
  }
475
+ /**
476
+ * Where a script's own prompt is (#2193): a page that sent a request by
477
+ * `fetch` and was refused waits on the prompt its refusal named, and sends
478
+ * again only when that prompt, not another tab's, is confirmed.
479
+ */
480
+ export type StepUpPromptState = 'waiting' | 'confirmed' | 'cancelled';
481
+ /** A script's prompt as the session keeps it (#2193): its id and where it is. */
482
+ export interface StepUpPrompt {
483
+ id: string;
484
+ state: StepUpPromptState;
485
+ }
486
+ /** A prompt id as minted (#2193), or null for anything else. */
487
+ export declare function stepUpPromptId(value: unknown): string | null;
488
+ /** Where a fresh sign-in sends the browser to redo a form POST (#2154). */
489
+ export declare const STEP_UP_CONTINUE_PATH = "/auth/reauth/continue";
490
+ /** What the continue page does (#2154): post `fields` to `action` (`back` is the page it came from), or go `back` with nothing redone. */
491
+ export type StepUpReplayAnswer = {
492
+ action: string;
493
+ fields: Array<[string, string]>;
494
+ back: string;
495
+ } | {
496
+ back: string;
497
+ };
498
+ /**
499
+ * A form POST's fields as they can be posted again to give the same body
500
+ * (#2154), or null when they cannot: a file upload, a nested field, a name
501
+ * with brackets. A list goes back as `name[]`, which parses to a list even
502
+ * of one. `_csrf` is left out: the replay carries the session's token. A
503
+ * secret (`SECRET_FIELD`) is never kept, so such a form is null too.
504
+ */
505
+ export declare function replayableFields(req: Request): Array<[string, string]> | null;
463
506
  /** The step-up answer (#1525, #1635), for the caller to send in its own form. */
464
507
  export interface FreshSignInAnswer {
465
508
  /** The refused permission. */
@@ -530,6 +573,12 @@ declare class AuthManager extends BaseManager {
530
573
  * converted to entries when a site still sets only that (#1523).
531
574
  */
532
575
  private readFactorEntries;
576
+ /**
577
+ * #1523: with the `magic-link` entry off or not listed, an enrolled email
578
+ * second factor is no longer asked for. The operator may mean that, but it
579
+ * must not happen silently.
580
+ */
581
+ private warnIfEmailSecondFactorsDropped;
533
582
  /**
534
583
  * The outside OpenID Connect providers (#1743): one `OidcAuthProvider` per
535
584
  * enabled entry of `ngdpbase.auth.oidc.providers`, plus the old
@@ -1129,6 +1178,14 @@ declare class AuthManager extends BaseManager {
1129
1178
  * refused outright: it can never give a fresh factor.
1130
1179
  */
1131
1180
  askForFreshSignIn(req: Request, userContext: unknown, permission: string, mode: ReauthMode): Promise<FreshSignInAnswer>;
1181
+ /**
1182
+ * Where this session's prompt `id` is (#2193): waiting, confirmed or
1183
+ * cancelled, or unknown (another session's, dropped, or not an id). Reads
1184
+ * only, so asking it often changes nothing in the session.
1185
+ */
1186
+ stepUpPromptState(req: Request, id: unknown): StepUpPromptState | 'unknown';
1187
+ /** The prompt's Cancel (#2193): a waiting prompt of this session is cancelled, so its page stops waiting. */
1188
+ cancelStepUpPrompt(req: Request, id: unknown): void;
1132
1189
  /** Record a step-up event: a prompt, a success or a failure (#1525). */
1133
1190
  recordReauth(req: Request, eventType: AuditEventName, result: 'success' | 'failure', permission: string, detail: string): Promise<void>;
1134
1191
  /**
@@ -1141,8 +1198,11 @@ declare class AuthManager extends BaseManager {
1141
1198
  * directly, against the method), and when going there does not redo the
1142
1199
  * action (a form POST, a script's request, a download) the page there says
1143
1200
  * it can be done now (`takeStepUpNotice`).
1201
+ *
1202
+ * #2193: `prompt`, the id a script's refusal named, is confirmed when it is
1203
+ * this session's and still waiting; no other prompt is.
1144
1204
  */
1145
- completeReauth(req: Request, result: AuthenticateResult, method: string, next: string): Promise<SignInRecord | null>;
1205
+ completeReauth(req: Request, result: AuthenticateResult, method: string, next: string, prompt?: unknown): Promise<SignInRecord | null>;
1146
1206
  /**
1147
1207
  * Whether this request's page says "Confirmed — you can do it now" (#2145):
1148
1208
  * the first page the browser opens after a re-authentication that could not
@@ -1150,6 +1210,31 @@ declare class AuthManager extends BaseManager {
1150
1210
  * opened clears it, so it is said once.
1151
1211
  */
1152
1212
  takeStepUpNotice(req: Request): boolean;
1213
+ /** #2154: form POSTs kept for their fresh sign-in, by a random id. In memory: a restart drops them. */
1214
+ private stepUpReplays;
1215
+ /**
1216
+ * Keep a form POST answered with the prompt, to be redone after it
1217
+ * (#2154); its id, or null when it cannot be redone exactly. Only a page's
1218
+ * POST by a signed-in person, to an address on this site. Each prompt keeps
1219
+ * its own, so the same button pressed in two tabs loses neither (#2176); a
1220
+ * session keeps at most `STEP_UP_REPLAYS_PER_SESSION`, an account
1221
+ * `STEP_UP_REPLAYS_PER_ACCOUNT` and the site `STEP_UP_REPLAYS_TOTAL`, a new
1222
+ * prompt dropping the oldest past that, unconfirmed first, and any past its
1223
+ * time. It waits `STEP_UP_REPLAY_WAIT_MS` for the confirmation, which
1224
+ * restarts its clock. A session's end drops its own (`dropStepUpReplays`).
1225
+ */
1226
+ private keepStepUpReplay;
1227
+ /** A session ended (#2176): the form POSTs it kept go with it (`endSession`). */
1228
+ dropStepUpReplays(sessionId: string): void;
1229
+ /**
1230
+ * Take the kept form POST `id` for the continue page (#2154). Single-use:
1231
+ * taken, it is gone, whatever the answer. Another session's or person's is
1232
+ * refused (null); one not confirmed (the prompt's Cancel) or past its time
1233
+ * only goes back, a confirmed one with the note (#2145). Otherwise the page
1234
+ * posts the fields to the same address. A refusal or one past its time is
1235
+ * recorded as a `reauth-failure`; any other past its time is dropped.
1236
+ */
1237
+ takeStepUpReplay(req: Request, id: unknown): Promise<StepUpReplayAnswer | null>;
1153
1238
  /**
1154
1239
  * The one sign-in completion step (#1758): every way a person finishes
1155
1240
  * signing in — a password, a passkey, a second factor, an email link, an
@@ -1256,6 +1341,14 @@ declare class AuthManager extends BaseManager {
1256
1341
  * never satisfies step-up.
1257
1342
  */
1258
1343
  stepUpNeeded(permission: string, signIn: SignInRecord | undefined, roles: readonly string[], delegated: boolean, now?: number, cap?: number): boolean;
1344
+ /**
1345
+ * Whether `signIn` is fresh enough for every step-up permission (#2193): the
1346
+ * window and the level are one for all of them, so a page waiting on its
1347
+ * prompt asks this without naming the permission. With step-up off, every
1348
+ * sign-in is.
1349
+ */
1350
+ signInFresh(signIn: SignInRecord | undefined, roles: readonly string[], delegated: boolean, now?: number, cap?: number): boolean;
1351
+ private freshUnder;
1259
1352
  /**
1260
1353
  * A session's sign-in after a re-authentication (#1525): the new factors
1261
1354
  * join the old, the assessment is redone over all of them, and the sign-in
@@ -1353,11 +1446,28 @@ declare class AuthManager extends BaseManager {
1353
1446
  /** Whether an email link can be a second factor on this site now (#1523): mail and an explicit base-url. */
1354
1447
  emailLinksAvailable(): boolean;
1355
1448
  /**
1356
- * The second factors `username` has enrolled and can use now (#1523). Any
1357
- * enrolled factor works; one that is not truly available (no mail transport)
1358
- * is not offered. Empty means the sign-in is one step, as before.
1449
+ * Whether the email link can be a second factor now (#1523): its entry in
1450
+ * `ngdpbase.auth.factors` (`magic-link`, or its alias `email-link`) listed
1451
+ * and enabled, mail, and an explicit base-url.
1452
+ */
1453
+ emailSecondFactorAvailable(): boolean;
1454
+ /**
1455
+ * The second factors that may follow `first`, in the order they are offered
1456
+ * (#1523; Q2, operator 2026-10-31): every enabled entry of
1457
+ * `ngdpbase.auth.factors` other than the one the sign-in started with, whose
1458
+ * level is known (its provider registered, or the email link). Those that,
1459
+ * with the first step, reach `requiredAal` come first; then by `preference`,
1460
+ * lower first, an entry with none last. Entry ids.
1461
+ */
1462
+ secondFactorOrder(first: Pick<AuthenticateResult, 'provider' | 'factors'>, requiredAal: number): string[];
1463
+ /**
1464
+ * The second factors `username` has enrolled and can use now (#1523), in
1465
+ * `secondFactorOrder` after the pending sign-in's first step; without one,
1466
+ * by `preference`. Only what the second step can run is offered — today the
1467
+ * email link — and one that is not truly available (no mail transport) is
1468
+ * not. Empty means the sign-in is one step, as before.
1359
1469
  */
1360
- secondFactorsFor(username: string): AvailableSecondFactor[];
1470
+ secondFactorsFor(username: string, signIn?: Pick<PendingSignIn, 'first' | 'requiredAal'>): AvailableSecondFactor[];
1361
1471
  /**
1362
1472
  * Whether a successful first step needs a second (#1532, operator
1363
1473
  * 2026-10-22): everyone who arrives with only a password behind them — a