@aooth/auth-moost 0.1.21 → 0.1.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aooth/auth-moost",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "Moost auth integration for aoothjs — AuthGuard interceptor, useAuth composable, REST endpoints, workflows",
5
5
  "keywords": [
6
6
  "aoothjs",
@@ -57,18 +57,18 @@
57
57
  "access": "public"
58
58
  },
59
59
  "dependencies": {
60
- "@atscript/moost-wf": "^0.1.100",
60
+ "@atscript/moost-wf": "^0.1.101",
61
61
  "@wooksjs/http-body": "^0.7.19",
62
- "@aooth/arbac-moost": "^0.1.21",
63
- "@aooth/auth": "0.1.21",
64
- "@aooth/idp": "0.1.21",
65
- "@aooth/user": "0.1.21"
62
+ "@aooth/arbac-moost": "^0.1.23",
63
+ "@aooth/idp": "0.1.23",
64
+ "@aooth/auth": "0.1.23",
65
+ "@aooth/user": "0.1.23"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@atscript/core": "^0.1.76",
69
69
  "@atscript/typescript": "^0.1.76",
70
- "@atscript/ui": "^0.1.100",
71
- "@atscript/ui-fns": "^0.1.100",
70
+ "@atscript/ui": "^0.1.101",
71
+ "@atscript/ui-fns": "^0.1.101",
72
72
  "@moostjs/event-http": "^0.6.27",
73
73
  "@moostjs/event-wf": "^0.6.27",
74
74
  "moost": "^0.6.27",
@@ -76,7 +76,7 @@
76
76
  "wooks": "^0.7.19"
77
77
  },
78
78
  "peerDependencies": {
79
- "@atscript/moost-wf": "^0.1.100",
79
+ "@atscript/moost-wf": "^0.1.101",
80
80
  "@atscript/typescript": "^0.1.76",
81
81
  "@moostjs/event-http": "^0.6.27",
82
82
  "@moostjs/event-wf": "^0.6.27",
@@ -369,9 +369,13 @@ export interface InviteForm {
369
369
  @meta.description 'Pick how you would like to verify your identity.'
370
370
  @wf.context.pass 'public'
371
371
  export interface Select2faForm {
372
+ // sms/email options append the masked destination ("Email (ma•••@x.com)")
373
+ // so picking a method doubles as informed consent for the code dispatch —
374
+ // the user sees WHERE the code goes before it is sent (totp `masked` is
375
+ // always the empty string, so authenticator entries render bare).
372
376
  @ui.form.order 10
373
377
  @ui.form.type 'radio'
374
- @ui.form.fn.options '(_, _d, ctx) => Array.isArray(ctx.public?.mfa?.enrolledMethods) ? ctx.public.mfa.enrolledMethods.map(m => ({ key: m.methodName, label: m.kind === "totp" ? "TOTP (Authenticator app)" : m.kind === "email" ? "Email" : m.kind === "sms" ? "SMS" : m.kind })) : []'
378
+ @ui.form.fn.options '(_, _d, ctx) => Array.isArray(ctx.public?.mfa?.enrolledMethods) ? ctx.public.mfa.enrolledMethods.map(m => ({ key: m.methodName, label: (m.kind === "totp" ? "TOTP (Authenticator app)" : m.kind === "email" ? "Email" : m.kind === "sms" ? "SMS" : m.kind) + (m.masked && (m.kind === "email" || m.kind === "sms") ? " (" + m.masked + ")" : "") })) : []'
375
379
  @meta.label 'MFA method'
376
380
  @meta.required
377
381
  methodName: string
@@ -668,6 +672,10 @@ export interface EnrollTotpQrForm {
668
672
  * - **Change / Remove** options come from `ctx.public.mfa.enrolledMethods`,
669
673
  * with any transport in `ctx.public.manage.locked` omitted (a handle-bound
670
674
  * factor the consumer forbids changing here — `lockedNote` explains why).
675
+ * - **Remove** options are also omitted when `ctx.public.manage.removeBlocked`
676
+ * — the last confirmed factor under a `required` policy can never be
677
+ * removed, so offering the operation would dead-end on a guard error
678
+ * (`requiredNote` explains; Change stays available).
671
679
  *
672
680
  * A zero-MFA user never sees this form — the flow routes straight to the
673
681
  * enrol picker (first-time opt-in).
@@ -682,9 +690,14 @@ export interface ManageMfaForm {
682
690
  @ui.form.fn.hidden '(_, _d, ctx) => (ctx.public?.manage?.locked?.length ?? 0) === 0'
683
691
  lockedNote: ui.paragraph
684
692
 
693
+ @ui.form.order 6
694
+ @ui.form.fn.value '(_, _d, ctx) => ctx.public?.manage?.removeBlocked ? "Two-factor authentication is required for your account, so your last method can be changed but not removed." : ""'
695
+ @ui.form.fn.hidden '(_, _d, ctx) => !ctx.public?.manage?.removeBlocked'
696
+ requiredNote: ui.paragraph
697
+
685
698
  @ui.form.order 10
686
699
  @ui.form.type 'radio'
687
- @ui.form.fn.options '(_, _d, ctx) => { const lbl = (t) => t === "totp" ? "authenticator app" : t === "sms" ? "SMS" : t === "email" ? "email" : t; const locked = ctx.public?.manage?.locked ?? []; const out = []; for (const t of (ctx.public?.manage?.candidates ?? [])) out.push({ key: "add:" + t, label: "Add " + lbl(t) }); for (const m of (ctx.public?.mfa?.enrolledMethods ?? [])) { if (locked.includes(m.kind)) continue; out.push({ key: "replace:" + m.kind, label: "Change " + lbl(m.kind) + (m.masked ? " (" + m.masked + ")" : "") }); out.push({ key: "remove:" + m.kind, label: "Remove " + lbl(m.kind) }); } return out; }'
700
+ @ui.form.fn.options '(_, _d, ctx) => { const lbl = (t) => t === "totp" ? "authenticator app" : t === "sms" ? "SMS" : t === "email" ? "email" : t; const locked = ctx.public?.manage?.locked ?? []; const out = []; for (const t of (ctx.public?.manage?.candidates ?? [])) out.push({ key: "add:" + t, label: "Add " + lbl(t) }); for (const m of (ctx.public?.mfa?.enrolledMethods ?? [])) { if (locked.includes(m.kind)) continue; out.push({ key: "replace:" + m.kind, label: "Change " + lbl(m.kind) + (m.masked ? " (" + m.masked + ")" : "") }); if (!ctx.public?.manage?.removeBlocked) out.push({ key: "remove:" + m.kind, label: "Remove " + lbl(m.kind) }); } return out; }'
688
701
  @meta.label 'What would you like to do?'
689
702
  @meta.required
690
703
  operation: string
@@ -745,6 +758,36 @@ export interface PasswordReauthForm {
745
758
  cancel?: ui.action
746
759
  }
747
760
 
761
+ /**
762
+ * Manage-MFA step-up consent — the `manage-stepup-confirm` pause shown BEFORE
763
+ * the step-up pincode dispatch, so opening the manage dialog never emails /
764
+ * texts the user as a side effect (a user who opened it by mistake closes it
765
+ * with zero codes consumed). Fieldless apart from the notice: the primary
766
+ * submit ('Continue') consents and the SAME engine pass mints + sends the
767
+ * code; `useDifferentMethod` re-opens the factor picker (`select-2fa`, whose
768
+ * masked-destination options make the pick itself the consent); the hidden
769
+ * `cancel` aborts with nothing dispatched. Not rendered for TOTP step-up
770
+ * (nothing to send) or when `resolveStepUpConfirmBeforeSend` opts out.
771
+ */
772
+ @meta.label 'Verify your identity'
773
+ @wf.context.pass 'public'
774
+ @ui.form.submit.text 'Continue'
775
+ export interface StepUpConfirmForm {
776
+ @ui.form.order 1
777
+ @ui.form.fn.value '(_, _d, ctx) => { const kind = ctx.public?.mfa?.method; const m = (ctx.public?.mfa?.enrolledMethods ?? []).find(e => e.kind === kind); const to = m && m.masked ? " to " + m.masked : kind === "sms" ? " to your phone" : " to your email"; return "To continue, we will send a verification code" + to + "."; }'
778
+ notice: ui.paragraph
779
+
780
+ @ui.form.action 'useDifferentMethod', 'Use a different method'
781
+ @ui.form.fn.hidden '(_, _d, ctx) => (ctx.public?.mfa?.methodCount ?? 0) < 2'
782
+ useDifferentMethod?: ui.action
783
+
784
+ // Hidden built-in cancel — host renders its own and fires `cancel` on
785
+ // abandon (so the durable wf-state row is cleaned, not left to expire).
786
+ @ui.form.action 'cancel', 'Cancel'
787
+ @ui.form.fn.hidden '() => true'
788
+ cancel?: ui.action
789
+ }
790
+
748
791
  /**
749
792
  * Standalone consent-bump prompt. Fires for returning users with pending
750
793
  * consents (set by `prepare-consents` from `ConsentStore.getPendingConsents`)
@@ -154,7 +154,7 @@ export declare class Select2faForm {
154
154
 
155
155
  /**
156
156
  * Atscript interface **PincodeForm**
157
- * @see {@link ./forms.as:417:18}
157
+ * @see {@link ./forms.as:421:18}
158
158
  */
159
159
  export declare class PincodeForm {
160
160
  // transportHint: ui.paragraph
@@ -175,7 +175,7 @@ export declare class PincodeForm {
175
175
 
176
176
  /**
177
177
  * Atscript interface **AskEmailForm**
178
- * @see {@link ./forms.as:456:18}
178
+ * @see {@link ./forms.as:460:18}
179
179
  */
180
180
  export declare class AskEmailForm extends WithInlineConsentForm {
181
181
  // disclosure: ui.paragraph
@@ -192,7 +192,7 @@ export declare class AskEmailForm extends WithInlineConsentForm {
192
192
 
193
193
  /**
194
194
  * Atscript interface **AskPhoneForm**
195
- * @see {@link ./forms.as:486:18}
195
+ * @see {@link ./forms.as:490:18}
196
196
  */
197
197
  export declare class AskPhoneForm extends WithInlineConsentForm {
198
198
  // disclosure: ui.paragraph
@@ -209,7 +209,7 @@ export declare class AskPhoneForm extends WithInlineConsentForm {
209
209
 
210
210
  /**
211
211
  * Atscript interface **EnrollPickMethodForm**
212
- * @see {@link ./forms.as:510:18}
212
+ * @see {@link ./forms.as:514:18}
213
213
  */
214
214
  export declare class EnrollPickMethodForm {
215
215
  method: string
@@ -227,7 +227,7 @@ export declare class EnrollPickMethodForm {
227
227
 
228
228
  /**
229
229
  * Atscript interface **EnrollAddressForm**
230
- * @see {@link ./forms.as:544:18}
230
+ * @see {@link ./forms.as:548:18}
231
231
  */
232
232
  export declare class EnrollAddressForm {
233
233
  address: string
@@ -246,7 +246,7 @@ export declare class EnrollAddressForm {
246
246
 
247
247
  /**
248
248
  * Atscript interface **EnrollConfirmForm**
249
- * @see {@link ./forms.as:590:18}
249
+ * @see {@link ./forms.as:594:18}
250
250
  */
251
251
  export declare class EnrollConfirmForm {
252
252
  // transportHint: ui.paragraph
@@ -267,7 +267,7 @@ export declare class EnrollConfirmForm {
267
267
 
268
268
  /**
269
269
  * Atscript interface **EnrollTotpQrForm**
270
- * @see {@link ./forms.as:640:18}
270
+ * @see {@link ./forms.as:644:18}
271
271
  */
272
272
  export declare class EnrollTotpQrForm {
273
273
  // qrCode: ui.paragraph
@@ -286,10 +286,11 @@ export declare class EnrollTotpQrForm {
286
286
 
287
287
  /**
288
288
  * Atscript interface **ManageMfaForm**
289
- * @see {@link ./forms.as:679:18}
289
+ * @see {@link ./forms.as:687:18}
290
290
  */
291
291
  export declare class ManageMfaForm {
292
292
  // lockedNote: ui.paragraph
293
+ // requiredNote: ui.paragraph
293
294
  operation: string
294
295
  // cancel: ui.action
295
296
  static __is_atscript_annotated_type: true
@@ -304,7 +305,7 @@ export declare class ManageMfaForm {
304
305
 
305
306
  /**
306
307
  * Atscript interface **RemoveMfaConfirmForm**
307
- * @see {@link ./forms.as:708:18}
308
+ * @see {@link ./forms.as:721:18}
308
309
  */
309
310
  export declare class RemoveMfaConfirmForm {
310
311
  // notice: ui.paragraph
@@ -321,7 +322,7 @@ export declare class RemoveMfaConfirmForm {
321
322
 
322
323
  /**
323
324
  * Atscript interface **PasswordReauthForm**
324
- * @see {@link ./forms.as:731:18}
325
+ * @see {@link ./forms.as:744:18}
325
326
  */
326
327
  export declare class PasswordReauthForm {
327
328
  password: string
@@ -336,9 +337,27 @@ export declare class PasswordReauthForm {
336
337
  static toExampleData?: () => any
337
338
  }
338
339
 
340
+ /**
341
+ * Atscript interface **StepUpConfirmForm**
342
+ * @see {@link ./forms.as:775:18}
343
+ */
344
+ export declare class StepUpConfirmForm {
345
+ // notice: ui.paragraph
346
+ // useDifferentMethod: ui.action
347
+ // cancel: ui.action
348
+ static __is_atscript_annotated_type: true
349
+ static type: TAtscriptTypeObject<keyof StepUpConfirmForm, StepUpConfirmForm>
350
+ static metadata: TMetadataMap<AtscriptMetadata>
351
+ static validator: (opts?: Partial<TValidatorOptions>) => Validator<typeof StepUpConfirmForm>
352
+ /** @deprecated JSON Schema support is disabled. Calling this method will throw a runtime error. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add `@emit.jsonSchema` annotation to individual interfaces. */
353
+ static toJsonSchema: () => any
354
+ /** @deprecated Example Data support is disabled. To enable, set `exampleData: true` in tsPlugin options. */
355
+ static toExampleData?: () => any
356
+ }
357
+
339
358
  /**
340
359
  * Atscript interface **TermsBumpForm**
341
- * @see {@link ./forms.as:760:18}
360
+ * @see {@link ./forms.as:803:18}
342
361
  */
343
362
  export declare class TermsBumpForm extends WithInlineConsentForm {
344
363
  static __is_atscript_annotated_type: true
@@ -353,7 +372,7 @@ export declare class TermsBumpForm extends WithInlineConsentForm {
353
372
 
354
373
  /**
355
374
  * Atscript interface **ConcurrencyLimitForm**
356
- * @see {@link ./forms.as:773:18}
375
+ * @see {@link ./forms.as:816:18}
357
376
  */
358
377
  export declare class ConcurrencyLimitForm {
359
378
  static __is_atscript_annotated_type: true
@@ -368,7 +387,7 @@ export declare class ConcurrencyLimitForm {
368
387
 
369
388
  /**
370
389
  * Atscript interface **MagicLinkRequestForm**
371
- * @see {@link ./forms.as:783:18}
390
+ * @see {@link ./forms.as:826:18}
372
391
  */
373
392
  export declare class MagicLinkRequestForm {
374
393
  identifier: string
@@ -384,7 +403,7 @@ export declare class MagicLinkRequestForm {
384
403
 
385
404
  /**
386
405
  * Atscript interface **RecoveryModeSelectForm**
387
- * @see {@link ./forms.as:798:18}
406
+ * @see {@link ./forms.as:841:18}
388
407
  */
389
408
  export declare class RecoveryModeSelectForm {
390
409
  mode: string
@@ -400,7 +419,7 @@ export declare class RecoveryModeSelectForm {
400
419
 
401
420
  /**
402
421
  * Atscript interface **RecoveryFactorForm**
403
- * @see {@link ./forms.as:821:18}
422
+ * @see {@link ./forms.as:864:18}
404
423
  */
405
424
  export declare class RecoveryFactorForm {
406
425
  factor: string
@@ -417,7 +436,7 @@ export declare class RecoveryFactorForm {
417
436
 
418
437
  /**
419
438
  * Atscript interface **ChangePasswordForm**
420
- * @see {@link ./forms.as:855:18}
439
+ * @see {@link ./forms.as:898:18}
421
440
  */
422
441
  export declare class ChangePasswordForm {
423
442
  // intro: ui.paragraph
@@ -437,7 +456,7 @@ export declare class ChangePasswordForm {
437
456
 
438
457
  /**
439
458
  * Atscript interface **ProveControlForm**
440
- * @see {@link ./forms.as:920:18}
459
+ * @see {@link ./forms.as:963:18}
441
460
  */
442
461
  export declare class ProveControlForm {
443
462
  // intro: ui.paragraph
@@ -455,7 +474,7 @@ export declare class ProveControlForm {
455
474
 
456
475
  /**
457
476
  * Atscript interface **ProveControlOtpForm**
458
- * @see {@link ./forms.as:955:18}
477
+ * @see {@link ./forms.as:998:18}
459
478
  */
460
479
  export declare class ProveControlOtpForm {
461
480
  // intro: ui.paragraph
@@ -474,7 +493,7 @@ export declare class ProveControlOtpForm {
474
493
 
475
494
  /**
476
495
  * Atscript interface **AuthorizeConsentForm**
477
- * @see {@link ./forms.as:1005:18}
496
+ * @see {@link ./forms.as:1048:18}
478
497
  */
479
498
  export declare class AuthorizeConsentForm {
480
499
  // notice: ui.paragraph