@nauth-toolkit/client-angular 0.1.108 → 0.1.111
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.
|
@@ -529,19 +529,84 @@ export declare class AuthService {
|
|
|
529
529
|
deviceId: number;
|
|
530
530
|
}>;
|
|
531
531
|
/**
|
|
532
|
-
* Remove MFA device.
|
|
532
|
+
* Remove a single MFA device by device ID.
|
|
533
533
|
*
|
|
534
|
-
*
|
|
535
|
-
*
|
|
534
|
+
* **Recommended:** Use this for granular device management.
|
|
535
|
+
*
|
|
536
|
+
* @param deviceId - MFA device ID
|
|
537
|
+
* @returns Removal response
|
|
536
538
|
*
|
|
537
539
|
* @example
|
|
538
540
|
* ```typescript
|
|
539
|
-
* await this.auth.
|
|
541
|
+
* const devices = await this.auth.getMfaDevices();
|
|
542
|
+
* await this.auth.removeMfaDeviceById(devices[0].id);
|
|
540
543
|
* ```
|
|
541
544
|
*/
|
|
542
|
-
|
|
543
|
-
|
|
545
|
+
removeMfaDeviceById(deviceId: number): Promise<import('@nauth-toolkit/client').RemoveMFADeviceResponse>;
|
|
546
|
+
/**
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Select an MFA device for verification (during challenge flow)
|
|
550
|
+
*
|
|
551
|
+
* Call this when user selects a specific device from the MFA selector UI.
|
|
552
|
+
* SDK stores the deviceId internally and auto-injects it when respondToChallenge() is called.
|
|
553
|
+
*
|
|
554
|
+
* @param deviceId - ID of the device user selected
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```typescript
|
|
558
|
+
* // User clicks "Microsoft Authenticator" button
|
|
559
|
+
* this.auth.selectMFADevice(48);
|
|
560
|
+
*
|
|
561
|
+
* // Navigate to OTP verification (no deviceId in query params needed!)
|
|
562
|
+
* this.router.navigate(['/auth/challenge/mfa-required']);
|
|
563
|
+
*
|
|
564
|
+
* // Later, when submitting OTP code:
|
|
565
|
+
* await this.auth.respondToChallenge({
|
|
566
|
+
* type: 'MFA_REQUIRED',
|
|
567
|
+
* session: 'abc123',
|
|
568
|
+
* method: 'totp',
|
|
569
|
+
* code: '123456',
|
|
570
|
+
* // SDK auto-injects deviceId=48 here!
|
|
571
|
+
* });
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
574
|
+
selectMFADevice(deviceId: number): void;
|
|
575
|
+
/**
|
|
576
|
+
* Get available MFA devices from challenge response
|
|
577
|
+
*
|
|
578
|
+
* Returns array of devices for methods that support multiple devices (TOTP, Passkey).
|
|
579
|
+
* Use this to render device selection UI only.
|
|
580
|
+
*
|
|
581
|
+
* @param challenge - Challenge response from login/signup
|
|
582
|
+
* @returns Array of MFA devices with id, name, and type
|
|
583
|
+
*
|
|
584
|
+
* @example
|
|
585
|
+
* ```typescript
|
|
586
|
+
* // In MFA selector component
|
|
587
|
+
* const devices = this.auth.getMFADevicesFromChallenge(this.challenge());
|
|
588
|
+
* // Returns: [
|
|
589
|
+
* // { id: 48, name: "Microsoft Authenticator", type: "totp" },
|
|
590
|
+
* // { id: 3, name: "Google Authenticator", type: "totp" }
|
|
591
|
+
* // ]
|
|
592
|
+
*
|
|
593
|
+
* // Render device buttons
|
|
594
|
+
* for (const device of devices) {
|
|
595
|
+
* // <button (click)="selectDevice(device)">{{ device.name }}</button>
|
|
596
|
+
* }
|
|
597
|
+
* ```
|
|
598
|
+
*/
|
|
599
|
+
getMFADevicesFromChallenge(challenge: AuthResponse): Array<{
|
|
600
|
+
id: number;
|
|
601
|
+
name: string;
|
|
602
|
+
type: string;
|
|
544
603
|
}>;
|
|
604
|
+
/**
|
|
605
|
+
* Clear any selected MFA device
|
|
606
|
+
*
|
|
607
|
+
* Useful if user navigates back to device selector or cancels MFA flow.
|
|
608
|
+
*/
|
|
609
|
+
clearSelectedMFADevice(): void;
|
|
545
610
|
/**
|
|
546
611
|
* Set preferred MFA method.
|
|
547
612
|
*
|
|
@@ -553,7 +618,13 @@ export declare class AuthService {
|
|
|
553
618
|
* await this.auth.setPreferredMfaMethod('totp');
|
|
554
619
|
* ```
|
|
555
620
|
*/
|
|
556
|
-
|
|
621
|
+
/**
|
|
622
|
+
* Set a specific MFA device as preferred.
|
|
623
|
+
*
|
|
624
|
+
* @param deviceId - MFA device ID
|
|
625
|
+
* @returns Promise with success message
|
|
626
|
+
*/
|
|
627
|
+
setPreferredMfaDevice(deviceId: number): Promise<{
|
|
557
628
|
message: string;
|
|
558
629
|
}>;
|
|
559
630
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nauth-toolkit/client-angular",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.111",
|
|
4
4
|
"description": "Angular adapter for nauth-toolkit client SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nauth",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@angular/common": ">=17.0.0",
|
|
26
26
|
"@angular/core": ">=17.0.0",
|
|
27
|
-
"@nauth-toolkit/client": "^0.1.
|
|
27
|
+
"@nauth-toolkit/client": "^0.1.111",
|
|
28
28
|
"rxjs": "^7.0.0 || ^8.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|