@newheap/platform-common 1.3.0 → 1.4.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/index.d.ts CHANGED
@@ -29,6 +29,32 @@ declare class EndpointsAuthenticationNhCommonModuleConfig {
29
29
  impersonate: string;
30
30
  revertImpersonate: string;
31
31
  accountInformation: string;
32
+ twoFactorVerify: string;
33
+ twoFactorStatus: string;
34
+ twoFactorAuthenticator: string;
35
+ twoFactorAuthenticatorConfirm: string;
36
+ twoFactorRecoveryCodes: string;
37
+ twoFactorDisable: string;
38
+ twoFactorForgetDevices: string;
39
+ twoFactorEmailSetup: string;
40
+ twoFactorEmailConfirm: string;
41
+ twoFactorEmail: string;
42
+ twoFactorPasskeyOptions: string;
43
+ twoFactorPasskey: string;
44
+ twoFactorEnrollmentAuthenticator: string;
45
+ twoFactorEnrollmentAuthenticatorConfirm: string;
46
+ twoFactorEnrollmentEmail: string;
47
+ twoFactorEnrollmentEmailConfirm: string;
48
+ twoFactorEnrollmentPasskeyOptions: string;
49
+ twoFactorEnrollmentPasskey: string;
50
+ /** Administration route; `{userId}` is replaced with the user ID. */
51
+ twoFactorUserReset: string;
52
+ twoFactorEnrollmentReminders: string;
53
+ twoFactorSessionRevocation: string;
54
+ passkeySignInOptions: string;
55
+ passkeySignIn: string;
56
+ passkeys: string;
57
+ passkeyRegistrationOptions: string;
32
58
  constructor(init?: Partial<EndpointsAuthenticationNhCommonModuleConfig>);
33
59
  }
34
60
  declare class AuthenticationNhCommonModuleConfig {
@@ -475,6 +501,8 @@ declare class AuthenticateModel {
475
501
  realm: string;
476
502
  username: string;
477
503
  password: string | undefined;
504
+ /** Remember-device token for header authentication; cookie clients send it as a cookie. */
505
+ rememberDeviceToken?: string;
478
506
  constructor(init?: Partial<AuthenticateModel>);
479
507
  }
480
508
  declare class ImpersonateAuthenticateModel {
@@ -485,6 +513,178 @@ declare class RevertImpersonateAuthenticateModel {
485
513
  constructor(init?: Partial<RevertImpersonateAuthenticateModel>);
486
514
  }
487
515
  type AuthenticationFlow = 'password' | 'microsoft-oauth' | string;
516
+ /**
517
+ * Second-factor methods a user can present after the first factor succeeded.
518
+ */
519
+ declare const NhTwoFactorMethods: {
520
+ readonly authenticator: "authenticator";
521
+ readonly recoveryCode: "recovery-code";
522
+ readonly email: "email";
523
+ readonly passkey: "passkey";
524
+ };
525
+ type NhTwoFactorMethod = typeof NhTwoFactorMethods[keyof typeof NhTwoFactorMethods] | string;
526
+ /**
527
+ * Safe failure codes returned by the two-factor endpoints. Each error item uses the code as
528
+ * its name and `nh-two-factor.<suffix>` as its translation key.
529
+ */
530
+ declare enum NhTwoFactorFailureCodes {
531
+ Required = "two-factor-required",
532
+ EnrollmentRequired = "two-factor-enrollment-required",
533
+ InvalidCode = "two-factor-invalid-code",
534
+ ChallengeExpired = "two-factor-challenge-expired",
535
+ LockedOut = "two-factor-locked-out",
536
+ MethodNotAllowed = "two-factor-method-not-allowed",
537
+ NotEnabled = "two-factor-not-enabled",
538
+ AlreadyEnabled = "two-factor-already-enabled",
539
+ SetupNotStarted = "two-factor-setup-not-started",
540
+ ReauthenticationRequired = "two-factor-reauthentication-required",
541
+ ReauthenticationFailed = "two-factor-reauthentication-failed",
542
+ RequiredByPolicy = "two-factor-required-by-policy",
543
+ NotAllowedWhileImpersonating = "two-factor-not-allowed-while-impersonating",
544
+ ConfigurationInvalid = "two-factor-configuration-invalid",
545
+ EmailCooldown = "two-factor-email-cooldown",
546
+ EmailUnavailable = "two-factor-email-unavailable",
547
+ UserNotFound = "two-factor-user-not-found",
548
+ PasskeyInvalid = "two-factor-passkey-invalid",
549
+ PasskeyNotFound = "two-factor-passkey-not-found",
550
+ /** The browser does not support passkeys or the user cancelled the passkey prompt. */
551
+ PasskeyUnavailable = "two-factor-passkey-unavailable"
552
+ }
553
+ /**
554
+ * Status values of a pending authentication step.
555
+ */
556
+ declare const NhAuthenticationStepStatuses: {
557
+ readonly twoFactorRequired: "two-factor-required";
558
+ readonly enrollmentRequired: "enrollment-required";
559
+ };
560
+ /**
561
+ * A pending sign-in step. With status `two-factor-required` the user presents a second
562
+ * factor; with `enrollment-required` the policy requires the user to enroll one first, and
563
+ * `challengeToken` is the enrollment token.
564
+ */
565
+ declare class NhTwoFactorChallenge {
566
+ status: string;
567
+ challengeToken: string;
568
+ expiresAt: string;
569
+ methods: NhTwoFactorMethod[];
570
+ /** Whether completing the challenge can remember this device for later sign-ins. */
571
+ rememberDeviceAvailable: boolean;
572
+ constructor(init?: Partial<NhTwoFactorChallenge>);
573
+ }
574
+ /**
575
+ * Login response when two-factor authentication is enabled on the server. A complete
576
+ * session has the token fields; a pending sign-in only has `twoFactor`.
577
+ */
578
+ interface NhLoginResponse {
579
+ token?: string | null;
580
+ validTo?: string | null;
581
+ refreshToken?: string | null;
582
+ refreshValidTo?: string | null;
583
+ issuer?: string | null;
584
+ twoFactor?: NhTwoFactorChallenge | null;
585
+ /** Remember-device token for header authentication, returned when the user chose to remember the device. */
586
+ rememberDeviceToken?: string | null;
587
+ }
588
+ type NhAuthenticationStepStatus = 'authenticated' | 'two-factor-required' | 'enrollment-required';
589
+ /**
590
+ * Outcome of an interactive sign-in step: the stored authorization, a second-factor
591
+ * challenge or a required enrollment.
592
+ */
593
+ declare class NhAuthenticationStep<TAuthorization extends INhAuthorization = INhAuthorization> {
594
+ status: NhAuthenticationStepStatus;
595
+ authorization?: TAuthorization;
596
+ challenge?: NhTwoFactorChallenge;
597
+ constructor(init?: Partial<NhAuthenticationStep<TAuthorization>>);
598
+ }
599
+ declare class NhTwoFactorVerifyModel {
600
+ challengeToken: string;
601
+ method: NhTwoFactorMethod;
602
+ code: string;
603
+ /** Skip the second factor on this device for later sign-ins, when the server allows it. */
604
+ rememberDevice?: boolean;
605
+ constructor(init?: Partial<NhTwoFactorVerifyModel>);
606
+ }
607
+ /**
608
+ * Proof that the signed-in user is present before a sensitive change: the current password
609
+ * or a valid second-factor code.
610
+ */
611
+ declare class NhTwoFactorReauthentication {
612
+ password?: string;
613
+ method?: NhTwoFactorMethod;
614
+ code?: string;
615
+ constructor(init?: Partial<NhTwoFactorReauthentication>);
616
+ }
617
+ declare class NhTwoFactorStatus {
618
+ enabled: boolean;
619
+ required: boolean;
620
+ methods: NhTwoFactorMethod[];
621
+ availableMethods: NhTwoFactorMethod[];
622
+ recoveryCodesLeft: number;
623
+ authenticatorSetupPending: boolean;
624
+ emailSetupPending: boolean;
625
+ rememberDeviceAvailable: boolean;
626
+ passkeyCount: number;
627
+ constructor(init?: Partial<NhTwoFactorStatus>);
628
+ }
629
+ /**
630
+ * Pending authenticator enrollment. `qrCodeDataUri` is a PNG data URI rendered by the server.
631
+ */
632
+ declare class NhAuthenticatorSetup {
633
+ sharedKey: string;
634
+ authenticatorUri: string;
635
+ qrCodeDataUri?: string;
636
+ constructor(init?: Partial<NhAuthenticatorSetup>);
637
+ }
638
+ /**
639
+ * Result of a two-factor change. Recovery codes are returned once. When the change ended
640
+ * every session, the service has already stored the renewed session for this device.
641
+ */
642
+ declare class NhTwoFactorChange {
643
+ recoveryCodes?: string[];
644
+ sessionRenewed: boolean;
645
+ constructor(init?: Partial<NhTwoFactorChange>);
646
+ }
647
+ /**
648
+ * Confirmation that the server e-mailed a code.
649
+ */
650
+ declare class NhTwoFactorEmailCodeSent {
651
+ expiresAt: string;
652
+ /** When another code can be requested. */
653
+ resendAvailableAt: string;
654
+ constructor(init?: Partial<NhTwoFactorEmailCodeSent>);
655
+ }
656
+ /**
657
+ * Result of an enrollment that the policy required during sign-in. The session is already
658
+ * stored; the recovery codes are returned once.
659
+ */
660
+ declare class NhTwoFactorEnrollmentResult<TAuthorization extends INhAuthorization = INhAuthorization> {
661
+ authorization?: TAuthorization;
662
+ recoveryCodes?: string[];
663
+ constructor(init?: Partial<NhTwoFactorEnrollmentResult<TAuthorization>>);
664
+ }
665
+ /**
666
+ * WebAuthn options from the server for one passkey ceremony. `options` is the JSON form of
667
+ * the creation or request options; `ceremonyToken` goes back with the credential.
668
+ */
669
+ declare class NhPasskeyOptions {
670
+ options: any;
671
+ ceremonyToken: string;
672
+ expiresAt: string;
673
+ constructor(init?: Partial<NhPasskeyOptions>);
674
+ }
675
+ /**
676
+ * A registered passkey. The public key is never returned.
677
+ */
678
+ declare class NhPasskey {
679
+ /** Credential ID, base64url encoded. */
680
+ id: string;
681
+ name: string;
682
+ createdAt: string;
683
+ /** Whether a passkey provider, such as a password manager, syncs the passkey. */
684
+ isBackedUp: boolean;
685
+ transports: string[];
686
+ constructor(init?: Partial<NhPasskey>);
687
+ }
488
688
 
489
689
  declare class NhUserNotificationCollectionHttpRequestOptions extends CollectionHttpRequestOptions {
490
690
  constructor(init?: Partial<NhUserNotificationCollectionHttpRequestOptions>);
@@ -1072,20 +1272,57 @@ declare class NhCookieService {
1072
1272
  static ɵprov: i0.ɵɵInjectableDeclaration<NhCookieService>;
1073
1273
  }
1074
1274
 
1275
+ /**
1276
+ * Runs WebAuthn ceremonies in the browser. The server returns the options in their JSON form
1277
+ * and expects the credential in its JSON form; this client converts both, with a fallback for
1278
+ * browsers without `PublicKeyCredential.parseCreationOptionsFromJSON` and `toJSON()`.
1279
+ */
1280
+ declare class NhPasskeyClient {
1281
+ private readonly platformId;
1282
+ /**
1283
+ * Whether the browser supports passkeys. Always false during server-side rendering.
1284
+ */
1285
+ isSupported(): boolean;
1286
+ /**
1287
+ * Creates a passkey for WebAuthn creation options and returns the credential JSON.
1288
+ * Rejects when the user cancels the prompt or the browser refuses the request.
1289
+ */
1290
+ create(options: any): Promise<object>;
1291
+ /**
1292
+ * Signs WebAuthn request options with a passkey and returns the credential JSON.
1293
+ * Rejects when the user cancels the prompt or the browser refuses the request.
1294
+ */
1295
+ get(options: any): Promise<object>;
1296
+ private ensureSupported;
1297
+ private requireCredential;
1298
+ private creationOptionsFromJSON;
1299
+ private requestOptionsFromJSON;
1300
+ private credentialToJSON;
1301
+ private static fromBase64Url;
1302
+ private static toBase64Url;
1303
+ static ɵfac: i0.ɵɵFactoryDeclaration<NhPasskeyClient, never>;
1304
+ static ɵprov: i0.ɵɵInjectableDeclaration<NhPasskeyClient>;
1305
+ }
1306
+
1075
1307
  declare abstract class BaseNhAuthService<TAuthorization extends INhAuthorization> implements OnDestroy {
1308
+ protected static readonly pendingTwoFactorChallengeStorageKey = "nh-two-factor-challenge";
1309
+ protected static readonly externalTwoFactorChallengePrefix = "nh-two-factor=";
1310
+ protected static readonly rememberDeviceStorageKey = "nh-two-factor-device";
1076
1311
  protected authorization: TAuthorization | undefined;
1312
+ protected pendingTwoFactorChallenge: NhTwoFactorChallenge | undefined;
1077
1313
  protected authSession: AuthenticationSessionCreateResponse | undefined;
1078
1314
  readonly authSubject: BehaviorSubject<TAuthorization | undefined>;
1079
1315
  protected onReady: ((value: (PromiseLike<unknown> | unknown)) => void) | undefined;
1080
1316
  readonly authReady: Promise<unknown>;
1081
1317
  protected _sessionExpirationInformation: BehaviorSubject<AuthSessionExpirationInformation>;
1082
- sessionExpirationInformationChanged: rxjs.Observable<AuthSessionExpirationInformation>;
1318
+ sessionExpirationInformationChanged: Observable<AuthSessionExpirationInformation>;
1083
1319
  protected intervalHandle: any;
1084
1320
  protected zone: NgZone;
1085
1321
  protected moduleConfig: NhCommonModuleConfig;
1086
1322
  protected httpClient: HttpClient;
1087
1323
  protected platformId: Object;
1088
1324
  protected requestContext: any;
1325
+ protected passkeyClient: NhPasskeyClient;
1089
1326
  constructor();
1090
1327
  dispatchSessionExpirationInformationChanged(): void;
1091
1328
  ngOnDestroy(): void;
@@ -1117,7 +1354,168 @@ declare abstract class BaseNhAuthService<TAuthorization extends INhAuthorization
1117
1354
  getAuthenticationFlow(username: string): Promise<TaskResult<AuthenticationFlow>>;
1118
1355
  getMicrosoftRedirectUrl(callbackUrl: string, username: string): Promise<TaskResult<string>>;
1119
1356
  authorizeMicrosoft(code: string, state: string): Promise<TaskResult<TAuthorization>>;
1357
+ /**
1358
+ * Signs in with username and password and stores the complete session.
1359
+ *
1360
+ * When the server requires a second factor this method fails with
1361
+ * `NhTwoFactorFailureCodes.Required` and stores nothing. Use `authenticateInteractive`
1362
+ * to receive the challenge, or read it with `getPendingTwoFactorChallenge()`.
1363
+ */
1120
1364
  authenticate(model: AuthenticateModel, loginAsUser?: boolean): Promise<TaskResult<TAuthorization>>;
1365
+ /**
1366
+ * Signs in with username and password. Returns the stored authorization, the
1367
+ * second-factor challenge or the required enrollment. A pending step is never stored as
1368
+ * an authorization.
1369
+ */
1370
+ authenticateInteractive(model: AuthenticateModel): Promise<TaskResult<NhAuthenticationStep<TAuthorization>>>;
1371
+ /**
1372
+ * Completes a second-factor challenge and stores the session.
1373
+ */
1374
+ verifyTwoFactor(model: NhTwoFactorVerifyModel): Promise<TaskResult<TAuthorization>>;
1375
+ /**
1376
+ * E-mails a sign-in code for the pending challenge when the user enrolled the e-mail factor.
1377
+ */
1378
+ sendTwoFactorEmailCode(challengeToken: string): Promise<TaskResult<NhTwoFactorEmailCodeSent>>;
1379
+ /**
1380
+ * Whether this browser can use passkeys.
1381
+ */
1382
+ isPasskeySupported(): boolean;
1383
+ /**
1384
+ * Completes the pending challenge with a passkey and stores the session.
1385
+ */
1386
+ verifyTwoFactorWithPasskey(challengeToken: string, rememberDevice?: boolean): Promise<TaskResult<TAuthorization>>;
1387
+ /**
1388
+ * Signs in with a discoverable passkey, without a username or password. Returns the
1389
+ * stored authorization, or a pending step when the server's policy asks for more.
1390
+ */
1391
+ signInWithPasskey(): Promise<TaskResult<NhAuthenticationStep<TAuthorization>>>;
1392
+ /**
1393
+ * Starts authenticator enrollment for a user whom the policy requires to enroll during
1394
+ * sign-in. `enrollmentToken` is the `challengeToken` of the enrollment step.
1395
+ */
1396
+ beginEnrollmentAuthenticatorSetup(enrollmentToken: string): Promise<TaskResult<NhAuthenticatorSetup>>;
1397
+ /**
1398
+ * Confirms the authenticator during a required enrollment and stores the session.
1399
+ */
1400
+ confirmEnrollmentAuthenticator(enrollmentToken: string, code: string): Promise<TaskResult<NhTwoFactorEnrollmentResult<TAuthorization>>>;
1401
+ /**
1402
+ * E-mails a confirmation code during a required enrollment.
1403
+ */
1404
+ sendEnrollmentEmailCode(enrollmentToken: string): Promise<TaskResult<NhTwoFactorEmailCodeSent>>;
1405
+ /**
1406
+ * Confirms the e-mail factor during a required enrollment and stores the session.
1407
+ */
1408
+ confirmEnrollmentEmail(enrollmentToken: string, code: string): Promise<TaskResult<NhTwoFactorEnrollmentResult<TAuthorization>>>;
1409
+ /**
1410
+ * Registers a passkey during a required enrollment and stores the session.
1411
+ */
1412
+ enrollPasskey(enrollmentToken: string, name?: string): Promise<TaskResult<NhTwoFactorEnrollmentResult<TAuthorization>>>;
1413
+ /**
1414
+ * Returns the pending second-factor challenge of this browser tab, if it has not expired.
1415
+ */
1416
+ getPendingTwoFactorChallenge(): NhTwoFactorChallenge | undefined;
1417
+ clearPendingTwoFactorChallenge(): void;
1418
+ /**
1419
+ * Reads a challenge that an external sign-in (Microsoft OAuth) passed back in the URL
1420
+ * fragment, stores it as the pending challenge and removes it from the address bar.
1421
+ */
1422
+ consumeExternalTwoFactorChallenge(fragment?: string): NhTwoFactorChallenge | undefined;
1423
+ getTwoFactorStatus(): Promise<TaskResult<NhTwoFactorStatus>>;
1424
+ /**
1425
+ * Starts authenticator enrollment. Restarting enrollment while two-factor authentication
1426
+ * is enabled requires reauthentication.
1427
+ */
1428
+ beginAuthenticatorSetup(reauthentication?: NhTwoFactorReauthentication): Promise<TaskResult<NhAuthenticatorSetup>>;
1429
+ /**
1430
+ * Confirms authenticator enrollment. The server ends every other session; the renewed
1431
+ * session for this device is stored before the promise resolves.
1432
+ */
1433
+ confirmAuthenticator(code: string): Promise<TaskResult<NhTwoFactorChange>>;
1434
+ regenerateRecoveryCodes(reauthentication: NhTwoFactorReauthentication): Promise<TaskResult<NhTwoFactorChange>>;
1435
+ disableTwoFactor(reauthentication: NhTwoFactorReauthentication): Promise<TaskResult<NhTwoFactorChange>>;
1436
+ /**
1437
+ * E-mails a code that confirms the user's e-mail address as a second factor. Requires
1438
+ * reauthentication while two-factor authentication is enabled.
1439
+ */
1440
+ beginEmailSetup(reauthentication?: NhTwoFactorReauthentication): Promise<TaskResult<NhTwoFactorEmailCodeSent>>;
1441
+ confirmEmailSetup(code: string): Promise<TaskResult<NhTwoFactorChange>>;
1442
+ /**
1443
+ * Forgets every remembered device, including this one, and ends every other session.
1444
+ */
1445
+ forgetTwoFactorDevices(reauthentication: NhTwoFactorReauthentication): Promise<TaskResult<NhTwoFactorChange>>;
1446
+ getPasskeys(): Promise<TaskResult<NhPasskey[]>>;
1447
+ /**
1448
+ * Registers a passkey on this device. Adding a passkey while two-factor authentication is
1449
+ * enabled requires reauthentication. The server ends every other session; the renewed
1450
+ * session for this device is stored before the promise resolves.
1451
+ */
1452
+ registerPasskey(name?: string, reauthentication?: NhTwoFactorReauthentication): Promise<TaskResult<NhTwoFactorChange>>;
1453
+ renamePasskey(passkeyId: string, name: string): Promise<TaskResult<void>>;
1454
+ /**
1455
+ * Removes a passkey. Removing the last second factor disables two-factor authentication,
1456
+ * which fails when the policy requires it.
1457
+ */
1458
+ removePasskey(passkeyId: string, reauthentication: NhTwoFactorReauthentication): Promise<TaskResult<NhTwoFactorChange>>;
1459
+ /**
1460
+ * Removes every second factor of another user who lost access to them. Requires the
1461
+ * server's two-factor administration policy.
1462
+ */
1463
+ resetUserTwoFactor(userId: string): Promise<TaskResult<void>>;
1464
+ /**
1465
+ * Starts a background operation that reminds every user whom the policy requires to
1466
+ * enroll. A repeated idempotency key returns the operation that was already started.
1467
+ */
1468
+ startTwoFactorEnrollmentReminders(idempotencyKey: string): Promise<TaskResult<NhBackgroundOperation>>;
1469
+ /**
1470
+ * Starts a background operation that ends the sessions of every user whom the policy
1471
+ * requires to enroll, so their next sign-in enrolls them.
1472
+ */
1473
+ startTwoFactorSessionRevocation(idempotencyKey: string): Promise<TaskResult<NhBackgroundOperation>>;
1474
+ protected sendTwoFactorChange(endpoint: string, body: object): Promise<TaskResult<NhTwoFactorChange>>;
1475
+ /**
1476
+ * Stores the session that the server issued for this device after a change that ended
1477
+ * every session. The user, claims and divisions of the current authorization are kept.
1478
+ */
1479
+ protected applyRenewedSession(session: NhLoginResponse | null | undefined): boolean;
1480
+ protected toAuthorization(response: NhLoginResponse): TAuthorization;
1481
+ /**
1482
+ * Stores a complete session, or keeps a second-factor challenge or enrollment as the
1483
+ * pending step of this browser tab.
1484
+ */
1485
+ protected completeAuthenticationStep(response: NhLoginResponse): NhAuthenticationStep<TAuthorization>;
1486
+ /**
1487
+ * Converts a failed challenge or enrollment request and forgets the pending step when the
1488
+ * server ended it.
1489
+ */
1490
+ protected pendingStepFailed(ex: unknown): TaskResult<unknown>;
1491
+ protected sendEnrollmentCompletion(endpoint: string, body: object): Promise<TaskResult<NhTwoFactorEnrollmentResult<TAuthorization>>>;
1492
+ protected sendTwoFactorRequest<TResponse, TResult>(request$: Observable<TResponse>, map: (response: TResponse) => TResult): Promise<TaskResult<TResult>>;
1493
+ /**
1494
+ * Runs a WebAuthn prompt. A cancelled prompt or an unsupported browser becomes a failed
1495
+ * result with `NhTwoFactorFailureCodes.PasskeyUnavailable`.
1496
+ */
1497
+ protected runPasskeyCeremony(ceremony: () => Promise<object>): Promise<TaskResult<object>>;
1498
+ /**
1499
+ * Returns the remember-device token of header clients. Cookie clients receive it as an
1500
+ * HttpOnly cookie, so nothing is stored in the browser.
1501
+ */
1502
+ protected getRememberDeviceToken(): string | undefined;
1503
+ protected storeRememberDeviceToken(token: string | undefined): void;
1504
+ protected rememberDeviceStorageKey(): string;
1505
+ protected setPendingTwoFactorChallenge(challenge: NhTwoFactorChallenge): void;
1506
+ protected readStoredTwoFactorChallenge(): NhTwoFactorChallenge | undefined;
1507
+ protected twoFactorEndpoints(): EndpointsAuthenticationNhCommonModuleConfig;
1508
+ protected twoFactorUrl(endpoint: string): string;
1509
+ protected twoFactorStepRequestOptions(): {
1510
+ params: HttpParams;
1511
+ withCredentials: boolean;
1512
+ };
1513
+ protected twoFactorAccountRequestOptions(): {
1514
+ params: HttpParams;
1515
+ headers: HttpHeaders;
1516
+ withCredentials: boolean;
1517
+ };
1518
+ protected languageParams(): HttpParams;
1121
1519
  reloadAuthorizationProfile(): Promise<TaskResult<TAuthorization>>;
1122
1520
  logout(): Promise<TaskResult<void>>;
1123
1521
  authenticateRefreshToken(model: RefreshTokenLoginAccountMutateModel): Promise<TaskResult<TAuthorization>>;
@@ -2635,5 +3033,5 @@ declare class NhTranslateBrowserLoader implements TranslateLoader {
2635
3033
  }
2636
3034
  declare function nhTranslateBrowserLoaderFactory(httpClient: HttpClient, transferState: TransferState): NhTranslateBrowserLoader;
2637
3035
 
2638
- export { AbstractValueAccessor, AspMvcFormServerSideFormValidator, AuthSessionExpirationInformation, AuthenticateModel, AuthenticationNhCommonModuleConfig, AuthenticationSessionCreateResponse, BackgroundOperationsNhCommonModuleConfig, BaseNhAuthService, CheckAuthenticateSessionModel, Claim, ClaimAuthenticateSessionAccountMutateModel, ClaimAuthenticateSessionAccountViewModel, ClaimTypes, CollectionHttpRequestOptions, CollectionHttpResponse, DefaultMultiSelectSettings, DefaultMultiSelectTexts, EndpointsAuthenticationNhCommonModuleConfig, FilterRequestOptions, FormError, FormValidationResult, HttpDownloadRequestOptions, HttpRequestOptions, HttpRequestOptionsArrayBuffer, HttpRequestOptionsText, ImpersonateAuthenticateModel, IsAllPermissionsGrantedPipe, IsAuthenticatedPipe, IsClaimGrantedPipe, IsDefined, IsGrantedRolePipe, IsOneActiveDivisionPermissionGrantedGuard, IsOneActiveDivisionPermissionGrantedPipe, IsOneActiveDivisionRoleGrantedGuard, IsOneActiveDivisionRoleGrantedPipe, IsOneClaimGrantedPipe, IsOneDivisionPermissionGrantedPipe, IsOneDivisionRoleGrantedPipe, IsOnePermissionGrantedPipe, IsOneRoleGrantedPipe, JsonLdDataChanged, ListSortDirection, MakeProvider, MutationType, NH_ERROR_HANDLERS, NH_ROUTER_LANGUAGE_CHANGE_METHOD, NH_ROUTER_ROOT_ROUTES, NhAccountInformationResponse, NhAngularUtil, NhApiService, NhApiUtil, NhAppService, NhAsyncLock, NhAuthService, NhAuthorization, NhBackgroundOperationAdministrationCollectionHttpRequestOptions, NhBackgroundOperationAdministrationService, NhBackgroundOperationCollectionHttpRequestOptions, NhBackgroundOperationLiveUpdateService, NhBackgroundOperationProgressComponent, NhBackgroundOperationService, NhBackgroundOperationStore, NhBaseApiService, NhBooleanToStringPipe, NhBreadCrumb, NhBreadCrumbItem, NhButtonDebounceDirective, NhCanCancelNavigationGuard, NhCollectionBaseComponent, NhCollectionTypeBaseComponent, NhCommonConfig, NhCommonConfigChanged, NhCommonModule, NhCommonModuleConfig, NhConfigCommonService, NhContextMenu, NhContextMenuItem, NhContextMenuService, NhContextMenuServiceConfig, NhCookieService, NhDatePipe, NhDateTimePipe, NhDateUtcPipe, NhDebounceDirective, NhDeduplicateGetRequestsInterceptor, NhDivision, NhDivisionRole, NhDivisionUser, NhEncodeHttpParamsInterceptor, NhEncodingUtil, NhErrorComponent, NhErrorHandlerService, NhFormDropDownComponent, NhFormDropDownNhCommonModuleConfig, NhFormDropDownSettings, NhFormErrorMessageComponent, NhFormHelper, NhHeadService, NhHttpNhCommonModuleConfig, NhHttpUtil, NhInternetConnectionService, NhIsAllPermissionsGrantedGuard, NhIsAuthenticatedGuard, NhIsOneClaimGrantedGuard, NhIsOnePermissionGrantedGuard, NhIsOneRoleGrantedGuard, NhJsonLdComponent, NhJsonLdData, NhJsonLdDataItem, NhJsonLdService, NhLoaderComponent, NhMetaService, NhModalComponent, NhModalComponentClosed, NhModalComponentImpl, NhModalComponentRef, NhModalConfirmComponent, NhModalContentDirective, NhModalLoadingComponent, NhModalMutateBaseComponent, NhModalMutateBaseTypeComponent, NhModalOptions, NhModalService, NhMutateBaseComponent, NhMutateBaseTypeComponent, NhMutex, NhPageBaseComponent, NhPageService, NhPageSettings, NhPageSizeComponent, NhPageTypeBaseComponent, NhRegisterRoute, NhRequestScopedServerHttpInterceptorService, NhRoute, NhRouteInfo, NhRouteNavigationItem, NhRouterLinkDirective, NhRouterService, NhRouterSetupService, NhSearchInputComponent, NhServerHttpInterceptor, NhServerService, NhServerSideFormValidationService, NhSitemap, NhSitemapEntry, NhSitemapEntryItem, NhStringUtil, NhTaskResultFormValidationService, NhTitleService, NhToHeadDirective, NhTranslateBrowserLoader, NhTranslationNhCommonModuleConfig, NhTypedPageBaseComponent, NhTypedPageTypeBaseComponent, NhUrlEncodePipe, NhUser, NhUserNotification, NhUserNotificationCollectionHttpRequestOptions, NhUserNotificationData, NhUserNotificationMessage, NhUserNotificationOverview, NhUserNotificationService, NhUserNotificationState, NhUserNotificationsAbstractComponent, OrderByRequestOptions, PreConnectUrlItem, PreLoadUrlItem, REVIEW_AGGREGATE_RATING_KEY, REVIEW_KEY, RefreshTokenLoginAccountMutateModel, RevertImpersonateAuthenticateModel, SafeHtmlPipe, SafeResourceUrlPipe, SafeUrlPipe, SearchableCollectionHttpRequestOptions, SimpleCollectionHttpRequestOptions, SimpleCollectionHttpResponse, TaskResult, TaskResultItem, TypedNhPageSettings, UserNotificationNhCommonModuleConfig, enumIntValuesToArray, enumKeysToArray, enumStringValuesToArray, enumValuesToArray, getEmptyGuid, getRandomIdentifier, groupBy, languageToCultureMap, nameof, nhBackgroundOperationStatusName, nhBackgroundOperationStepStatusName, nhBackgroundOperationTranslationSegment, nhTranslateBrowserLoaderFactory, nhUserNotificationSeverityName, uppercaseFirst };
2639
- export type { AuthenticationFlow, ErrorResult, ICancelNavigationComponent, IClaimAuthenticateSessionAccountViewModel, ICollectionHttpRequestOptions, ICollectionHttpResponse, IFormError, IFormValidationResult, IHttpDownloadRequestOptions, IHttpRequestOptions, INhAccountInformationResponse, INhAuthorization, INhDivision, INhDivisionRole, INhDivisionUser, INhModalComponent, INhUser, ISearchableCollectionHttpRequestOptions, IServerSideFormValidationService, IServerSideFormValidator, ISimpleCollectionHttpRequestOptions, ISimpleCollectionHttpResponse, NhBackgroundOperation, NhBackgroundOperationAdministration, NhBackgroundOperationAggregationMode, NhBackgroundOperationAttempt, NhBackgroundOperationAttemptStatus, NhBackgroundOperationChanged, NhBackgroundOperationChild, NhBackgroundOperationConnectionState, NhBackgroundOperationEvent, NhBackgroundOperationEventType, NhBackgroundOperationMessageSeverity, NhBackgroundOperationStatus, NhBackgroundOperationStep, NhBackgroundOperationStepStatus, NhContextEventWithCoordinates, NhEnumDropDownItem, NhRouterLink, NhUserNotificationSeverity, SuccessResult, TypedResult };
3036
+ export { AbstractValueAccessor, AspMvcFormServerSideFormValidator, AuthSessionExpirationInformation, AuthenticateModel, AuthenticationNhCommonModuleConfig, AuthenticationSessionCreateResponse, BackgroundOperationsNhCommonModuleConfig, BaseNhAuthService, CheckAuthenticateSessionModel, Claim, ClaimAuthenticateSessionAccountMutateModel, ClaimAuthenticateSessionAccountViewModel, ClaimTypes, CollectionHttpRequestOptions, CollectionHttpResponse, DefaultMultiSelectSettings, DefaultMultiSelectTexts, EndpointsAuthenticationNhCommonModuleConfig, FilterRequestOptions, FormError, FormValidationResult, HttpDownloadRequestOptions, HttpRequestOptions, HttpRequestOptionsArrayBuffer, HttpRequestOptionsText, ImpersonateAuthenticateModel, IsAllPermissionsGrantedPipe, IsAuthenticatedPipe, IsClaimGrantedPipe, IsDefined, IsGrantedRolePipe, IsOneActiveDivisionPermissionGrantedGuard, IsOneActiveDivisionPermissionGrantedPipe, IsOneActiveDivisionRoleGrantedGuard, IsOneActiveDivisionRoleGrantedPipe, IsOneClaimGrantedPipe, IsOneDivisionPermissionGrantedPipe, IsOneDivisionRoleGrantedPipe, IsOnePermissionGrantedPipe, IsOneRoleGrantedPipe, JsonLdDataChanged, ListSortDirection, MakeProvider, MutationType, NH_ERROR_HANDLERS, NH_ROUTER_LANGUAGE_CHANGE_METHOD, NH_ROUTER_ROOT_ROUTES, NhAccountInformationResponse, NhAngularUtil, NhApiService, NhApiUtil, NhAppService, NhAsyncLock, NhAuthService, NhAuthenticationStep, NhAuthenticationStepStatuses, NhAuthenticatorSetup, NhAuthorization, NhBackgroundOperationAdministrationCollectionHttpRequestOptions, NhBackgroundOperationAdministrationService, NhBackgroundOperationCollectionHttpRequestOptions, NhBackgroundOperationLiveUpdateService, NhBackgroundOperationProgressComponent, NhBackgroundOperationService, NhBackgroundOperationStore, NhBaseApiService, NhBooleanToStringPipe, NhBreadCrumb, NhBreadCrumbItem, NhButtonDebounceDirective, NhCanCancelNavigationGuard, NhCollectionBaseComponent, NhCollectionTypeBaseComponent, NhCommonConfig, NhCommonConfigChanged, NhCommonModule, NhCommonModuleConfig, NhConfigCommonService, NhContextMenu, NhContextMenuItem, NhContextMenuService, NhContextMenuServiceConfig, NhCookieService, NhDatePipe, NhDateTimePipe, NhDateUtcPipe, NhDebounceDirective, NhDeduplicateGetRequestsInterceptor, NhDivision, NhDivisionRole, NhDivisionUser, NhEncodeHttpParamsInterceptor, NhEncodingUtil, NhErrorComponent, NhErrorHandlerService, NhFormDropDownComponent, NhFormDropDownNhCommonModuleConfig, NhFormDropDownSettings, NhFormErrorMessageComponent, NhFormHelper, NhHeadService, NhHttpNhCommonModuleConfig, NhHttpUtil, NhInternetConnectionService, NhIsAllPermissionsGrantedGuard, NhIsAuthenticatedGuard, NhIsOneClaimGrantedGuard, NhIsOnePermissionGrantedGuard, NhIsOneRoleGrantedGuard, NhJsonLdComponent, NhJsonLdData, NhJsonLdDataItem, NhJsonLdService, NhLoaderComponent, NhMetaService, NhModalComponent, NhModalComponentClosed, NhModalComponentImpl, NhModalComponentRef, NhModalConfirmComponent, NhModalContentDirective, NhModalLoadingComponent, NhModalMutateBaseComponent, NhModalMutateBaseTypeComponent, NhModalOptions, NhModalService, NhMutateBaseComponent, NhMutateBaseTypeComponent, NhMutex, NhPageBaseComponent, NhPageService, NhPageSettings, NhPageSizeComponent, NhPageTypeBaseComponent, NhPasskey, NhPasskeyClient, NhPasskeyOptions, NhRegisterRoute, NhRequestScopedServerHttpInterceptorService, NhRoute, NhRouteInfo, NhRouteNavigationItem, NhRouterLinkDirective, NhRouterService, NhRouterSetupService, NhSearchInputComponent, NhServerHttpInterceptor, NhServerService, NhServerSideFormValidationService, NhSitemap, NhSitemapEntry, NhSitemapEntryItem, NhStringUtil, NhTaskResultFormValidationService, NhTitleService, NhToHeadDirective, NhTranslateBrowserLoader, NhTranslationNhCommonModuleConfig, NhTwoFactorChallenge, NhTwoFactorChange, NhTwoFactorEmailCodeSent, NhTwoFactorEnrollmentResult, NhTwoFactorFailureCodes, NhTwoFactorMethods, NhTwoFactorReauthentication, NhTwoFactorStatus, NhTwoFactorVerifyModel, NhTypedPageBaseComponent, NhTypedPageTypeBaseComponent, NhUrlEncodePipe, NhUser, NhUserNotification, NhUserNotificationCollectionHttpRequestOptions, NhUserNotificationData, NhUserNotificationMessage, NhUserNotificationOverview, NhUserNotificationService, NhUserNotificationState, NhUserNotificationsAbstractComponent, OrderByRequestOptions, PreConnectUrlItem, PreLoadUrlItem, REVIEW_AGGREGATE_RATING_KEY, REVIEW_KEY, RefreshTokenLoginAccountMutateModel, RevertImpersonateAuthenticateModel, SafeHtmlPipe, SafeResourceUrlPipe, SafeUrlPipe, SearchableCollectionHttpRequestOptions, SimpleCollectionHttpRequestOptions, SimpleCollectionHttpResponse, TaskResult, TaskResultItem, TypedNhPageSettings, UserNotificationNhCommonModuleConfig, enumIntValuesToArray, enumKeysToArray, enumStringValuesToArray, enumValuesToArray, getEmptyGuid, getRandomIdentifier, groupBy, languageToCultureMap, nameof, nhBackgroundOperationStatusName, nhBackgroundOperationStepStatusName, nhBackgroundOperationTranslationSegment, nhTranslateBrowserLoaderFactory, nhUserNotificationSeverityName, uppercaseFirst };
3037
+ export type { AuthenticationFlow, ErrorResult, ICancelNavigationComponent, IClaimAuthenticateSessionAccountViewModel, ICollectionHttpRequestOptions, ICollectionHttpResponse, IFormError, IFormValidationResult, IHttpDownloadRequestOptions, IHttpRequestOptions, INhAccountInformationResponse, INhAuthorization, INhDivision, INhDivisionRole, INhDivisionUser, INhModalComponent, INhUser, ISearchableCollectionHttpRequestOptions, IServerSideFormValidationService, IServerSideFormValidator, ISimpleCollectionHttpRequestOptions, ISimpleCollectionHttpResponse, NhAuthenticationStepStatus, NhBackgroundOperation, NhBackgroundOperationAdministration, NhBackgroundOperationAggregationMode, NhBackgroundOperationAttempt, NhBackgroundOperationAttemptStatus, NhBackgroundOperationChanged, NhBackgroundOperationChild, NhBackgroundOperationConnectionState, NhBackgroundOperationEvent, NhBackgroundOperationEventType, NhBackgroundOperationMessageSeverity, NhBackgroundOperationStatus, NhBackgroundOperationStep, NhBackgroundOperationStepStatus, NhContextEventWithCoordinates, NhEnumDropDownItem, NhLoginResponse, NhRouterLink, NhTwoFactorMethod, NhUserNotificationSeverity, SuccessResult, TypedResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newheap/platform-common",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.3.28",
6
6
  "@angular/core": "^20.3.28",
@@ -22,6 +22,22 @@
22
22
  "tslib": "^2.3.0"
23
23
  },
24
24
  "sideEffects": true,
25
+ "exports": {
26
+ "./two-factor/i18n/*.json": {
27
+ "default": "./two-factor/i18n/*.json"
28
+ },
29
+ "./package.json": {
30
+ "default": "./package.json"
31
+ },
32
+ ".": {
33
+ "types": "./index.d.ts",
34
+ "default": "./fesm2022/newheap-platform-common.mjs"
35
+ },
36
+ "./two-factor": {
37
+ "types": "./two-factor/index.d.ts",
38
+ "default": "./fesm2022/newheap-platform-common-two-factor.mjs"
39
+ }
40
+ },
25
41
  "license": "Apache-2.0",
26
42
  "description": "Shared Angular components, services and application infrastructure for NewHeap applications.",
27
43
  "repository": {
@@ -37,14 +53,5 @@
37
53
  "access": "public"
38
54
  },
39
55
  "module": "fesm2022/newheap-platform-common.mjs",
40
- "typings": "index.d.ts",
41
- "exports": {
42
- "./package.json": {
43
- "default": "./package.json"
44
- },
45
- ".": {
46
- "types": "./index.d.ts",
47
- "default": "./fesm2022/newheap-platform-common.mjs"
48
- }
49
- }
56
+ "typings": "index.d.ts"
50
57
  }
@@ -0,0 +1,93 @@
1
+ {
2
+ "nh-two-factor": {
3
+ "required": "Enter a code to finish signing in.",
4
+ "enrollment-required": "Set up two-step verification to continue.",
5
+ "invalid-code": "The code is not valid. Try the next code.",
6
+ "challenge-expired": "The sign-in expired. Sign in again.",
7
+ "locked-out": "Too many attempts. The account is temporarily locked.",
8
+ "method-not-allowed": "This method cannot be used for this account.",
9
+ "not-enabled": "Two-step verification is not turned on.",
10
+ "already-enabled": "Two-step verification is already turned on.",
11
+ "setup-not-started": "Start the setup first.",
12
+ "reauthentication-required": "Confirm your password or a code to continue.",
13
+ "reauthentication-failed": "The password or code is not correct.",
14
+ "required-by-policy": "Your organization requires two-step verification.",
15
+ "not-allowed-while-impersonating": "Two-step verification cannot be changed while impersonating.",
16
+ "configuration-invalid": "Two-step verification is not configured correctly.",
17
+ "email-cooldown": "Wait a moment before you request another code.",
18
+ "email-unavailable": "No confirmed e-mail address is available.",
19
+ "user-not-found": "The user was not found.",
20
+ "passkey-invalid": "The passkey could not be verified.",
21
+ "passkey-not-found": "The passkey was not found.",
22
+ "passkey-unavailable": "The passkey prompt was cancelled, or this browser does not support passkeys.",
23
+ "ui": {
24
+ "error": "Something went wrong. Try again.",
25
+ "challenge-title": "Two-step verification",
26
+ "settings-title": "Two-step verification",
27
+ "enrollment-title": "Set up two-step verification",
28
+ "enrollment-instructions": "Your organization requires a second step when you sign in. Choose how you want to confirm it is you.",
29
+ "method-label": "Verification method",
30
+ "method": {
31
+ "authenticator": "Authenticator app",
32
+ "recovery-code": "Recovery code",
33
+ "email": "E-mail code",
34
+ "passkey": "Passkey"
35
+ },
36
+ "code-label": {
37
+ "authenticator": "Code from your authenticator app",
38
+ "recovery-code": "Recovery code",
39
+ "email": "Code from the e-mail"
40
+ },
41
+ "verify": "Verify",
42
+ "verifying": "Verifying…",
43
+ "cancel": "Cancel",
44
+ "remember-device": "Remember this device",
45
+ "send-email-code": "E-mail me a code",
46
+ "resend-email-code": "Send a new code",
47
+ "email-code-sent": "We e-mailed a code. It expires at {{time}}.",
48
+ "use-passkey": "Use a passkey",
49
+ "passkey-verify-instructions": "Your browser asks you to confirm with a passkey on this device, your phone or a security key.",
50
+ "sign-in-with-passkey": "Sign in with a passkey",
51
+ "authenticator-instructions": "Scan the QR code with your authenticator app, or enter the key by hand. Then enter the code the app shows.",
52
+ "shared-key": "Key",
53
+ "qr-code-alt": "QR code for your authenticator app",
54
+ "confirm": "Confirm",
55
+ "email-instructions": "We send a code to your confirmed e-mail address.",
56
+ "passkey-instructions": "Create a passkey with the screen lock of this device, a password manager or a security key.",
57
+ "passkey-name": "Passkey name",
58
+ "create-passkey": "Create passkey",
59
+ "recovery-codes-title": "Recovery codes",
60
+ "recovery-codes-instructions": "Store these codes somewhere safe. Each code signs you in once when you cannot use your other methods. They are only shown now.",
61
+ "copy": "Copy",
62
+ "copied": "Copied",
63
+ "download": "Download",
64
+ "recovery-codes-saved": "I saved these codes",
65
+ "continue": "Continue",
66
+ "loading": "Loading…",
67
+ "status-enabled": "On",
68
+ "status-disabled": "Off",
69
+ "status-required": "Required by your organization",
70
+ "recovery-codes-left": "{{count}} recovery codes left",
71
+ "set-up-authenticator": "Set up authenticator app",
72
+ "change-authenticator": "Change authenticator app",
73
+ "set-up-email": "Use e-mail codes",
74
+ "passkeys-title": "Passkeys",
75
+ "no-passkeys": "No passkeys yet.",
76
+ "add-passkey": "Add passkey",
77
+ "rename": "Rename",
78
+ "save": "Save",
79
+ "remove": "Remove",
80
+ "passkey-created": "Added on {{date}}",
81
+ "passkey-synced": "Synced",
82
+ "regenerate-recovery-codes": "Create new recovery codes",
83
+ "forget-devices": "Forget remembered devices",
84
+ "disable": "Turn off two-step verification",
85
+ "reauthentication-title": "Confirm it is you",
86
+ "reauthentication-method": "Confirm with",
87
+ "password": "Password",
88
+ "devices-forgotten": "Every device asks for the second step again.",
89
+ "session-renewed": "Your other sessions were signed out.",
90
+ "change-saved": "Your change was saved."
91
+ }
92
+ }
93
+ }