@schemavaults/auth-common 0.12.9 → 0.12.15
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/auth-error-message-catalog.d.ts +1 -1
- package/dist/auth-error-message-catalog.js +2 -0
- package/dist/auth-error-message-catalog.js.map +1 -1
- package/dist/auth_acquire_tokens_grant_types.d.ts +6 -0
- package/dist/auth_acquire_tokens_grant_types.js +8 -0
- package/dist/auth_acquire_tokens_grant_types.js.map +1 -1
- package/dist/authenticate_result.d.ts +66 -0
- package/dist/authenticate_result.js +10 -0
- package/dist/authenticate_result.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mfa/index.d.ts +1 -1
- package/dist/mfa/index.js +1 -1
- package/dist/mfa/index.js.map +1 -1
- package/dist/mfa/mfa-verify-body.d.ts +100 -5
- package/dist/mfa/mfa-verify-body.js +59 -4
- package/dist/mfa/mfa-verify-body.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const ERROR_IDS: readonly ["unknown", "bad_request", "app_id_not_found", "api_server_id_not_found", "unauthenticated", "forbidden", "account_disabled", "load_user_data_failure", "internal_server_error", "load_server_config_failure", "server_misconfiguration", "account_not_in_organization", "pkce_challenge_expired"];
|
|
1
|
+
declare const ERROR_IDS: readonly ["unknown", "bad_request", "app_id_not_found", "api_server_id_not_found", "unauthenticated", "forbidden", "account_disabled", "load_user_data_failure", "internal_server_error", "load_server_config_failure", "server_misconfiguration", "account_not_in_organization", "pkce_challenge_expired", "invalid_redirect_uri"];
|
|
2
2
|
export type SchemaVaultsAuthErrorId = (typeof ERROR_IDS)[number];
|
|
3
3
|
export declare const ERROR_MESSAGE_CATALOG: Record<SchemaVaultsAuthErrorId, string>;
|
|
4
4
|
export declare function isValidErrorId(id: string): id is SchemaVaultsAuthErrorId;
|
|
@@ -12,6 +12,7 @@ const ERROR_IDS = [
|
|
|
12
12
|
"server_misconfiguration",
|
|
13
13
|
"account_not_in_organization",
|
|
14
14
|
"pkce_challenge_expired",
|
|
15
|
+
"invalid_redirect_uri",
|
|
15
16
|
];
|
|
16
17
|
export const ERROR_MESSAGE_CATALOG = {
|
|
17
18
|
unknown: "An unknown error occurred",
|
|
@@ -27,6 +28,7 @@ export const ERROR_MESSAGE_CATALOG = {
|
|
|
27
28
|
server_misconfiguration: "The server does not appear to be configured properly. If you are the site admin, please see the logs for more details.",
|
|
28
29
|
account_not_in_organization: "Your account is not a member of the organization required for the attempted action.",
|
|
29
30
|
pkce_challenge_expired: "Your authorization session has expired. Please return to the requesting application and try again.",
|
|
31
|
+
invalid_redirect_uri: "The redirect URI presented by the requesting application is not registered for it. For your safety, login has been blocked.",
|
|
30
32
|
};
|
|
31
33
|
export function isValidErrorId(id) {
|
|
32
34
|
return ERROR_IDS.includes(id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-error-message-catalog.js","sourceRoot":"","sources":["../src/auth-error-message-catalog.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG;IAChB,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,yBAAyB;IACzB,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,wBAAwB;IACxB,uBAAuB;IACvB,4BAA4B;IAC5B,yBAAyB;IACzB,6BAA6B;IAC7B,wBAAwB;
|
|
1
|
+
{"version":3,"file":"auth-error-message-catalog.js","sourceRoot":"","sources":["../src/auth-error-message-catalog.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG;IAChB,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,yBAAyB;IACzB,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,wBAAwB;IACxB,uBAAuB;IACvB,4BAA4B;IAC5B,yBAAyB;IACzB,6BAA6B;IAC7B,wBAAwB;IACxB,sBAAsB;CACc,CAAC;AAIvC,MAAM,CAAC,MAAM,qBAAqB,GAA4C;IAC5E,OAAO,EAAE,2BAA2B;IACpC,WAAW,EAAE,wCAAwC;IACrD,gBAAgB,EAAE,kCAAkC;IACpD,uBAAuB,EAAE,wCAAwC;IACjE,eAAe,EACb,iGAAiG;IACnG,SAAS,EACP,gHAAgH;IAClH,gBAAgB,EAAE,iCAAiC;IACnD,sBAAsB,EACpB,4EAA4E;IAC9E,qBAAqB,EACnB,qFAAqF;IACvF,0BAA0B,EACxB,4DAA4D;IAC9D,uBAAuB,EACrB,wHAAwH;IAC1H,2BAA2B,EACzB,qFAAqF;IACvF,sBAAsB,EACpB,oGAAoG;IACtG,oBAAoB,EAClB,6HAA6H;CAChI,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAO,SAAS,CAAC,QAAQ,CAAC,EAA8C,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -7,6 +7,7 @@ export declare const authorizationCodePOSTbody: z.ZodObject<{
|
|
|
7
7
|
audience: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, "many">]>;
|
|
8
8
|
client_app_id: z.ZodUnion<readonly [z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
|
|
9
9
|
grant_type: z.ZodLiteral<"authorization_code">;
|
|
10
|
+
redirect_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
11
|
}, "strict", z.ZodTypeAny, {
|
|
11
12
|
code: string;
|
|
12
13
|
challenge_time: number;
|
|
@@ -14,6 +15,7 @@ export declare const authorizationCodePOSTbody: z.ZodObject<{
|
|
|
14
15
|
audience: string | string[];
|
|
15
16
|
client_app_id: string;
|
|
16
17
|
grant_type: "authorization_code";
|
|
18
|
+
redirect_uri?: string | null | undefined;
|
|
17
19
|
}, {
|
|
18
20
|
code: string;
|
|
19
21
|
challenge_time: number;
|
|
@@ -21,6 +23,7 @@ export declare const authorizationCodePOSTbody: z.ZodObject<{
|
|
|
21
23
|
audience: string | string[];
|
|
22
24
|
client_app_id: string;
|
|
23
25
|
grant_type: "authorization_code";
|
|
26
|
+
redirect_uri?: string | null | undefined;
|
|
24
27
|
}>;
|
|
25
28
|
export declare const refreshTokenPOSTbody: z.ZodObject<{
|
|
26
29
|
audience: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, "many">]>;
|
|
@@ -46,6 +49,7 @@ export declare const grantTypePOSTbodySchemaMap: {
|
|
|
46
49
|
audience: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, "many">]>;
|
|
47
50
|
client_app_id: z.ZodUnion<readonly [z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
|
|
48
51
|
grant_type: z.ZodLiteral<"authorization_code">;
|
|
52
|
+
redirect_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
53
|
}, "strict", z.ZodTypeAny, {
|
|
50
54
|
code: string;
|
|
51
55
|
challenge_time: number;
|
|
@@ -53,6 +57,7 @@ export declare const grantTypePOSTbodySchemaMap: {
|
|
|
53
57
|
audience: string | string[];
|
|
54
58
|
client_app_id: string;
|
|
55
59
|
grant_type: "authorization_code";
|
|
60
|
+
redirect_uri?: string | null | undefined;
|
|
56
61
|
}, {
|
|
57
62
|
code: string;
|
|
58
63
|
challenge_time: number;
|
|
@@ -60,6 +65,7 @@ export declare const grantTypePOSTbodySchemaMap: {
|
|
|
60
65
|
audience: string | string[];
|
|
61
66
|
client_app_id: string;
|
|
62
67
|
grant_type: "authorization_code";
|
|
68
|
+
redirect_uri?: string | null | undefined;
|
|
63
69
|
}>;
|
|
64
70
|
readonly refresh_token: z.ZodObject<{
|
|
65
71
|
audience: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, "many">]>;
|
|
@@ -20,6 +20,14 @@ export const authorizationCodePOSTbody = _createTokenEndpointBaseSchema
|
|
|
20
20
|
.refine((value) => /^[A-Za-z0-9_-]+$/.test(value)),
|
|
21
21
|
code_verifier: PKCE_ProofKeyManager.codeChallengeSchema,
|
|
22
22
|
challenge_time: z.number().nonnegative(),
|
|
23
|
+
// OAuth2 `redirect_uri` (RFC 6749 §4.1.3) bound to the issued
|
|
24
|
+
// authorization code. The token endpoint verifies this matches the
|
|
25
|
+
// value persisted on the authorization_codes row by exact string
|
|
26
|
+
// equality, so a code minted for URI A cannot be redeemed by
|
|
27
|
+
// presenting URI B even when both share an allowlisted origin.
|
|
28
|
+
// Null/absent is reserved for the auth server's own account flow,
|
|
29
|
+
// which has no third-party callback.
|
|
30
|
+
redirect_uri: z.string().url().nullable().optional(),
|
|
23
31
|
})
|
|
24
32
|
.required({
|
|
25
33
|
grant_type: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth_acquire_tokens_grant_types.js","sourceRoot":"","sources":["../src/auth_acquire_tokens_grant_types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,Q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IACxC,kBAAkB,EAAE,yBAAyB;IAC7C,aAAa,EAAE,oBAAoB;CAC+B,CAAC"}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const availableMfaFactorSchema: z.ZodObject<{
|
|
3
|
+
factor_id: z.ZodString;
|
|
4
|
+
factor_type: z.ZodEnum<["totp"]>;
|
|
5
|
+
last_used_at: z.ZodNullable<z.ZodNumber>;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
factor_id: string;
|
|
8
|
+
factor_type: "totp";
|
|
9
|
+
last_used_at: number | null;
|
|
10
|
+
}, {
|
|
11
|
+
factor_id: string;
|
|
12
|
+
factor_type: "totp";
|
|
13
|
+
last_used_at: number | null;
|
|
14
|
+
}>;
|
|
15
|
+
export type AvailableMfaFactor = z.infer<typeof availableMfaFactorSchema>;
|
|
2
16
|
export declare const authenticatedAuthenticateResultSchema: z.ZodObject<{
|
|
3
17
|
kind: z.ZodLiteral<"authenticated">;
|
|
4
18
|
success: z.ZodBoolean;
|
|
@@ -22,18 +36,44 @@ export declare const mfaRequiredAuthenticateResultSchema: z.ZodObject<{
|
|
|
22
36
|
message: z.ZodString;
|
|
23
37
|
challenge_id: z.ZodString;
|
|
24
38
|
expires_at: z.ZodNumber;
|
|
39
|
+
available_factors: z.ZodArray<z.ZodObject<{
|
|
40
|
+
factor_id: z.ZodString;
|
|
41
|
+
factor_type: z.ZodEnum<["totp"]>;
|
|
42
|
+
last_used_at: z.ZodNullable<z.ZodNumber>;
|
|
43
|
+
}, "strict", z.ZodTypeAny, {
|
|
44
|
+
factor_id: string;
|
|
45
|
+
factor_type: "totp";
|
|
46
|
+
last_used_at: number | null;
|
|
47
|
+
}, {
|
|
48
|
+
factor_id: string;
|
|
49
|
+
factor_type: "totp";
|
|
50
|
+
last_used_at: number | null;
|
|
51
|
+
}>, "many">;
|
|
52
|
+
recovery_codes_available: z.ZodBoolean;
|
|
25
53
|
}, "strict", z.ZodTypeAny, {
|
|
26
54
|
message: string;
|
|
27
55
|
expires_at: number;
|
|
28
56
|
kind: "mfa_required";
|
|
29
57
|
success: boolean;
|
|
30
58
|
challenge_id: string;
|
|
59
|
+
available_factors: {
|
|
60
|
+
factor_id: string;
|
|
61
|
+
factor_type: "totp";
|
|
62
|
+
last_used_at: number | null;
|
|
63
|
+
}[];
|
|
64
|
+
recovery_codes_available: boolean;
|
|
31
65
|
}, {
|
|
32
66
|
message: string;
|
|
33
67
|
expires_at: number;
|
|
34
68
|
kind: "mfa_required";
|
|
35
69
|
success: boolean;
|
|
36
70
|
challenge_id: string;
|
|
71
|
+
available_factors: {
|
|
72
|
+
factor_id: string;
|
|
73
|
+
factor_type: "totp";
|
|
74
|
+
last_used_at: number | null;
|
|
75
|
+
}[];
|
|
76
|
+
recovery_codes_available: boolean;
|
|
37
77
|
}>;
|
|
38
78
|
export type MfaRequiredAuthenticateResult = z.infer<typeof mfaRequiredAuthenticateResultSchema>;
|
|
39
79
|
export declare const authenticateFailureResultSchema: z.ZodObject<{
|
|
@@ -85,18 +125,44 @@ export declare const authenticateResultSchema: z.ZodDiscriminatedUnion<"kind", [
|
|
|
85
125
|
message: z.ZodString;
|
|
86
126
|
challenge_id: z.ZodString;
|
|
87
127
|
expires_at: z.ZodNumber;
|
|
128
|
+
available_factors: z.ZodArray<z.ZodObject<{
|
|
129
|
+
factor_id: z.ZodString;
|
|
130
|
+
factor_type: z.ZodEnum<["totp"]>;
|
|
131
|
+
last_used_at: z.ZodNullable<z.ZodNumber>;
|
|
132
|
+
}, "strict", z.ZodTypeAny, {
|
|
133
|
+
factor_id: string;
|
|
134
|
+
factor_type: "totp";
|
|
135
|
+
last_used_at: number | null;
|
|
136
|
+
}, {
|
|
137
|
+
factor_id: string;
|
|
138
|
+
factor_type: "totp";
|
|
139
|
+
last_used_at: number | null;
|
|
140
|
+
}>, "many">;
|
|
141
|
+
recovery_codes_available: z.ZodBoolean;
|
|
88
142
|
}, "strict", z.ZodTypeAny, {
|
|
89
143
|
message: string;
|
|
90
144
|
expires_at: number;
|
|
91
145
|
kind: "mfa_required";
|
|
92
146
|
success: boolean;
|
|
93
147
|
challenge_id: string;
|
|
148
|
+
available_factors: {
|
|
149
|
+
factor_id: string;
|
|
150
|
+
factor_type: "totp";
|
|
151
|
+
last_used_at: number | null;
|
|
152
|
+
}[];
|
|
153
|
+
recovery_codes_available: boolean;
|
|
94
154
|
}, {
|
|
95
155
|
message: string;
|
|
96
156
|
expires_at: number;
|
|
97
157
|
kind: "mfa_required";
|
|
98
158
|
success: boolean;
|
|
99
159
|
challenge_id: string;
|
|
160
|
+
available_factors: {
|
|
161
|
+
factor_id: string;
|
|
162
|
+
factor_type: "totp";
|
|
163
|
+
last_used_at: number | null;
|
|
164
|
+
}[];
|
|
165
|
+
recovery_codes_available: boolean;
|
|
100
166
|
}>, z.ZodObject<{
|
|
101
167
|
kind: z.ZodLiteral<"failure">;
|
|
102
168
|
success: z.ZodBoolean;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { mfaFactorTypeSchema } from "./mfa/mfa-factor-type";
|
|
3
|
+
export const availableMfaFactorSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
factor_id: z.string().uuid(),
|
|
6
|
+
factor_type: mfaFactorTypeSchema,
|
|
7
|
+
last_used_at: z.number().int().positive().nullable(),
|
|
8
|
+
})
|
|
9
|
+
.strict();
|
|
2
10
|
export const authenticatedAuthenticateResultSchema = z
|
|
3
11
|
.object({
|
|
4
12
|
kind: z.literal("authenticated"),
|
|
@@ -16,6 +24,8 @@ export const mfaRequiredAuthenticateResultSchema = z
|
|
|
16
24
|
message: z.string(),
|
|
17
25
|
challenge_id: z.string().uuid(),
|
|
18
26
|
expires_at: z.number().int().positive(),
|
|
27
|
+
available_factors: z.array(availableMfaFactorSchema),
|
|
28
|
+
recovery_codes_available: z.boolean(),
|
|
19
29
|
})
|
|
20
30
|
.strict();
|
|
21
31
|
export const authenticateFailureResultSchema = z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate_result.js","sourceRoot":"","sources":["../src/authenticate_result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"authenticate_result.js","sourceRoot":"","sources":["../src/authenticate_result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC5B,WAAW,EAAE,mBAAmB;IAChC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACrD,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC;KACnD,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;IAChC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,kBAAkB,EAAE,CAAC;SAClB,MAAM,EAAE;SACR,GAAG,CAAC,EAAE,EAAE,wDAAwD,CAAC;CACrE,CAAC;KACD,MAAM,EAAE,CAAC;AAMZ,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC;KACjD,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;IAC/B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvC,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC;IACpD,wBAAwB,EAAE,CAAC,CAAC,OAAO,EAAE;CACtC,CAAC;KACD,MAAM,EAAE,CAAC;AAMZ,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC;KAC7C,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC;KACD,MAAM,EAAE,CAAC;AAMZ,uEAAuE;AACvE,0EAA0E;AAC1E,uEAAuE;AACvE,2EAA2E;AAC3E,2DAA2D;AAC3D,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC;KACtD,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC;IACpC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC;KACD,MAAM,EAAE,CAAC;AAMZ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACnE,qCAAqC;IACrC,mCAAmC;IACnC,+BAA+B;IAC/B,wCAAwC;CACzC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export * from "./middleware";
|
|
|
10
10
|
export type * from "./middleware";
|
|
11
11
|
export * from "./pkce";
|
|
12
12
|
export type * from "./pkce";
|
|
13
|
-
export { authenticateResultSchema, authenticatedAuthenticateResultSchema, mfaRequiredAuthenticateResultSchema, authenticateFailureResultSchema, challengeExpiredAuthenticateResultSchema, type AuthenticateResult, type AuthenticatedAuthenticateResult, type MfaRequiredAuthenticateResult, type AuthenticateFailureResult, type ChallengeExpiredAuthenticateResult, } from "./authenticate_result";
|
|
13
|
+
export { authenticateResultSchema, authenticatedAuthenticateResultSchema, mfaRequiredAuthenticateResultSchema, authenticateFailureResultSchema, challengeExpiredAuthenticateResultSchema, availableMfaFactorSchema, type AuthenticateResult, type AuthenticatedAuthenticateResult, type MfaRequiredAuthenticateResult, type AuthenticateFailureResult, type ChallengeExpiredAuthenticateResult, type AvailableMfaFactor, } from "./authenticate_result";
|
|
14
14
|
export * from "./mfa";
|
|
15
15
|
export { requestTokensResultSchema, type RequestTokensResult, successfullyGeneratedTokensRecordSchema, type SuccessfullyGeneratedTokensRecord, } from "./request_tokens_result";
|
|
16
16
|
export * from "./auth_acquire_tokens_grant_types";
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export * from "./credentials";
|
|
|
5
5
|
export * from "./token-data";
|
|
6
6
|
export * from "./middleware";
|
|
7
7
|
export * from "./pkce";
|
|
8
|
-
export { authenticateResultSchema, authenticatedAuthenticateResultSchema, mfaRequiredAuthenticateResultSchema, authenticateFailureResultSchema, challengeExpiredAuthenticateResultSchema, } from "./authenticate_result";
|
|
8
|
+
export { authenticateResultSchema, authenticatedAuthenticateResultSchema, mfaRequiredAuthenticateResultSchema, authenticateFailureResultSchema, challengeExpiredAuthenticateResultSchema, availableMfaFactorSchema, } from "./authenticate_result";
|
|
9
9
|
export * from "./mfa";
|
|
10
10
|
export { requestTokensResultSchema, successfullyGeneratedTokensRecordSchema, } from "./request_tokens_result";
|
|
11
11
|
export * from "./auth_acquire_tokens_grant_types";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,GACf,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAiB,MAAM,aAAa,CAAC;AAE5D,cAAc,eAAe,CAAC;AAG9B,mBAAmB;AACnB,cAAc,cAA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M,iBAAiB,CAAC;AAezB,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EACL,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,wCAAwC,EAAE,MAAM,4CAA4C,CAAC;AAEtG,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAE9F,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC"}
|
package/dist/mfa/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { mfaFactorTypes, mfaFactorTypeSchema, isValidMfaFactorType, type MfaFactorType, } from "./mfa-factor-type";
|
|
2
2
|
export { mfaChallengeSchema, type MfaChallengeDescriptor, } from "./mfa-challenge";
|
|
3
|
-
export { totpCodeSchema, recoveryCodeSchema, mfaVerifyBodySchema, mfaEnrollResponseSchema, mfaVerifyEnrollmentBodySchema, mfaVerifyEnrollmentResponseSchema, mfaStatusResponseSchema, mfaCodeOnlyBodySchema, type MfaVerifyBody, type MfaEnrollResponse, type MfaVerifyEnrollmentBody, type MfaVerifyEnrollmentResponse, type MfaStatusResponse, type MfaCodeOnlyBody, } from "./mfa-verify-body";
|
|
3
|
+
export { totpCodeSchema, recoveryCodeSchema, mfaVerifyBodySchema, mfaEnrollResponseSchema, mfaVerifyEnrollmentBodySchema, mfaVerifyEnrollmentResponseSchema, mfaStatusResponseSchema, mfaFactorStatusResponseSchema, mfaEnrolledFactorSchema, mfaCodeOnlyBodySchema, mfaTotpProofBodySchema, mfaChallengeFactorsPayloadSchema, type MfaVerifyBody, type MfaEnrollResponse, type MfaVerifyEnrollmentBody, type MfaVerifyEnrollmentResponse, type MfaStatusResponse, type MfaFactorStatusResponse, type MfaEnrolledFactor, type MfaCodeOnlyBody, type MfaTotpProofBody, type MfaChallengeFactorsPayload, } from "./mfa-verify-body";
|
package/dist/mfa/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { mfaFactorTypes, mfaFactorTypeSchema, isValidMfaFactorType, } from "./mfa-factor-type";
|
|
2
2
|
export { mfaChallengeSchema, } from "./mfa-challenge";
|
|
3
|
-
export { totpCodeSchema, recoveryCodeSchema, mfaVerifyBodySchema, mfaEnrollResponseSchema, mfaVerifyEnrollmentBodySchema, mfaVerifyEnrollmentResponseSchema, mfaStatusResponseSchema, mfaCodeOnlyBodySchema, } from "./mfa-verify-body";
|
|
3
|
+
export { totpCodeSchema, recoveryCodeSchema, mfaVerifyBodySchema, mfaEnrollResponseSchema, mfaVerifyEnrollmentBodySchema, mfaVerifyEnrollmentResponseSchema, mfaStatusResponseSchema, mfaFactorStatusResponseSchema, mfaEnrolledFactorSchema, mfaCodeOnlyBodySchema, mfaTotpProofBodySchema, mfaChallengeFactorsPayloadSchema, } from "./mfa-verify-body";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/mfa/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mfa/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,GAEnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,6BAA6B,EAC7B,iCAAiC,EACjC,uBAAuB,EACvB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mfa/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,GAEnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,6BAA6B,EAC7B,iCAAiC,EACjC,uBAAuB,EACvB,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,gCAAgC,GAWjC,MAAM,mBAAmB,CAAC"}
|
|
@@ -6,13 +6,16 @@ export declare const mfaVerifyBodySchema: z.ZodObject<{
|
|
|
6
6
|
client_app_id: z.ZodUnion<readonly [z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
|
|
7
7
|
proof: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
8
8
|
type: z.ZodLiteral<"totp">;
|
|
9
|
+
factor_id: z.ZodString;
|
|
9
10
|
code: z.ZodString;
|
|
10
11
|
}, "strict", z.ZodTypeAny, {
|
|
11
12
|
code: string;
|
|
12
13
|
type: "totp";
|
|
14
|
+
factor_id: string;
|
|
13
15
|
}, {
|
|
14
16
|
code: string;
|
|
15
17
|
type: "totp";
|
|
18
|
+
factor_id: string;
|
|
16
19
|
}>, z.ZodObject<{
|
|
17
20
|
type: z.ZodLiteral<"recovery_code">;
|
|
18
21
|
recovery_code: z.ZodString;
|
|
@@ -29,6 +32,7 @@ export declare const mfaVerifyBodySchema: z.ZodObject<{
|
|
|
29
32
|
proof: {
|
|
30
33
|
code: string;
|
|
31
34
|
type: "totp";
|
|
35
|
+
factor_id: string;
|
|
32
36
|
} | {
|
|
33
37
|
type: "recovery_code";
|
|
34
38
|
recovery_code: string;
|
|
@@ -39,6 +43,7 @@ export declare const mfaVerifyBodySchema: z.ZodObject<{
|
|
|
39
43
|
proof: {
|
|
40
44
|
code: string;
|
|
41
45
|
type: "totp";
|
|
46
|
+
factor_id: string;
|
|
42
47
|
} | {
|
|
43
48
|
type: "recovery_code";
|
|
44
49
|
recovery_code: string;
|
|
@@ -87,24 +92,72 @@ export declare const mfaVerifyEnrollmentResponseSchema: z.ZodObject<{
|
|
|
87
92
|
recovery_codes: string[];
|
|
88
93
|
}>;
|
|
89
94
|
export type MfaVerifyEnrollmentResponse = z.infer<typeof mfaVerifyEnrollmentResponseSchema>;
|
|
90
|
-
export declare const
|
|
95
|
+
export declare const mfaFactorStatusResponseSchema: z.ZodObject<{
|
|
91
96
|
enabled: z.ZodBoolean;
|
|
97
|
+
pending: z.ZodBoolean;
|
|
92
98
|
factor_id: z.ZodOptional<z.ZodString>;
|
|
93
|
-
factor_type: z.ZodOptional<z.
|
|
99
|
+
factor_type: z.ZodOptional<z.ZodEnum<["totp"]>>;
|
|
94
100
|
verified_at: z.ZodOptional<z.ZodNumber>;
|
|
95
|
-
recovery_codes_remaining: z.ZodOptional<z.ZodNumber>;
|
|
96
101
|
}, "strict", z.ZodTypeAny, {
|
|
97
102
|
enabled: boolean;
|
|
103
|
+
pending: boolean;
|
|
98
104
|
factor_id?: string | undefined;
|
|
99
105
|
factor_type?: "totp" | undefined;
|
|
100
106
|
verified_at?: number | undefined;
|
|
101
|
-
recovery_codes_remaining?: number | undefined;
|
|
102
107
|
}, {
|
|
103
108
|
enabled: boolean;
|
|
109
|
+
pending: boolean;
|
|
104
110
|
factor_id?: string | undefined;
|
|
105
111
|
factor_type?: "totp" | undefined;
|
|
106
112
|
verified_at?: number | undefined;
|
|
107
|
-
|
|
113
|
+
}>;
|
|
114
|
+
export type MfaFactorStatusResponse = z.infer<typeof mfaFactorStatusResponseSchema>;
|
|
115
|
+
export declare const mfaEnrolledFactorSchema: z.ZodObject<{
|
|
116
|
+
factor_id: z.ZodString;
|
|
117
|
+
factor_type: z.ZodEnum<["totp"]>;
|
|
118
|
+
verified_at: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
}, "strict", z.ZodTypeAny, {
|
|
120
|
+
factor_id: string;
|
|
121
|
+
factor_type: "totp";
|
|
122
|
+
verified_at?: number | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
factor_id: string;
|
|
125
|
+
factor_type: "totp";
|
|
126
|
+
verified_at?: number | undefined;
|
|
127
|
+
}>;
|
|
128
|
+
export type MfaEnrolledFactor = z.infer<typeof mfaEnrolledFactorSchema>;
|
|
129
|
+
export declare const mfaStatusResponseSchema: z.ZodObject<{
|
|
130
|
+
enabled: z.ZodBoolean;
|
|
131
|
+
factors: z.ZodArray<z.ZodObject<{
|
|
132
|
+
factor_id: z.ZodString;
|
|
133
|
+
factor_type: z.ZodEnum<["totp"]>;
|
|
134
|
+
verified_at: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
}, "strict", z.ZodTypeAny, {
|
|
136
|
+
factor_id: string;
|
|
137
|
+
factor_type: "totp";
|
|
138
|
+
verified_at?: number | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
factor_id: string;
|
|
141
|
+
factor_type: "totp";
|
|
142
|
+
verified_at?: number | undefined;
|
|
143
|
+
}>, "many">;
|
|
144
|
+
recovery_codes_remaining: z.ZodNumber;
|
|
145
|
+
}, "strict", z.ZodTypeAny, {
|
|
146
|
+
enabled: boolean;
|
|
147
|
+
factors: {
|
|
148
|
+
factor_id: string;
|
|
149
|
+
factor_type: "totp";
|
|
150
|
+
verified_at?: number | undefined;
|
|
151
|
+
}[];
|
|
152
|
+
recovery_codes_remaining: number;
|
|
153
|
+
}, {
|
|
154
|
+
enabled: boolean;
|
|
155
|
+
factors: {
|
|
156
|
+
factor_id: string;
|
|
157
|
+
factor_type: "totp";
|
|
158
|
+
verified_at?: number | undefined;
|
|
159
|
+
}[];
|
|
160
|
+
recovery_codes_remaining: number;
|
|
108
161
|
}>;
|
|
109
162
|
export type MfaStatusResponse = z.infer<typeof mfaStatusResponseSchema>;
|
|
110
163
|
export declare const mfaCodeOnlyBodySchema: z.ZodObject<{
|
|
@@ -115,3 +168,45 @@ export declare const mfaCodeOnlyBodySchema: z.ZodObject<{
|
|
|
115
168
|
code: string;
|
|
116
169
|
}>;
|
|
117
170
|
export type MfaCodeOnlyBody = z.infer<typeof mfaCodeOnlyBodySchema>;
|
|
171
|
+
export declare const mfaTotpProofBodySchema: z.ZodObject<{
|
|
172
|
+
factor_id: z.ZodString;
|
|
173
|
+
code: z.ZodString;
|
|
174
|
+
}, "strict", z.ZodTypeAny, {
|
|
175
|
+
code: string;
|
|
176
|
+
factor_id: string;
|
|
177
|
+
}, {
|
|
178
|
+
code: string;
|
|
179
|
+
factor_id: string;
|
|
180
|
+
}>;
|
|
181
|
+
export type MfaTotpProofBody = z.infer<typeof mfaTotpProofBodySchema>;
|
|
182
|
+
export declare const mfaChallengeFactorsPayloadSchema: z.ZodObject<{
|
|
183
|
+
available_factors: z.ZodArray<z.ZodObject<{
|
|
184
|
+
factor_id: z.ZodString;
|
|
185
|
+
factor_type: z.ZodEnum<["totp"]>;
|
|
186
|
+
last_used_at: z.ZodNullable<z.ZodNumber>;
|
|
187
|
+
}, "strict", z.ZodTypeAny, {
|
|
188
|
+
factor_id: string;
|
|
189
|
+
factor_type: "totp";
|
|
190
|
+
last_used_at: number | null;
|
|
191
|
+
}, {
|
|
192
|
+
factor_id: string;
|
|
193
|
+
factor_type: "totp";
|
|
194
|
+
last_used_at: number | null;
|
|
195
|
+
}>, "many">;
|
|
196
|
+
recovery_codes_available: z.ZodBoolean;
|
|
197
|
+
}, "strict", z.ZodTypeAny, {
|
|
198
|
+
available_factors: {
|
|
199
|
+
factor_id: string;
|
|
200
|
+
factor_type: "totp";
|
|
201
|
+
last_used_at: number | null;
|
|
202
|
+
}[];
|
|
203
|
+
recovery_codes_available: boolean;
|
|
204
|
+
}, {
|
|
205
|
+
available_factors: {
|
|
206
|
+
factor_id: string;
|
|
207
|
+
factor_type: "totp";
|
|
208
|
+
last_used_at: number | null;
|
|
209
|
+
}[];
|
|
210
|
+
recovery_codes_available: boolean;
|
|
211
|
+
}>;
|
|
212
|
+
export type MfaChallengeFactorsPayload = z.infer<typeof mfaChallengeFactorsPayloadSchema>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { appIdSchema } from "@schemavaults/app-definitions";
|
|
3
|
+
import { availableMfaFactorSchema } from "../authenticate_result";
|
|
4
|
+
import { mfaFactorTypeSchema } from "./mfa-factor-type";
|
|
3
5
|
export const totpCodeSchema = z
|
|
4
6
|
.string()
|
|
5
7
|
.regex(/^\d{6}$/u, "TOTP code must be exactly 6 digits");
|
|
@@ -12,7 +14,13 @@ export const mfaVerifyBodySchema = z
|
|
|
12
14
|
challenge_id: z.string().uuid(),
|
|
13
15
|
client_app_id: appIdSchema,
|
|
14
16
|
proof: z.discriminatedUnion("type", [
|
|
15
|
-
z
|
|
17
|
+
z
|
|
18
|
+
.object({
|
|
19
|
+
type: z.literal("totp"),
|
|
20
|
+
factor_id: z.string().uuid(),
|
|
21
|
+
code: totpCodeSchema,
|
|
22
|
+
})
|
|
23
|
+
.strict(),
|
|
16
24
|
z
|
|
17
25
|
.object({ type: z.literal("recovery_code"), recovery_code: recoveryCodeSchema })
|
|
18
26
|
.strict(),
|
|
@@ -40,13 +48,39 @@ export const mfaVerifyEnrollmentResponseSchema = z
|
|
|
40
48
|
recovery_codes: z.array(recoveryCodeSchema).min(1),
|
|
41
49
|
})
|
|
42
50
|
.strict();
|
|
43
|
-
|
|
51
|
+
// Status of a single MFA factor type — returned by
|
|
52
|
+
// GET /api/user/mfa/status/[factor_type]. `enabled` means a verified,
|
|
53
|
+
// active factor of that type exists; `pending` means an enrollment is in
|
|
54
|
+
// progress (an unverified factor exists but hasn't been confirmed yet).
|
|
55
|
+
// The two are mutually exclusive. When neither is set the user has no
|
|
56
|
+
// factor of that type. `factor_id`/`factor_type` are present whenever a
|
|
57
|
+
// factor row exists (verified or pending); `verified_at` only when enabled.
|
|
58
|
+
export const mfaFactorStatusResponseSchema = z
|
|
44
59
|
.object({
|
|
45
60
|
enabled: z.boolean(),
|
|
61
|
+
pending: z.boolean(),
|
|
46
62
|
factor_id: z.string().uuid().optional(),
|
|
47
|
-
factor_type:
|
|
63
|
+
factor_type: mfaFactorTypeSchema.optional(),
|
|
48
64
|
verified_at: z.number().int().positive().optional(),
|
|
49
|
-
|
|
65
|
+
})
|
|
66
|
+
.strict();
|
|
67
|
+
// A single verified factor in the account-wide MFA status list.
|
|
68
|
+
export const mfaEnrolledFactorSchema = z
|
|
69
|
+
.object({
|
|
70
|
+
factor_id: z.string().uuid(),
|
|
71
|
+
factor_type: mfaFactorTypeSchema,
|
|
72
|
+
verified_at: z.number().int().positive().optional(),
|
|
73
|
+
})
|
|
74
|
+
.strict();
|
|
75
|
+
// Account-wide MFA status — returned by GET /api/user/mfa/status. Lists
|
|
76
|
+
// every verified factor rather than collapsing to a single one, plus the
|
|
77
|
+
// account-wide recovery-code count. `enabled` is a convenience mirror of
|
|
78
|
+
// `factors.length > 0`.
|
|
79
|
+
export const mfaStatusResponseSchema = z
|
|
80
|
+
.object({
|
|
81
|
+
enabled: z.boolean(),
|
|
82
|
+
factors: z.array(mfaEnrolledFactorSchema),
|
|
83
|
+
recovery_codes_remaining: z.number().int().nonnegative(),
|
|
50
84
|
})
|
|
51
85
|
.strict();
|
|
52
86
|
export const mfaCodeOnlyBodySchema = z
|
|
@@ -54,4 +88,25 @@ export const mfaCodeOnlyBodySchema = z
|
|
|
54
88
|
code: totpCodeSchema,
|
|
55
89
|
})
|
|
56
90
|
.strict();
|
|
91
|
+
// Authorize an action with a TOTP code from a specific factor. The caller
|
|
92
|
+
// names which factor the code belongs to so the server verifies against
|
|
93
|
+
// exactly that factor (one targeted lookup) instead of trying every
|
|
94
|
+
// enrolled factor's secret in turn.
|
|
95
|
+
export const mfaTotpProofBodySchema = z
|
|
96
|
+
.object({
|
|
97
|
+
factor_id: z.string().uuid(),
|
|
98
|
+
code: totpCodeSchema,
|
|
99
|
+
})
|
|
100
|
+
.strict();
|
|
101
|
+
// Shape of the MFA challenge factor list that the login form stashes in
|
|
102
|
+
// sessionStorage (keyed by challenge_id) so the downstream MFA challenge
|
|
103
|
+
// page can render the factor picker without a second server round-trip.
|
|
104
|
+
// Mirrors the `available_factors` + `recovery_codes_available` fields the
|
|
105
|
+
// server already includes in the `mfa_required` login response.
|
|
106
|
+
export const mfaChallengeFactorsPayloadSchema = z
|
|
107
|
+
.object({
|
|
108
|
+
available_factors: z.array(availableMfaFactorSchema),
|
|
109
|
+
recovery_codes_available: z.boolean(),
|
|
110
|
+
})
|
|
111
|
+
.strict();
|
|
57
112
|
//# sourceMappingURL=mfa-verify-body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfa-verify-body.js","sourceRoot":"","sources":["../../src/mfa/mfa-verify-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"mfa-verify-body.js","sourceRoot":"","sources":["../../src/mfa/mfa-verify-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,KAAK,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC,CAAC;AAEX,MAAM,CAAC,M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AC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CACzD,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,IAAI,EAAE,cAAc;CACrB,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,oCAAoC;AACpC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC5B,IAAI,EAAE,cAAc;CACrB,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AACxE,0EAA0E;AAC1E,gEAAgE;AAChE,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC;KAC9C,MAAM,CAAC;IACN,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC;IACpD,wBAAwB,EAAE,CAAC,CAAC,OAAO,EAAE;CACtC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schemavaults/auth-common",
|
|
3
3
|
"description": "Types and utility functions for authentication and authorization",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.15",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"typescript": "5.8.3",
|
|
31
31
|
"tsc-alias": "1.8.16",
|
|
32
32
|
"@types/crypto-js": "4.2.0",
|
|
33
|
-
"bun-types": "1.3.
|
|
33
|
+
"bun-types": "1.3.14",
|
|
34
34
|
"eslint": "9.39.1",
|
|
35
35
|
"@eslint/js": "9.39.1",
|
|
36
36
|
"globals": "16.5.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"packageManager": "bun@1.3.
|
|
43
|
+
"packageManager": "bun@1.3.14",
|
|
44
44
|
"exports": {
|
|
45
45
|
".": {
|
|
46
46
|
"types": "./dist/index.d.ts",
|