@meistrari/auth-core 5.0.0 → 5.0.1
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/dist/index.d.mts +19 -17
- package/dist/index.d.ts +19 -17
- package/dist/index.mjs +4 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -399,6 +399,23 @@ declare class ApplicationTokenStorage {
|
|
|
399
399
|
protected wait(delayMs: number): Promise<void>;
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
+
/**
|
|
403
|
+
* Base error class for all SDK errors.
|
|
404
|
+
*
|
|
405
|
+
* Extends the native `Error` with a machine-readable `code` property
|
|
406
|
+
* that can be used for programmatic error handling.
|
|
407
|
+
*/
|
|
408
|
+
declare class BaseError extends Error {
|
|
409
|
+
/** Machine-readable error code (e.g. `"INVALID_SOCIAL_PROVIDER"`). */
|
|
410
|
+
code: string;
|
|
411
|
+
/**
|
|
412
|
+
* @param code - A machine-readable error code
|
|
413
|
+
* @param message - A human-readable error message
|
|
414
|
+
* @param options - Standard `ErrorOptions` (e.g. `cause`)
|
|
415
|
+
*/
|
|
416
|
+
constructor(code: string, message: string, options?: ErrorOptions);
|
|
417
|
+
}
|
|
418
|
+
|
|
402
419
|
declare const OAuthStepUpProvider: z__default.ZodEnum<{
|
|
403
420
|
google: "google";
|
|
404
421
|
microsoft: "microsoft";
|
|
@@ -427,28 +444,12 @@ declare const SENSITIVE_ACTION_ASSURANCE_POLICY: SessionAssurancePolicy;
|
|
|
427
444
|
* and their token refreshes are unaffected.
|
|
428
445
|
*/
|
|
429
446
|
declare const STEP_UP_MAX_AGE_SECONDS: number;
|
|
447
|
+
/** Ranks AAL1 as 1, AAL2 as 2 and AAL3 as 3, and anything else as 0. */
|
|
430
448
|
declare function getAalRank(aal: JWTPayload['assurance']['aal']): number;
|
|
431
449
|
declare function isAssuranceSufficientForPolicy(assurance: JWTPayload['assurance'] | null | undefined, policy: SessionAssurancePolicy, now?: Date): boolean;
|
|
432
450
|
declare function canStepUpWithAmr(assurance: JWTPayload['assurance'], amr: AMR): boolean;
|
|
433
451
|
declare function mergeStepUpAssurance(assurance: JWTPayload['assurance'], amr: AMR, now?: Date): JWTPayload['assurance'];
|
|
434
452
|
|
|
435
|
-
/**
|
|
436
|
-
* Base error class for all SDK errors.
|
|
437
|
-
*
|
|
438
|
-
* Extends the native `Error` with a machine-readable `code` property
|
|
439
|
-
* that can be used for programmatic error handling.
|
|
440
|
-
*/
|
|
441
|
-
declare class BaseError extends Error {
|
|
442
|
-
/** Machine-readable error code (e.g. `"INVALID_SOCIAL_PROVIDER"`). */
|
|
443
|
-
code: string;
|
|
444
|
-
/**
|
|
445
|
-
* @param code - A machine-readable error code
|
|
446
|
-
* @param message - A human-readable error message
|
|
447
|
-
* @param options - Standard `ErrorOptions` (e.g. `cause`)
|
|
448
|
-
*/
|
|
449
|
-
constructor(code: string, message: string, options?: ErrorOptions);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
453
|
declare const SessionAssuranceRequiredPayload: z__default.ZodObject<{
|
|
453
454
|
code: z__default.ZodEnum<{
|
|
454
455
|
session_assurance_required: "session_assurance_required";
|
|
@@ -5570,6 +5571,7 @@ declare class UserService {
|
|
|
5570
5571
|
* Unlinks an account from the current user. Requires an AAL2 session (gated
|
|
5571
5572
|
* server-side). The server refuses to remove the user's last account.
|
|
5572
5573
|
*
|
|
5574
|
+
* @param params - The account to unlink
|
|
5573
5575
|
* @param params.accountId - The account's `id` from {@link listAccounts}, not
|
|
5574
5576
|
* the provider's account identifier
|
|
5575
5577
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -399,6 +399,23 @@ declare class ApplicationTokenStorage {
|
|
|
399
399
|
protected wait(delayMs: number): Promise<void>;
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
+
/**
|
|
403
|
+
* Base error class for all SDK errors.
|
|
404
|
+
*
|
|
405
|
+
* Extends the native `Error` with a machine-readable `code` property
|
|
406
|
+
* that can be used for programmatic error handling.
|
|
407
|
+
*/
|
|
408
|
+
declare class BaseError extends Error {
|
|
409
|
+
/** Machine-readable error code (e.g. `"INVALID_SOCIAL_PROVIDER"`). */
|
|
410
|
+
code: string;
|
|
411
|
+
/**
|
|
412
|
+
* @param code - A machine-readable error code
|
|
413
|
+
* @param message - A human-readable error message
|
|
414
|
+
* @param options - Standard `ErrorOptions` (e.g. `cause`)
|
|
415
|
+
*/
|
|
416
|
+
constructor(code: string, message: string, options?: ErrorOptions);
|
|
417
|
+
}
|
|
418
|
+
|
|
402
419
|
declare const OAuthStepUpProvider: z__default.ZodEnum<{
|
|
403
420
|
google: "google";
|
|
404
421
|
microsoft: "microsoft";
|
|
@@ -427,28 +444,12 @@ declare const SENSITIVE_ACTION_ASSURANCE_POLICY: SessionAssurancePolicy;
|
|
|
427
444
|
* and their token refreshes are unaffected.
|
|
428
445
|
*/
|
|
429
446
|
declare const STEP_UP_MAX_AGE_SECONDS: number;
|
|
447
|
+
/** Ranks AAL1 as 1, AAL2 as 2 and AAL3 as 3, and anything else as 0. */
|
|
430
448
|
declare function getAalRank(aal: JWTPayload['assurance']['aal']): number;
|
|
431
449
|
declare function isAssuranceSufficientForPolicy(assurance: JWTPayload['assurance'] | null | undefined, policy: SessionAssurancePolicy, now?: Date): boolean;
|
|
432
450
|
declare function canStepUpWithAmr(assurance: JWTPayload['assurance'], amr: AMR): boolean;
|
|
433
451
|
declare function mergeStepUpAssurance(assurance: JWTPayload['assurance'], amr: AMR, now?: Date): JWTPayload['assurance'];
|
|
434
452
|
|
|
435
|
-
/**
|
|
436
|
-
* Base error class for all SDK errors.
|
|
437
|
-
*
|
|
438
|
-
* Extends the native `Error` with a machine-readable `code` property
|
|
439
|
-
* that can be used for programmatic error handling.
|
|
440
|
-
*/
|
|
441
|
-
declare class BaseError extends Error {
|
|
442
|
-
/** Machine-readable error code (e.g. `"INVALID_SOCIAL_PROVIDER"`). */
|
|
443
|
-
code: string;
|
|
444
|
-
/**
|
|
445
|
-
* @param code - A machine-readable error code
|
|
446
|
-
* @param message - A human-readable error message
|
|
447
|
-
* @param options - Standard `ErrorOptions` (e.g. `cause`)
|
|
448
|
-
*/
|
|
449
|
-
constructor(code: string, message: string, options?: ErrorOptions);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
453
|
declare const SessionAssuranceRequiredPayload: z__default.ZodObject<{
|
|
453
454
|
code: z__default.ZodEnum<{
|
|
454
455
|
session_assurance_required: "session_assurance_required";
|
|
@@ -5570,6 +5571,7 @@ declare class UserService {
|
|
|
5570
5571
|
* Unlinks an account from the current user. Requires an AAL2 session (gated
|
|
5571
5572
|
* server-side). The server refuses to remove the user's last account.
|
|
5572
5573
|
*
|
|
5574
|
+
* @param params - The account to unlink
|
|
5573
5575
|
* @param params.accountId - The account's `id` from {@link listAccounts}, not
|
|
5574
5576
|
* the provider's account identifier
|
|
5575
5577
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,7 @@ function isTokenExpired(token, expiresInMs) {
|
|
|
21
21
|
return nowInSeconds > expirationTime;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const version = "5.0.
|
|
24
|
+
const version = "5.0.1";
|
|
25
25
|
|
|
26
26
|
function parsedEnumValues(schema) {
|
|
27
27
|
return Object.fromEntries(
|
|
@@ -1464,17 +1464,9 @@ const SENSITIVE_ACTION_ASSURANCE_POLICY = {
|
|
|
1464
1464
|
acceptedAmr: [AMRs.Pwd, AMRs.Otp, AMRs.Oauth]
|
|
1465
1465
|
};
|
|
1466
1466
|
const STEP_UP_MAX_AGE_SECONDS = 15 * 60;
|
|
1467
|
+
const AALS_BY_STRENGTH = [AALs.Aal1, AALs.Aal2, AALs.Aal3];
|
|
1467
1468
|
function getAalRank(aal) {
|
|
1468
|
-
|
|
1469
|
-
case AALs.Aal3:
|
|
1470
|
-
return 3;
|
|
1471
|
-
case AALs.Aal2:
|
|
1472
|
-
return 2;
|
|
1473
|
-
case AALs.Aal1:
|
|
1474
|
-
return 1;
|
|
1475
|
-
default:
|
|
1476
|
-
return 0;
|
|
1477
|
-
}
|
|
1469
|
+
return AALS_BY_STRENGTH.indexOf(aal) + 1;
|
|
1478
1470
|
}
|
|
1479
1471
|
function maxAal(left, right) {
|
|
1480
1472
|
return getAalRank(left) >= getAalRank(right) ? left : right;
|
|
@@ -2699,6 +2691,7 @@ class UserService {
|
|
|
2699
2691
|
* Unlinks an account from the current user. Requires an AAL2 session (gated
|
|
2700
2692
|
* server-side). The server refuses to remove the user's last account.
|
|
2701
2693
|
*
|
|
2694
|
+
* @param params - The account to unlink
|
|
2702
2695
|
* @param params.accountId - The account's `id` from {@link listAccounts}, not
|
|
2703
2696
|
* the provider's account identifier
|
|
2704
2697
|
*/
|