@jskit-ai/agent-docs 0.1.316 → 0.1.318

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 (28) hide show
  1. package/guide/agent/app-setup/authentication.md +141 -3
  2. package/package.json +1 -1
  3. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  4. package/patterns/minimal-foundation/example/package.json +3 -3
  5. package/patterns/shell-foundation/example/package.json +4 -4
  6. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  7. package/reference/autogen/PATTERN_INDEX.md +38 -38
  8. package/reference/autogen/packages/auth-core.md +45 -1
  9. package/reference/autogen/packages/auth-provider-local-core.md +57 -6
  10. package/reference/autogen/packages/auth-provider-local-db-core.md +25 -9
  11. package/reference/autogen/packages/auth-provider-oidc-core.md +1 -1
  12. package/reference/autogen/packages/auth-web.md +58 -0
  13. package/reference/autogen/packages/kernel.md +1 -0
  14. package/skills/jskit/references/pattern-index.md +38 -38
  15. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +3 -3
  16. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +4 -4
  17. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  18. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
  19. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  20. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  21. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +4 -4
  22. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
  23. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
  24. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
  25. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  26. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  27. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  28. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
@@ -34,6 +34,16 @@ Exports
34
34
  Exports
35
35
  - `createAuthActions({ authService })`
36
36
 
37
+ ### `src/server/actions/secondFactorActions.js`
38
+ Exports
39
+ - `ACTION_CONFIRM_SECOND_FACTOR_SETUP`
40
+ - `ACTION_READ_SECOND_FACTOR`
41
+ - `ACTION_REMOVE_SECOND_FACTOR`
42
+ - `ACTION_REPLACE_SECOND_FACTOR_RECOVERY_CODES`
43
+ - `ACTION_START_SECOND_FACTOR_SETUP`
44
+ - `ACTION_VERIFY_SECOND_FACTOR`
45
+ - `createSecondFactorActions({ authService })`
46
+
37
47
  ### `src/server/authAccess.js`
38
48
  Exports
39
49
  - `createAuthAccess()`
@@ -209,6 +219,12 @@ Exports
209
219
  Exports
210
220
  - `AuthPolicyProvider`
211
221
 
222
+ ### `src/server/secondFactor.js`
223
+ Exports
224
+ - `isSecondFactorMet(secondFactorAt, requirement, now)`
225
+ - `requireSecondFactor(request, requirement)`
226
+ - `secondFactorRequiredParams(requirement)`
227
+
212
228
  ### `src/server/types.js`
213
229
  Exports
214
230
  - `type AuthAccess`
@@ -220,6 +236,11 @@ Exports
220
236
  - `type AuthProfileProjector`
221
237
  - `type AuthInvitationContextResolver`
222
238
  - `type AuthRealtimePolicy`
239
+ - `type AuthSecondFactorProof`
240
+ - `type AuthSecondFactorStatus`
241
+ - `type AuthSecondFactorVerification`
242
+ - `type AuthSecondFactorRecoveryCodes`
243
+ - `type AuthSecondFactorSetup`
223
244
  - `type AuthLogoutResult`
224
245
  - `type AuthService`
225
246
 
@@ -233,6 +254,7 @@ Exports
233
254
  ### `src/server/utils.js`
234
255
  Exports
235
256
  - `hostOnlyCookieName(name, secure)`
257
+ - `resolveAuthCookieSameSite(env)`
236
258
  - `normalizeEmail(value)`
237
259
  - `normalizeOAuthIntent(value, { fallback = "login" } = {})`
238
260
  - `normalizeReturnToPath(value, { fallback = "/", allowedOrigins = [] } = {})`
@@ -330,10 +352,15 @@ Exports
330
352
  - `AUTH_PATHS`
331
353
  - `buildAuthOauthStartPath(provider)`
332
354
 
355
+ ### `src/shared/authSecondFactor.js`
356
+ Exports
357
+ - `SECOND_FACTOR_REQUIRED`
358
+ - `isSecondFactorRequired(error)`
359
+
333
360
  ### `src/shared/authSecurityStatus.js`
334
361
  Exports
335
362
  - `normalizeAuthSecurityStatus(value = {})`
336
- - `buildSecurityStatusFromAuthMethodsStatus(authMethodsStatus, { actions = {} } = {})`
363
+ - `buildSecurityStatusFromAuthMethodsStatus(authMethodsStatus, { actions = {}, mfa } = {})`
337
364
  Local functions
338
365
  - `normalizeBoolean(value, fallback = false)`
339
366
  - `countEnabledMethods(methods)`
@@ -468,6 +495,15 @@ Exports
468
495
  - `AUTH_REGISTER_CONFIRM_MESSAGES`
469
496
  - `authRegisterConfirmCommand`
470
497
 
498
+ ### `src/shared/commands/authSecondFactorCommands.js`
499
+ Exports
500
+ - `authSecondFactorReadCommand`
501
+ - `authSecondFactorRecoveryCodesReplaceCommand`
502
+ - `authSecondFactorRemoveCommand`
503
+ - `authSecondFactorSetupConfirmCommand`
504
+ - `authSecondFactorSetupStartCommand`
505
+ - `authSecondFactorVerifyCommand`
506
+
471
507
  ### `src/shared/commands/authSessionReadCommand.js`
472
508
  Exports
473
509
  - `sessionOutputValidator`
@@ -491,6 +527,12 @@ Exports
491
527
  - `authPasswordResetCommand`
492
528
  - `authLogoutCommand`
493
529
  - `authSessionReadCommand`
530
+ - `authSecondFactorReadCommand`
531
+ - `authSecondFactorRecoveryCodesReplaceCommand`
532
+ - `authSecondFactorRemoveCommand`
533
+ - `authSecondFactorSetupConfirmCommand`
534
+ - `authSecondFactorSetupStartCommand`
535
+ - `authSecondFactorVerifyCommand`
494
536
 
495
537
  ### `src/shared/index.js`
496
538
  Exports
@@ -503,6 +545,8 @@ Exports
503
545
  - `resolveAuthDeniedLoginMessage`
504
546
  - `AUTH_PATHS`
505
547
  - `buildAuthOauthStartPath`
548
+ - `SECOND_FACTOR_REQUIRED`
549
+ - `isSecondFactorRequired`
506
550
  - `AUTH_PASSWORD_RECOVERY_DELIVERIES`
507
551
  - `AUTH_OPERATION_FEATURES`
508
552
  - `normalizeAuthProviderId`
@@ -50,8 +50,9 @@ Exports
50
50
  Local functions
51
51
  - `resolveStoreDir(env, appRoot)`
52
52
  - `resolveSessionSecret(env, { storeDir, isProduction })`
53
+ - `resolveSecondFactorKey(env, { isProduction, sessionSecret })`
53
54
  - `resolveSetupCode(env, { isProduction })`
54
- - `resolveAppPublicUrl(env, { emailRecovery, emailedConfirmation, oauthEnabled })`
55
+ - `resolveAppPublicUrl(env, { emailRecovery, emailedConfirmation, oauthEnabled, productionSecondFactor })`
55
56
  - `resolveRecoveryDelivery(env, { emailRecovery, isProduction })`
56
57
  - `resolveConfirmationDelivery(env, { emailConfirmationSender, isProduction, selfRegistration })`
57
58
  - `resolvePasswordMinLength(env)`
@@ -94,6 +95,7 @@ Exports
94
95
  - `parseOAuthAttempts(content)`
95
96
  - `parseRecovery(content)`
96
97
  - `parseRegistrations(content)`
98
+ - `parseSecondFactors(content)`
97
99
  - `parseSessions(content)`
98
100
  - `parseSignInFailures(content)`
99
101
  - `parseUsers(content)`
@@ -101,6 +103,7 @@ Exports
101
103
  - `serializeOAuthAttempts(attempts)`
102
104
  - `serializeRecovery(records)`
103
105
  - `serializeRegistrations(records)`
106
+ - `serializeSecondFactors(records)`
104
107
  - `serializeSessions(sessions)`
105
108
  - `serializeSignInFailures(records)`
106
109
  - `serializeUsers(users)`
@@ -129,6 +132,7 @@ Exports
129
132
  - `createLoggedConfirmationSender`
130
133
  - `createLoggedRecoverySender`
131
134
  - `createLocalFileBackend`
135
+ - `createLoggedSecondFactorEvents`
132
136
  - `SETUP_CODE_ENV`
133
137
  - `SETUP_CODE_FILE`
134
138
  - `createFirstAccountSetup`
@@ -179,23 +183,52 @@ Local functions
179
183
  - `logNonBlockingHookFailure({ logger, hook, error })`
180
184
  - `runRegisterHook({ hook, result, logger })`
181
185
 
186
+ ### `src/server/lib/secondFactor.js`
187
+ Exports
188
+ - `createLocalSecondFactor({ backend, config, logger, secondFactorEvents, sessions })`
189
+ - `createLoggedSecondFactorEvents(logger)`
190
+ Local functions
191
+ - `secondFactorError(refusal)`
192
+ - `secondFactorLockedError(waitMs)`
193
+ - `readProof(input)`
194
+
195
+ ### `src/server/lib/secondFactorCrypto.js`
196
+ Exports
197
+ - `__testables`
198
+ - `buildOtpauthUrl({ secret, issuer, accountName })`
199
+ - `deriveSecondFactorKeys(secondFactorKey)`
200
+ - `findRecoveryCodeHash(hashes, hash)`
201
+ - `hashRecoveryCode(keys, userId, code)`
202
+ - `matchCodeStep(secret, code, nowMs)`
203
+ - `newAuthenticatorSecret()`
204
+ - `newRecoveryCode()`
205
+ - `normalizeAuthenticatorCode(value)`
206
+ - `normalizeRecoveryCode(value)`
207
+ - `openSecret(keys, userId, sealed)`
208
+ - `sealSecret(keys, userId, secret)`
209
+ Local functions
210
+ - `toBase32(bytes)`
211
+ - `fromBase32(text)`
212
+ - `stepAt(nowMs)`
213
+ - `totpCodeAt(secret, step)`
214
+
182
215
  ### `src/server/lib/securityStatus.js`
183
216
  Exports
184
217
  - `createLocalSecurityStatus({ backend, config, oauthProvidersById, sessions })`
185
218
 
186
219
  ### `src/server/lib/service.js`
187
220
  Exports
188
- - `createLocalAuthService({ backend, config, confirmationMode = confirmEveryRegistrationByLink, confirmationSender, firstAccountSetup: givenFirstAccountSetup = null, invitationContextResolver, logger, passwordStrategy, profileProjector, recoverySender })`
221
+ - `createLocalAuthService({ backend, config, confirmationMode = confirmEveryRegistrationByLink, confirmationSender, firstAccountSetup: givenFirstAccountSetup = null, invitationContextResolver, logger, passwordStrategy, profileProjector, recoverySender, secondFactorEvents })`
189
222
 
190
223
  ### `src/server/lib/sessions.js`
191
224
  Exports
192
- - `cookieOptions(isProduction, maxAge)`
225
+ - `cookieOptions({ isProduction, cookieSameSite }, maxAge)`
193
226
  - `createLocalSessions({ appProfileProjection, backend, config, profileProjector })`
194
227
  - `safeRequestCookies(request)`
195
228
  Local functions
196
229
  - `nowSeconds()`
197
230
  - `unauthenticatedAuthResult(clearSession = false)`
198
- - `clearCookieOptions(isProduction)`
231
+ - `clearCookieOptions(config)`
199
232
  - `buildAccessToken({ user, session, secret, ttlSeconds = ACCESS_TTL_SECONDS })`
200
233
  - `buildSessionPayload({ user, session, refreshToken, secret })`
201
234
 
@@ -203,10 +236,12 @@ Local functions
203
236
  Exports
204
237
  - `DEFAULT_SIGN_IN_THROTTLE`
205
238
  - `forgottenFailuresBefore(now)`
239
+ - `nextFailures(throttle, record, now)`
206
240
  - `recordSignInFailure(throttle, record, email, now)`
207
241
  - `resolveSignInThrottle(env)`
208
242
  - `signInLockedError(waitMs)`
209
243
  - `signInWaitMs(record, now)`
244
+ - `waitParams(waitMs)`
210
245
  Local functions
211
246
  - `readSetting(env, name, fallback)`
212
247
 
@@ -231,6 +266,9 @@ Exports
231
266
  Exports
232
267
  - `type AuthLocalBackendTransaction`
233
268
  - `type AuthLocalRegistration`
269
+ - `type AuthLocalSecondFactor`
270
+ - `type AuthLocalSecondFactorEvent`
271
+ - `type AuthLocalSecondFactorEvents`
234
272
  - `type AuthLocalSignInFailures`
235
273
  - `type AuthLocalBackend`
236
274
  - `type AuthLocalPasswordStrategy`
@@ -261,14 +299,27 @@ Exports
261
299
  - `APP_URL`
262
300
  - `ATTEMPT_COOKIE`
263
301
  - `approveAtProvider(service, { provider = "google", returnTo = "/home", cookies = {}, link = false } = {})`
264
- - `createService({ backend, oauthProviders, profileProjector, firstAccountSetup })`
302
+ - `createService({ backend, oauthProviders, profileProjector, firstAccountSetup, env = {} })`
265
303
  - `oidcProviderEntry(issuer, { id = "google", label = "Google" } = {})`
266
304
  - `sessionCookies(session)`
267
305
  - `startFakeGitHub({ user = { id: 4242, login: "ada", name: "Ada Lovelace" }, emails } = {})`
268
- - `startOidcProvider({ account } = {})`
306
+ - `startOidcProvider({ account, appUrl = APP_URL, consentPage = false } = {})`
269
307
  Local functions
270
308
  - `readBody(req)`
271
309
 
310
+ ### `test-support/secondFactorScenario.js`
311
+ Exports
312
+ - `SCENARIO_START`
313
+ - `SECOND_FACTOR_KEY`
314
+ - `codeAt(secret, offset = 0)`
315
+ - `exerciseSecondFactor(t, { service, events, storedText })`
316
+ - `secondFactorServiceOptions({ env = {} } = {})`
317
+ Local functions
318
+ - `lockedFor(seconds)`
319
+ - `now()`
320
+ - `wrongCode(secret)`
321
+ - `signIn(service, email)`
322
+
272
323
  ### `test-support/signInThrottleScenario.js`
273
324
  Exports
274
325
  - `exerciseSignInThrottle(t, service)`
@@ -27,10 +27,6 @@ Exports
27
27
  - `createLocalDbOwners({ resources, identities, context })`
28
28
  - `type LocalAuthHandles`
29
29
  Local functions
30
- - `requiredDateTime(value, fallback = nowIso())`
31
- - `optionalDateTime(value)`
32
- - `readDateTime(value, fallback = "")`
33
- - `text(value)`
34
30
  - `requireSessionConditions(onlyIf)`
35
31
  - `requireIdPrefix(idPrefix)`
36
32
  - `readPassword(record)`
@@ -46,11 +42,6 @@ Local functions
46
42
  - `sessionRecord(input = {})`
47
43
  - `recoveryRecord(input = {})`
48
44
  - `oauthAttemptRecord(input = {})`
49
- - `findOne(handle, field, value, options)`
50
- - `findById(handle, id, options)`
51
- - `deleteById(handle, id, options)`
52
- - `replaceFailures(failures, email, attributes, options)`
53
- - `patchExisting(handle, id, changes, options)`
54
45
  - `userRecords(users, options)`
55
46
  - `sessionRecords(sessions, options)`
56
47
  - `recoveryRecords(recovery, options)`
@@ -80,11 +71,32 @@ Exports
80
71
  - `localAuthOAuthAttemptResource`
81
72
  - `localAuthRecoveryResource`
82
73
  - `localAuthRegistrationResource`
74
+ - `localAuthSecondFactorResource`
83
75
  - `localAuthSessionResource`
84
76
  - `localAuthSignInFailureResource`
85
77
  - `localAuthUserResource`
86
78
  Local functions
87
79
  - `idStartsWith(query, prefix, { column })`
80
+ - `hasSecondFactorAt(query, _proved, { column })`
81
+
82
+ ### `src/server/lib/secondFactorRecords.js`
83
+ Exports
84
+ - `secondFactorRecords(secondFactors, options)`
85
+ Local functions
86
+ - `mapSecondFactor(record)`
87
+ - `secondFactorRecord(input = {})`
88
+
89
+ ### `src/server/lib/tableRecords.js`
90
+ Exports
91
+ - `deleteById(handle, id, options)`
92
+ - `findById(handle, id, options)`
93
+ - `findOne(handle, field, value, options)`
94
+ - `optionalDateTime(value)`
95
+ - `patchExisting(handle, id, changes, options)`
96
+ - `readDateTime(value, fallback = "")`
97
+ - `replaceById(handle, id, attributes, options)`
98
+ - `requiredDateTime(value, fallback = nowIso())`
99
+ - `text(value)`
88
100
 
89
101
  ### `src/server/providers/AuthLocalDatabaseBackendProvider.js`
90
102
  Exports
@@ -115,3 +127,7 @@ Exports
115
127
  ### `migrations/auth_local_db_users_email_verified.cjs`
116
128
  Exports
117
129
  - None
130
+
131
+ ### `migrations/auth_local_db_users_second_factors.cjs`
132
+ Exports
133
+ - None
@@ -151,4 +151,4 @@ Exports
151
151
  - `ACCOUNT`
152
152
  - `REGISTRATION_TOKEN`
153
153
  - `followAuthorization(url, { redirectPrefix })`
154
- - `startMockIssuer({ blocked = false, account = ACCOUNT, staticClients = [] } = {})`
154
+ - `startMockIssuer({ blocked = false, account = ACCOUNT, staticClients = [], consentPage = false } = {})`
@@ -16,6 +16,7 @@ Use this on demand; do not load the full index at startup.
16
16
 
17
17
  ### `src/client/browser.js`
18
18
  Exports
19
+ - `pageClipboard()`
19
20
  - `pageDocument()`
20
21
  - `pageLocation()`
21
22
  - `pageWindow()`
@@ -89,6 +90,18 @@ Exports
89
90
  Local functions
90
91
  - `validationFieldMessages(validationResult)`
91
92
 
93
+ ### `src/client/composables/secondFactor/useSecondFactorProof.js`
94
+ Exports
95
+ - `useSecondFactorProof({ submit, onDone })`
96
+
97
+ ### `src/client/composables/secondFactor/useSecondFactorSettings.js`
98
+ Exports
99
+ - `useSecondFactorSettings()`
100
+
101
+ ### `src/client/composables/secondFactor/useSecondFactorStepUp.js`
102
+ Exports
103
+ - `useSecondFactorStepUp()`
104
+
92
105
  ### `src/client/composables/useDefaultResetPasswordView.js`
93
106
  Exports
94
107
  - `useDefaultResetPasswordView()`
@@ -112,6 +125,7 @@ Exports
112
125
  - `DefaultResetPasswordView`
113
126
  - `AuthProfileWidget`
114
127
  - `AuthProfileMenuLinkItem`
128
+ - `useSecondFactorStepUp`
115
129
  - `useAuthStore`
116
130
  - `useAuthGuardRuntime`
117
131
  - `completeOAuthPopupSignIn`
@@ -129,6 +143,10 @@ Local functions
129
143
  - `resolvePathnameFromLinkTarget(target = "")`
130
144
  - `resolveFallbackReturnTo({ currentFullPath = "", currentPath = "", currentHref = "", absolute = false } = {})`
131
145
 
146
+ ### `src/client/lib/qrCode.js`
147
+ Exports
148
+ - `qrCodePath(text)`
149
+
132
150
  ### `src/client/lib/returnToPath.js`
133
151
  Exports
134
152
  - `normalizeAuthReturnToPath(value, fallback = "/", { allowedOrigins = [] } = {})`
@@ -237,6 +255,15 @@ Local functions
237
255
  - `openChannel(win)`
238
256
  - `sameOriginOpener(win)`
239
257
 
258
+ ### `src/client/runtime/secondFactorRequests.js`
259
+ Exports
260
+ - `confirmSecondFactorSetup(proof)`
261
+ - `readSecondFactor()`
262
+ - `removeSecondFactor(proof)`
263
+ - `replaceSecondFactorRecoveryCodes(proof)`
264
+ - `startSecondFactorSetup()`
265
+ - `verifySecondFactor(proof)`
266
+
240
267
  ### `src/client/runtime/useLoginView.js`
241
268
  Exports
242
269
  - `useLoginView()`
@@ -271,6 +298,11 @@ Exports
271
298
  - `type AuthMobile`
272
299
  - `type AuthErrorRuntime`
273
300
  - `type AuthRequest`
301
+ - `type SecondFactorProof`
302
+ - `type SecondFactorStatus`
303
+ - `type SecondFactorSetup`
304
+ - `type SecondFactorRecoveryCodes`
305
+ - `type SecondFactorStepUp`
274
306
  - `type LoginViewState`
275
307
  - `type LoginViewValidation`
276
308
  - `type AuthClient`
@@ -304,6 +336,27 @@ Exports
304
336
  Exports
305
337
  - None
306
338
 
339
+ ### `src/client/views/SecondFactorDialog.vue`
340
+ Exports
341
+ - None
342
+
343
+ ### `src/client/views/SecondFactorPrompt.vue`
344
+ Exports
345
+ - None
346
+
347
+ ### `src/client/views/SecondFactorProofForm.vue`
348
+ Exports
349
+ - None
350
+
351
+ ### `src/client/views/SecondFactorSettings.vue`
352
+ Exports
353
+ - None
354
+ Local functions
355
+ - `focusStep()`
356
+ - `onRecoveryCodes(result)`
357
+ - `onCodesSaved()`
358
+ - `backToStatus()`
359
+
307
360
  ### `src/server/authRateLimits.js`
308
361
  Exports
309
362
  - `DEFAULT_AUTH_RATE_LIMITS`
@@ -356,6 +409,10 @@ Local functions
356
409
  Exports
357
410
  - `buildRoutes(controller, { includeDevLoginAs = false, rateLimits = DEFAULT_AUTH_RATE_LIMITS } = {})`
358
411
 
412
+ ### `src/server/routes/secondFactorRoutes.js`
413
+ Exports
414
+ - `registerSecondFactorRoutes(router, { rateLimits })`
415
+
359
416
  ### `src/server/services/AuthWebService.js`
360
417
  Exports
361
418
  - `AuthWebService`
@@ -363,6 +420,7 @@ Exports
363
420
  ### `src/server/types.js`
364
421
  Exports
365
422
  - `type AuthWeb`
423
+ - `type AuthRateLimits`
366
424
 
367
425
  ### fixtures
368
426
 
@@ -851,6 +851,7 @@ Local functions
851
851
  - `normalizePath(pathname)`
852
852
  - `normalizeRouteMiddleware(value, routeLabel)`
853
853
  - `normalizeRouteConfig(value, routeLabel)`
854
+ - `normalizeRouteSecondFactor(value, auth, routeLabel)`
854
855
  - `normalizeRouteInternal(value, { method = "", path = "" } = {})`
855
856
  - `normalizeRouteInput(method, path, optionsOrHandler, maybeHandler)`
856
857