@jwilleke/ngdpbase-types 5.39.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.
- package/lib/packages/ngdpbase-types/index.d.ts +1 -1
- package/lib/src/context/ApiContext.d.ts +3 -2
- package/lib/src/context/ApiContext.js +4 -2
- package/lib/src/ice/fileHandling.d.ts +6 -1
- package/lib/src/ice/givenName.d.ts +19 -0
- package/lib/src/ice/runExport.d.ts +41 -0
- package/lib/src/ice/runImport.d.ts +37 -8
- package/lib/src/ice/shims/csv.d.ts +24 -0
- package/lib/src/ice/shims/export.d.ts +23 -0
- package/lib/src/ice/shims/index.d.ts +3 -1
- package/lib/src/ice/shims/svg.d.ts +27 -0
- package/lib/src/ice/shims/takeout.d.ts +83 -0
- package/lib/src/ice/types.d.ts +301 -5
- package/lib/src/ice/vet.d.ts +19 -0
- package/lib/src/managers/AttachmentManager.d.ts +100 -36
- package/lib/src/managers/AuthManager.d.ts +152 -12
- package/lib/src/managers/AuthManager.js +3830 -0
- package/lib/src/managers/BackgroundJobManager.d.ts +25 -0
- package/lib/src/managers/BackupManager.d.ts +24 -0
- package/lib/src/managers/BackupManager.js +48 -1
- package/lib/src/managers/ExportManager.d.ts +16 -0
- package/lib/src/managers/ExportManager.js +25 -0
- package/lib/src/managers/FileManager.d.ts +182 -0
- package/lib/src/managers/ImportManager.d.ts +279 -16
- package/lib/src/managers/MediaManager.d.ts +2 -0
- package/lib/src/managers/PageManager.d.ts +53 -0
- package/lib/src/managers/SearchManager.d.ts +4 -0
- package/lib/src/managers/SharedFolderManager.d.ts +320 -0
- package/lib/src/managers/ValidationManager.d.ts +5 -2
- package/lib/src/middleware/csrf.js +99 -0
- package/lib/src/providers/AgentTokenAuthProvider.js +46 -0
- package/lib/src/providers/AuthentikBearerAuthProvider.js +176 -0
- package/lib/src/providers/BaseCredentialsProvider.js +21 -0
- package/lib/src/providers/BaseMediaProvider.d.ts +4 -0
- package/lib/src/providers/BasePageProvider.d.ts +8 -0
- package/lib/src/providers/CloudflareAccessAuthProvider.js +160 -0
- package/lib/src/providers/FileCredentialsProvider.js +188 -0
- package/lib/src/providers/FileSystemMediaProvider.d.ts +6 -0
- package/lib/src/providers/MagicLinkAuthProvider.js +333 -0
- package/lib/src/providers/OidcAuthProvider.js +350 -0
- package/lib/src/providers/OidcBearerAuthProvider.js +27 -0
- package/lib/src/providers/PasskeyAuthProvider.js +147 -0
- package/lib/src/providers/PasswordAuthProvider.js +44 -0
- package/lib/src/security/PolicyDecisionPoint.d.ts +3 -2
- package/lib/src/security/pageActions.js +43 -0
- package/lib/src/security/permissions.generated.d.ts +7 -3
- package/lib/src/types/File.d.ts +90 -0
- package/lib/src/types/Provider.d.ts +15 -0
- package/lib/src/types/express.d.ts +7 -1
- package/lib/src/types/guards.js +366 -0
- package/lib/src/types/linkedom.d.ts +2 -0
- package/lib/src/utils/atomicWrite.js +129 -0
- package/lib/src/utils/auditEventNames.generated.d.ts +12 -0
- package/lib/src/utils/auditEventNames.generated.js +12 -0
- package/lib/src/utils/auditEvents.d.ts +15 -0
- package/lib/src/utils/auditEvents.js +17 -1
- package/lib/src/utils/bip39English.js +2 -0
- package/lib/src/utils/browserDescription.js +28 -0
- package/lib/src/utils/delegation.js +79 -0
- package/lib/src/utils/deriveUsername.js +38 -0
- package/lib/src/utils/emailForLog.js +28 -0
- package/lib/src/utils/fileMigrationPlan.d.ts +81 -0
- package/lib/src/utils/instanceEnvBackup.d.ts +6 -0
- package/lib/src/utils/instanceEnvBackup.js +13 -0
- package/lib/src/utils/ipLocation.js +106 -0
- package/lib/src/utils/magicLinkDeviceState.js +97 -0
- package/lib/src/utils/pageUrl.d.ts +1 -0
- package/lib/src/utils/passwordHash.js +150 -0
- package/lib/src/utils/permissionCatalog.js +102 -0
- package/lib/src/utils/privateStoreAccess.d.ts +25 -0
- package/lib/src/utils/privateStoreAccess.js +22 -1
- package/lib/src/utils/privateStoreCatalogs.js +57 -0
- package/lib/src/utils/privateStoreCrypto.js +266 -0
- package/lib/src/utils/privateStoreDoor.d.ts +10 -0
- package/lib/src/utils/privateStoreDoor.js +298 -0
- package/lib/src/utils/privateStoreImport.d.ts +0 -10
- package/lib/src/utils/privateStoreMeta.js +123 -0
- package/lib/src/utils/privateStorePath.d.ts +37 -1
- package/lib/src/utils/privateStorePath.js +60 -3
- package/lib/src/utils/privateStoreTakeout.js +149 -0
- package/lib/src/utils/privateStoreUnlock.d.ts +3 -0
- package/lib/src/utils/privateStoreUnlock.js +499 -0
- package/lib/src/utils/recoveryWordsFile.d.ts +54 -0
- package/lib/src/utils/safeRedirect.js +55 -0
- package/lib/src/utils/sessionAccount.js +55 -0
- package/lib/src/utils/sessionEnd.d.ts +1 -0
- package/lib/src/utils/sessionEnd.js +42 -0
- package/lib/src/utils/sessionGeneration.js +29 -0
- package/lib/src/utils/sessionIdle.d.ts +4 -0
- package/lib/src/utils/sessionIdle.js +72 -0
- package/lib/src/utils/sessionLimits.js +72 -0
- package/lib/src/utils/sessionSecurity.js +122 -0
- package/lib/src/utils/shareLockbox.js +101 -0
- package/lib/src/utils/sharedFolderAccess.d.ts +57 -0
- package/lib/src/utils/sharedFolderAccess.js +80 -0
- package/lib/src/utils/userCreateError.js +82 -0
- package/lib/src/utils/username.d.ts +2 -0
- package/lib/src/utils/username.js +105 -0
- package/package.json +2 -1
|
@@ -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
|
-
|
|
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;
|
|
@@ -441,8 +450,59 @@ export interface SignInRecord extends Assurance {
|
|
|
441
450
|
/** When the sign-in completed, RFC 3339. */
|
|
442
451
|
at: string;
|
|
443
452
|
}
|
|
444
|
-
/**
|
|
445
|
-
|
|
453
|
+
/**
|
|
454
|
+
* How a refused request wants its answer: a page to redirect, JSON, or plain
|
|
455
|
+
* text (#1745). `download` is a GET that answers with a file: refused like a
|
|
456
|
+
* page, but returned to the page that linked it, since going back to the file
|
|
457
|
+
* itself saves it and leaves the browser on the prompt (#2145).
|
|
458
|
+
*/
|
|
459
|
+
export type ReauthMode = 'json' | 'page' | 'text' | 'download';
|
|
460
|
+
/** Whether a refusal in `mode` is answered by sending the browser to a page: a page, or a file a page links to (#2145). */
|
|
461
|
+
export declare function answeredWithPage(mode: ReauthMode): boolean;
|
|
462
|
+
/**
|
|
463
|
+
* A step-up asked for and not yet given, kept on the session (#2145): which
|
|
464
|
+
* permission it was for, where the prompt returns, and whether going there
|
|
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.
|
|
467
|
+
*/
|
|
468
|
+
export interface PendingStepUp {
|
|
469
|
+
permission: string;
|
|
470
|
+
next: string;
|
|
471
|
+
replays: boolean;
|
|
472
|
+
/** The kept form POST the confirmation releases (#2154). */
|
|
473
|
+
replay?: string;
|
|
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;
|
|
446
506
|
/** The step-up answer (#1525, #1635), for the caller to send in its own form. */
|
|
447
507
|
export interface FreshSignInAnswer {
|
|
448
508
|
/** The refused permission. */
|
|
@@ -457,8 +517,8 @@ export interface FreshSignInAnswer {
|
|
|
457
517
|
/**
|
|
458
518
|
* Where to return after re-authenticating: this page for a page GET, and the
|
|
459
519
|
* page the person was on for anything else — a POST (the form is filled in
|
|
460
|
-
* again; a POST body is not replayed)
|
|
461
|
-
* Always a path on this site.
|
|
520
|
+
* again; a POST body is not replayed), a script's request for data (#1738) or
|
|
521
|
+
* a file download (#2145). Always a path on this site.
|
|
462
522
|
*/
|
|
463
523
|
export declare function reauthReturnTo(req: Request, mode?: ReauthMode): string;
|
|
464
524
|
/**
|
|
@@ -513,6 +573,12 @@ declare class AuthManager extends BaseManager {
|
|
|
513
573
|
* converted to entries when a site still sets only that (#1523).
|
|
514
574
|
*/
|
|
515
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;
|
|
516
582
|
/**
|
|
517
583
|
* The outside OpenID Connect providers (#1743): one `OidcAuthProvider` per
|
|
518
584
|
* enabled entry of `ngdpbase.auth.oidc.providers`, plus the old
|
|
@@ -1112,14 +1178,63 @@ declare class AuthManager extends BaseManager {
|
|
|
1112
1178
|
* refused outright: it can never give a fresh factor.
|
|
1113
1179
|
*/
|
|
1114
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;
|
|
1115
1189
|
/** Record a step-up event: a prompt, a success or a failure (#1525). */
|
|
1116
1190
|
recordReauth(req: Request, eventType: AuditEventName, result: 'success' | 'failure', permission: string, detail: string): Promise<void>;
|
|
1117
1191
|
/**
|
|
1118
1192
|
* A re-authentication completes (#1525, #1758): the session's sign-in record
|
|
1119
1193
|
* gains the fresh factor, and the success is recorded. The route saves the
|
|
1120
|
-
* session and answers
|
|
1121
|
-
|
|
1122
|
-
|
|
1194
|
+
* session and answers, sending the browser to `next`.
|
|
1195
|
+
*
|
|
1196
|
+
* #2145: when `next` is where the pending prompt returns, the success is
|
|
1197
|
+
* recorded against the permission it was for (otherwise, a prompt opened
|
|
1198
|
+
* directly, against the method), and when going there does not redo the
|
|
1199
|
+
* action (a form POST, a script's request, a download) the page there says
|
|
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.
|
|
1204
|
+
*/
|
|
1205
|
+
completeReauth(req: Request, result: AuthenticateResult, method: string, next: string, prompt?: unknown): Promise<SignInRecord | null>;
|
|
1206
|
+
/**
|
|
1207
|
+
* Whether this request's page says "Confirmed — you can do it now" (#2145):
|
|
1208
|
+
* the first page the browser opens after a re-authentication that could not
|
|
1209
|
+
* redo the action, when it is the page the prompt returned to. Any page
|
|
1210
|
+
* opened clears it, so it is said once.
|
|
1211
|
+
*/
|
|
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>;
|
|
1123
1238
|
/**
|
|
1124
1239
|
* The one sign-in completion step (#1758): every way a person finishes
|
|
1125
1240
|
* signing in — a password, a passkey, a second factor, an email link, an
|
|
@@ -1226,6 +1341,14 @@ declare class AuthManager extends BaseManager {
|
|
|
1226
1341
|
* never satisfies step-up.
|
|
1227
1342
|
*/
|
|
1228
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;
|
|
1229
1352
|
/**
|
|
1230
1353
|
* A session's sign-in after a re-authentication (#1525): the new factors
|
|
1231
1354
|
* join the old, the assessment is redone over all of them, and the sign-in
|
|
@@ -1323,11 +1446,28 @@ declare class AuthManager extends BaseManager {
|
|
|
1323
1446
|
/** Whether an email link can be a second factor on this site now (#1523): mail and an explicit base-url. */
|
|
1324
1447
|
emailLinksAvailable(): boolean;
|
|
1325
1448
|
/**
|
|
1326
|
-
*
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
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.
|
|
1329
1469
|
*/
|
|
1330
|
-
secondFactorsFor(username: string): AvailableSecondFactor[];
|
|
1470
|
+
secondFactorsFor(username: string, signIn?: Pick<PendingSignIn, 'first' | 'requiredAal'>): AvailableSecondFactor[];
|
|
1331
1471
|
/**
|
|
1332
1472
|
* Whether a successful first step needs a second (#1532, operator
|
|
1333
1473
|
* 2026-10-22): everyone who arrives with only a password behind them — a
|