@aura-stack/auth 0.5.0 → 0.6.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/README.md +36 -1
- package/dist/@types/index.cjs +0 -18
- package/dist/@types/index.d.ts +2 -12
- package/dist/@types/index.js +0 -1
- package/dist/assert-B3iQSYlK.js +3 -0
- package/dist/assert-NJGroSJd.cjs +3 -0
- package/dist/client/index.cjs +1 -135
- package/dist/client/index.d.ts +11 -14
- package/dist/client/index.js +1 -10
- package/dist/crypto-Bz8nIciY.js +1 -0
- package/dist/crypto-CoXA5w_4.cjs +1 -0
- package/dist/env-bq387KyP.cjs +1 -0
- package/dist/env-nvh8QBNz.js +1 -0
- package/dist/errors-CCYPHuBO.cjs +1 -0
- package/dist/errors-DFWHOho6.js +1 -0
- package/dist/index-BkpwQ0l4.d.cts +2279 -0
- package/dist/index-nqLV2t91.d.ts +2279 -0
- package/dist/index.cjs +1 -2427
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -14
- package/dist/index.js +1 -59
- package/dist/logger-C59_CDMk.js +1 -0
- package/dist/logger-UnUhYL2V.cjs +1 -0
- package/dist/oauth/atlassian.cjs +1 -57
- package/dist/oauth/atlassian.d.ts +2 -12
- package/dist/oauth/atlassian.js +1 -6
- package/dist/oauth/bitbucket.cjs +1 -49
- package/dist/oauth/bitbucket.d.ts +2 -12
- package/dist/oauth/bitbucket.js +1 -6
- package/dist/oauth/discord.cjs +1 -57
- package/dist/oauth/discord.d.ts +2 -12
- package/dist/oauth/discord.js +1 -6
- package/dist/oauth/dropbox.cjs +1 -53
- package/dist/oauth/dropbox.d.ts +2 -12
- package/dist/oauth/dropbox.js +1 -6
- package/dist/oauth/figma.cjs +1 -49
- package/dist/oauth/figma.d.ts +2 -12
- package/dist/oauth/figma.js +1 -6
- package/dist/oauth/github.cjs +1 -49
- package/dist/oauth/github.d.ts +2 -12
- package/dist/oauth/github.js +1 -6
- package/dist/oauth/gitlab.cjs +1 -49
- package/dist/oauth/gitlab.d.ts +2 -12
- package/dist/oauth/gitlab.js +1 -6
- package/dist/oauth/index.cjs +1 -673
- package/dist/oauth/index.d.ts +2 -12
- package/dist/oauth/index.js +1 -68
- package/dist/oauth/mailchimp.cjs +1 -49
- package/dist/oauth/mailchimp.d.ts +2 -12
- package/dist/oauth/mailchimp.js +1 -6
- package/dist/oauth/notion.cjs +1 -131
- package/dist/oauth/notion.d.ts +2 -12
- package/dist/oauth/notion.js +1 -9
- package/dist/oauth/pinterest.cjs +1 -49
- package/dist/oauth/pinterest.d.ts +2 -12
- package/dist/oauth/pinterest.js +1 -6
- package/dist/oauth/spotify.cjs +1 -49
- package/dist/oauth/spotify.d.ts +2 -12
- package/dist/oauth/spotify.js +1 -6
- package/dist/oauth/strava.cjs +1 -49
- package/dist/oauth/strava.d.ts +2 -12
- package/dist/oauth/strava.js +1 -6
- package/dist/oauth/twitch.cjs +1 -95
- package/dist/oauth/twitch.d.ts +2 -12
- package/dist/oauth/twitch.js +1 -7
- package/dist/oauth/x.cjs +1 -49
- package/dist/oauth/x.d.ts +2 -12
- package/dist/oauth/x.js +1 -6
- package/dist/oauth-BntNm6aE.cjs +1 -0
- package/dist/oauth-DmHy9VrB.js +1 -0
- package/dist/shared/crypto.cjs +1 -0
- package/dist/shared/crypto.d.ts +47 -0
- package/dist/shared/crypto.js +1 -0
- package/dist/shared/identity.cjs +1 -0
- package/dist/shared/identity.d.ts +2 -0
- package/dist/shared/identity.js +1 -0
- package/dist/shared/index.cjs +1 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.js +1 -0
- package/package.json +32 -9
- package/dist/@types/router.d.cjs +0 -1
- package/dist/@types/router.d.d.ts +0 -16
- package/dist/@types/router.d.js +0 -0
- package/dist/@types/utility.cjs +0 -18
- package/dist/@types/utility.d.ts +0 -6
- package/dist/@types/utility.js +0 -1
- package/dist/actions/callback/access-token.cjs +0 -250
- package/dist/actions/callback/access-token.d.ts +0 -33
- package/dist/actions/callback/access-token.js +0 -9
- package/dist/actions/callback/callback.cjs +0 -715
- package/dist/actions/callback/callback.d.ts +0 -42
- package/dist/actions/callback/callback.js +0 -18
- package/dist/actions/callback/userinfo.cjs +0 -283
- package/dist/actions/callback/userinfo.d.ts +0 -25
- package/dist/actions/callback/userinfo.js +0 -13
- package/dist/actions/csrfToken/csrfToken.cjs +0 -189
- package/dist/actions/csrfToken/csrfToken.d.ts +0 -7
- package/dist/actions/csrfToken/csrfToken.js +0 -13
- package/dist/actions/index.cjs +0 -1161
- package/dist/actions/index.d.ts +0 -17
- package/dist/actions/index.js +0 -39
- package/dist/actions/session/session.cjs +0 -188
- package/dist/actions/session/session.d.ts +0 -7
- package/dist/actions/session/session.js +0 -12
- package/dist/actions/signIn/authorization-url.cjs +0 -288
- package/dist/actions/signIn/authorization-url.d.ts +0 -31
- package/dist/actions/signIn/authorization-url.js +0 -16
- package/dist/actions/signIn/authorization.cjs +0 -281
- package/dist/actions/signIn/authorization.d.ts +0 -54
- package/dist/actions/signIn/authorization.js +0 -19
- package/dist/actions/signIn/signIn.cjs +0 -595
- package/dist/actions/signIn/signIn.d.ts +0 -42
- package/dist/actions/signIn/signIn.js +0 -16
- package/dist/actions/signOut/signOut.cjs +0 -492
- package/dist/actions/signOut/signOut.d.ts +0 -16
- package/dist/actions/signOut/signOut.js +0 -15
- package/dist/api/createApi.cjs +0 -750
- package/dist/api/createApi.d.ts +0 -12
- package/dist/api/createApi.js +0 -19
- package/dist/api/getSession.cjs +0 -141
- package/dist/api/getSession.d.ts +0 -16
- package/dist/api/getSession.js +0 -10
- package/dist/api/signIn.cjs +0 -549
- package/dist/api/signIn.d.ts +0 -26
- package/dist/api/signIn.js +0 -15
- package/dist/api/signOut.cjs +0 -279
- package/dist/api/signOut.d.ts +0 -16
- package/dist/api/signOut.js +0 -13
- package/dist/assert.cjs +0 -194
- package/dist/assert.d.ts +0 -37
- package/dist/assert.js +0 -26
- package/dist/chunk-2A5B7GWR.js +0 -125
- package/dist/chunk-2GQLSIJ2.js +0 -40
- package/dist/chunk-2IR674WX.js +0 -44
- package/dist/chunk-3J5TUH2I.js +0 -50
- package/dist/chunk-4RWSYUKX.js +0 -98
- package/dist/chunk-4YHJ4IEQ.js +0 -25
- package/dist/chunk-54CZPKR4.js +0 -25
- package/dist/chunk-5LZ7TOM3.js +0 -25
- package/dist/chunk-5X7JZMEF.js +0 -0
- package/dist/chunk-7BE46WWS.js +0 -88
- package/dist/chunk-7YYXFKLR.js +0 -35
- package/dist/chunk-C3A37LQC.js +0 -33
- package/dist/chunk-CITNGXDA.js +0 -31
- package/dist/chunk-CWX724AG.js +0 -78
- package/dist/chunk-D2CSIUKP.js +0 -74
- package/dist/chunk-E6G5YCI6.js +0 -25
- package/dist/chunk-EBAMFRB7.js +0 -34
- package/dist/chunk-EEE7UM5T.js +0 -25
- package/dist/chunk-FPCVZUVG.js +0 -37
- package/dist/chunk-FW4W3REU.js +0 -25
- package/dist/chunk-GNNBM2WJ.js +0 -83
- package/dist/chunk-IPKO6UQN.js +0 -25
- package/dist/chunk-ITQ7352M.js +0 -0
- package/dist/chunk-JOCGX3RP.js +0 -59
- package/dist/chunk-KBXWTD6E.js +0 -94
- package/dist/chunk-KMMAZFSJ.js +0 -25
- package/dist/chunk-LATR3NIV.js +0 -117
- package/dist/chunk-LAYPUDQF.js +0 -39
- package/dist/chunk-LDU7A2JE.js +0 -25
- package/dist/chunk-LX3TJ2TJ.js +0 -294
- package/dist/chunk-NHZBQNRR.js +0 -143
- package/dist/chunk-OVHNRULD.js +0 -33
- package/dist/chunk-PDP3PHB3.js +0 -127
- package/dist/chunk-PG7UYFG5.js +0 -0
- package/dist/chunk-PHYNROD4.js +0 -47
- package/dist/chunk-QQEKY4XP.js +0 -29
- package/dist/chunk-U4RK4LKJ.js +0 -348
- package/dist/chunk-U5663F2U.js +0 -70
- package/dist/chunk-UN7X6SU5.js +0 -53
- package/dist/chunk-UZQJJD6A.js +0 -100
- package/dist/chunk-V6LLEAR4.js +0 -80
- package/dist/chunk-WHNDRO3N.js +0 -50
- package/dist/chunk-XY5R3EHH.js +0 -204
- package/dist/chunk-ZNCZVF6U.js +0 -14
- package/dist/client/client.cjs +0 -135
- package/dist/client/client.d.ts +0 -85
- package/dist/client/client.js +0 -9
- package/dist/context.cjs +0 -1237
- package/dist/context.d.ts +0 -16
- package/dist/context.js +0 -28
- package/dist/cookie.cjs +0 -277
- package/dist/cookie.d.ts +0 -89
- package/dist/cookie.js +0 -30
- package/dist/createAuth.cjs +0 -2320
- package/dist/createAuth.d.ts +0 -12
- package/dist/createAuth.js +0 -48
- package/dist/env.cjs +0 -78
- package/dist/env.d.ts +0 -10
- package/dist/env.js +0 -12
- package/dist/errors.cjs +0 -102
- package/dist/errors.d.ts +0 -60
- package/dist/errors.js +0 -22
- package/dist/headers.cjs +0 -61
- package/dist/headers.d.ts +0 -33
- package/dist/headers.js +0 -12
- package/dist/index-_aXtxb_s.d.ts +0 -1377
- package/dist/jose.cjs +0 -166
- package/dist/jose.d.ts +0 -12
- package/dist/jose.js +0 -20
- package/dist/logger.cjs +0 -424
- package/dist/logger.d.ts +0 -12
- package/dist/logger.js +0 -17
- package/dist/request.cjs +0 -38
- package/dist/request.d.ts +0 -13
- package/dist/request.js +0 -6
- package/dist/schemas.cjs +0 -158
- package/dist/schemas.d.ts +0 -229
- package/dist/schemas.js +0 -24
- package/dist/secure.cjs +0 -170
- package/dist/secure.d.ts +0 -41
- package/dist/secure.js +0 -20
- package/dist/utils.cjs +0 -329
- package/dist/utils.d.ts +0 -35
- package/dist/utils.js +0 -36
package/dist/request.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetches a resource with a timeout mechanism.
|
|
3
|
-
*
|
|
4
|
-
* @param url - The URL or Request object to fetch
|
|
5
|
-
* @param options - Optional RequestInit configuration object
|
|
6
|
-
* @param timeout - Timeout duration in milliseconds (default: 5000ms)
|
|
7
|
-
* @returns A promise that resolves to the Response object
|
|
8
|
-
* @example
|
|
9
|
-
* const response = await fetchAsync('https://api.example.com/data', {}, 3000);
|
|
10
|
-
*/
|
|
11
|
-
declare const fetchAsync: (url: string | Request, options?: RequestInit, timeout?: number) => Promise<Response>;
|
|
12
|
-
|
|
13
|
-
export { fetchAsync };
|
package/dist/request.js
DELETED
package/dist/schemas.cjs
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/schemas.ts
|
|
21
|
-
var schemas_exports = {};
|
|
22
|
-
__export(schemas_exports, {
|
|
23
|
-
OAuthAccessToken: () => OAuthAccessToken,
|
|
24
|
-
OAuthAccessTokenErrorResponse: () => OAuthAccessTokenErrorResponse,
|
|
25
|
-
OAuthAccessTokenResponse: () => OAuthAccessTokenResponse,
|
|
26
|
-
OAuthAuthorization: () => OAuthAuthorization,
|
|
27
|
-
OAuthAuthorizationErrorResponse: () => OAuthAuthorizationErrorResponse,
|
|
28
|
-
OAuthAuthorizationResponse: () => OAuthAuthorizationResponse,
|
|
29
|
-
OAuthEnvSchema: () => OAuthEnvSchema,
|
|
30
|
-
OAuthErrorResponse: () => OAuthErrorResponse,
|
|
31
|
-
OAuthProviderConfigSchema: () => OAuthProviderConfigSchema,
|
|
32
|
-
OAuthProviderCredentialsSchema: () => OAuthProviderCredentialsSchema
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(schemas_exports);
|
|
35
|
-
var import_v4 = require("zod/v4");
|
|
36
|
-
var AuthorizeConfigSchema = import_v4.z.union([
|
|
37
|
-
(0, import_v4.string)().url(),
|
|
38
|
-
(0, import_v4.object)({
|
|
39
|
-
url: (0, import_v4.string)().url(),
|
|
40
|
-
params: (0, import_v4.object)({
|
|
41
|
-
responseType: (0, import_v4.enum)(["code", "token", "id_token", "refresh_token"]).optional(),
|
|
42
|
-
scope: (0, import_v4.string)().optional()
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
]);
|
|
46
|
-
var AccessTokenConfigSchema = import_v4.z.union([
|
|
47
|
-
(0, import_v4.string)().url(),
|
|
48
|
-
(0, import_v4.object)({
|
|
49
|
-
url: (0, import_v4.string)().url(),
|
|
50
|
-
headers: import_v4.z.record((0, import_v4.string)(), (0, import_v4.string)()).optional()
|
|
51
|
-
})
|
|
52
|
-
]);
|
|
53
|
-
var UserInfoConfigSchema = import_v4.z.union([
|
|
54
|
-
(0, import_v4.string)().url(),
|
|
55
|
-
(0, import_v4.object)({
|
|
56
|
-
url: (0, import_v4.string)().url(),
|
|
57
|
-
headers: import_v4.z.record((0, import_v4.string)(), (0, import_v4.string)()).optional(),
|
|
58
|
-
method: (0, import_v4.string)().optional()
|
|
59
|
-
})
|
|
60
|
-
]);
|
|
61
|
-
var OAuthProviderCredentialsSchema = (0, import_v4.object)({
|
|
62
|
-
id: (0, import_v4.string)(),
|
|
63
|
-
name: (0, import_v4.string)(),
|
|
64
|
-
authorize: AuthorizeConfigSchema.optional(),
|
|
65
|
-
/** @deprecated */
|
|
66
|
-
authorizeURL: (0, import_v4.string)().url().optional(),
|
|
67
|
-
accessToken: AccessTokenConfigSchema,
|
|
68
|
-
/** @deprecated */
|
|
69
|
-
scope: (0, import_v4.string)().optional(),
|
|
70
|
-
userInfo: UserInfoConfigSchema,
|
|
71
|
-
/** @deprecated */
|
|
72
|
-
responseType: (0, import_v4.enum)(["code", "token", "id_token", "refresh_token"]).optional(),
|
|
73
|
-
clientId: (0, import_v4.string)(),
|
|
74
|
-
clientSecret: (0, import_v4.string)(),
|
|
75
|
-
profile: import_v4.z.function().optional()
|
|
76
|
-
});
|
|
77
|
-
var OAuthProviderConfigSchema = (0, import_v4.object)({
|
|
78
|
-
authorize: AuthorizeConfigSchema.optional(),
|
|
79
|
-
/** @deprecated */
|
|
80
|
-
authorizeURL: (0, import_v4.string)().url().optional(),
|
|
81
|
-
accessToken: AccessTokenConfigSchema,
|
|
82
|
-
/** @deprecated */
|
|
83
|
-
scope: (0, import_v4.string)().optional(),
|
|
84
|
-
userInfo: UserInfoConfigSchema,
|
|
85
|
-
/** @deprecated */
|
|
86
|
-
responseType: (0, import_v4.enum)(["code", "token", "id_token", "refresh_token"]).optional(),
|
|
87
|
-
clientId: (0, import_v4.string)(),
|
|
88
|
-
clientSecret: (0, import_v4.string)()
|
|
89
|
-
});
|
|
90
|
-
var OAuthAuthorization = OAuthProviderConfigSchema.extend({
|
|
91
|
-
redirectURI: (0, import_v4.string)(),
|
|
92
|
-
state: (0, import_v4.string)(),
|
|
93
|
-
codeChallenge: (0, import_v4.string)(),
|
|
94
|
-
codeChallengeMethod: (0, import_v4.enum)(["plain", "S256"])
|
|
95
|
-
});
|
|
96
|
-
var OAuthAuthorizationResponse = (0, import_v4.object)({
|
|
97
|
-
state: (0, import_v4.string)({ message: "Missing state parameter in the OAuth authorization response." }),
|
|
98
|
-
code: (0, import_v4.string)({ message: "Missing code parameter in the OAuth authorization response." })
|
|
99
|
-
});
|
|
100
|
-
var OAuthAuthorizationErrorResponse = (0, import_v4.object)({
|
|
101
|
-
error: (0, import_v4.enum)([
|
|
102
|
-
"invalid_request",
|
|
103
|
-
"unauthorized_client",
|
|
104
|
-
"access_denied",
|
|
105
|
-
"unsupported_response_type",
|
|
106
|
-
"invalid_scope",
|
|
107
|
-
"server_error",
|
|
108
|
-
"temporarily_unavailable"
|
|
109
|
-
]),
|
|
110
|
-
error_description: (0, import_v4.string)().optional(),
|
|
111
|
-
error_uri: (0, import_v4.string)().optional(),
|
|
112
|
-
state: (0, import_v4.string)()
|
|
113
|
-
});
|
|
114
|
-
var OAuthAccessToken = OAuthProviderConfigSchema.extend({
|
|
115
|
-
redirectURI: (0, import_v4.string)(),
|
|
116
|
-
code: (0, import_v4.string)(),
|
|
117
|
-
codeVerifier: (0, import_v4.string)().min(43).max(128)
|
|
118
|
-
});
|
|
119
|
-
var OAuthAccessTokenResponse = (0, import_v4.object)({
|
|
120
|
-
access_token: (0, import_v4.string)(),
|
|
121
|
-
token_type: (0, import_v4.string)().optional(),
|
|
122
|
-
expires_in: (0, import_v4.number)().optional(),
|
|
123
|
-
refresh_token: (0, import_v4.string)().optional(),
|
|
124
|
-
scope: (0, import_v4.union)([(0, import_v4.string)().optional().or((0, import_v4.null)()), (0, import_v4.array)((0, import_v4.string)()).optional()])
|
|
125
|
-
});
|
|
126
|
-
var OAuthAccessTokenErrorResponse = (0, import_v4.object)({
|
|
127
|
-
error: (0, import_v4.enum)([
|
|
128
|
-
"invalid_request",
|
|
129
|
-
"invalid_client",
|
|
130
|
-
"invalid_grant",
|
|
131
|
-
"unauthorized_client",
|
|
132
|
-
"unsupported_grant_type",
|
|
133
|
-
"invalid_scope"
|
|
134
|
-
]),
|
|
135
|
-
error_description: (0, import_v4.string)().optional(),
|
|
136
|
-
error_uri: (0, import_v4.string)().optional()
|
|
137
|
-
});
|
|
138
|
-
var OAuthErrorResponse = (0, import_v4.object)({
|
|
139
|
-
error: (0, import_v4.string)(),
|
|
140
|
-
error_description: (0, import_v4.string)().optional()
|
|
141
|
-
});
|
|
142
|
-
var OAuthEnvSchema = (0, import_v4.object)({
|
|
143
|
-
clientId: import_v4.z.string().min(1, "OAuth Client ID is required in the environment variables."),
|
|
144
|
-
clientSecret: import_v4.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
|
|
145
|
-
});
|
|
146
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
-
0 && (module.exports = {
|
|
148
|
-
OAuthAccessToken,
|
|
149
|
-
OAuthAccessTokenErrorResponse,
|
|
150
|
-
OAuthAccessTokenResponse,
|
|
151
|
-
OAuthAuthorization,
|
|
152
|
-
OAuthAuthorizationErrorResponse,
|
|
153
|
-
OAuthAuthorizationResponse,
|
|
154
|
-
OAuthEnvSchema,
|
|
155
|
-
OAuthErrorResponse,
|
|
156
|
-
OAuthProviderConfigSchema,
|
|
157
|
-
OAuthProviderCredentialsSchema
|
|
158
|
-
});
|
package/dist/schemas.d.ts
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
|
|
3
|
-
declare const OAuthProviderCredentialsSchema: z.ZodObject<{
|
|
4
|
-
id: z.ZodString;
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
authorize: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
7
|
-
url: z.ZodString;
|
|
8
|
-
params: z.ZodObject<{
|
|
9
|
-
responseType: z.ZodOptional<z.ZodEnum<{
|
|
10
|
-
token: "token";
|
|
11
|
-
code: "code";
|
|
12
|
-
id_token: "id_token";
|
|
13
|
-
refresh_token: "refresh_token";
|
|
14
|
-
}>>;
|
|
15
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
16
|
-
}, z.core.$strip>;
|
|
17
|
-
}, z.core.$strip>]>>;
|
|
18
|
-
authorizeURL: z.ZodOptional<z.ZodString>;
|
|
19
|
-
accessToken: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
20
|
-
url: z.ZodString;
|
|
21
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
22
|
-
}, z.core.$strip>]>;
|
|
23
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
24
|
-
userInfo: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
25
|
-
url: z.ZodString;
|
|
26
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
27
|
-
method: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strip>]>;
|
|
29
|
-
responseType: z.ZodOptional<z.ZodEnum<{
|
|
30
|
-
token: "token";
|
|
31
|
-
code: "code";
|
|
32
|
-
id_token: "id_token";
|
|
33
|
-
refresh_token: "refresh_token";
|
|
34
|
-
}>>;
|
|
35
|
-
clientId: z.ZodString;
|
|
36
|
-
clientSecret: z.ZodString;
|
|
37
|
-
profile: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
38
|
-
}, z.core.$strip>;
|
|
39
|
-
/**
|
|
40
|
-
* Schema for OAuth Provider Configuration
|
|
41
|
-
*/
|
|
42
|
-
declare const OAuthProviderConfigSchema: z.ZodObject<{
|
|
43
|
-
authorize: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
44
|
-
url: z.ZodString;
|
|
45
|
-
params: z.ZodObject<{
|
|
46
|
-
responseType: z.ZodOptional<z.ZodEnum<{
|
|
47
|
-
token: "token";
|
|
48
|
-
code: "code";
|
|
49
|
-
id_token: "id_token";
|
|
50
|
-
refresh_token: "refresh_token";
|
|
51
|
-
}>>;
|
|
52
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
53
|
-
}, z.core.$strip>;
|
|
54
|
-
}, z.core.$strip>]>>;
|
|
55
|
-
authorizeURL: z.ZodOptional<z.ZodString>;
|
|
56
|
-
accessToken: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
57
|
-
url: z.ZodString;
|
|
58
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
59
|
-
}, z.core.$strip>]>;
|
|
60
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
61
|
-
userInfo: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
62
|
-
url: z.ZodString;
|
|
63
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
64
|
-
method: z.ZodOptional<z.ZodString>;
|
|
65
|
-
}, z.core.$strip>]>;
|
|
66
|
-
responseType: z.ZodOptional<z.ZodEnum<{
|
|
67
|
-
token: "token";
|
|
68
|
-
code: "code";
|
|
69
|
-
id_token: "id_token";
|
|
70
|
-
refresh_token: "refresh_token";
|
|
71
|
-
}>>;
|
|
72
|
-
clientId: z.ZodString;
|
|
73
|
-
clientSecret: z.ZodString;
|
|
74
|
-
}, z.core.$strip>;
|
|
75
|
-
/**
|
|
76
|
-
* Schema used to create the authorization URL for the OAuth flow and verify the
|
|
77
|
-
* OAuth configuration.
|
|
78
|
-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1
|
|
79
|
-
*/
|
|
80
|
-
declare const OAuthAuthorization: z.ZodObject<{
|
|
81
|
-
authorize: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
82
|
-
url: z.ZodString;
|
|
83
|
-
params: z.ZodObject<{
|
|
84
|
-
responseType: z.ZodOptional<z.ZodEnum<{
|
|
85
|
-
token: "token";
|
|
86
|
-
code: "code";
|
|
87
|
-
id_token: "id_token";
|
|
88
|
-
refresh_token: "refresh_token";
|
|
89
|
-
}>>;
|
|
90
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
91
|
-
}, z.core.$strip>;
|
|
92
|
-
}, z.core.$strip>]>>;
|
|
93
|
-
authorizeURL: z.ZodOptional<z.ZodString>;
|
|
94
|
-
accessToken: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
95
|
-
url: z.ZodString;
|
|
96
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
97
|
-
}, z.core.$strip>]>;
|
|
98
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
99
|
-
userInfo: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
100
|
-
url: z.ZodString;
|
|
101
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
102
|
-
method: z.ZodOptional<z.ZodString>;
|
|
103
|
-
}, z.core.$strip>]>;
|
|
104
|
-
responseType: z.ZodOptional<z.ZodEnum<{
|
|
105
|
-
token: "token";
|
|
106
|
-
code: "code";
|
|
107
|
-
id_token: "id_token";
|
|
108
|
-
refresh_token: "refresh_token";
|
|
109
|
-
}>>;
|
|
110
|
-
clientId: z.ZodString;
|
|
111
|
-
clientSecret: z.ZodString;
|
|
112
|
-
redirectURI: z.ZodString;
|
|
113
|
-
state: z.ZodString;
|
|
114
|
-
codeChallenge: z.ZodString;
|
|
115
|
-
codeChallengeMethod: z.ZodEnum<{
|
|
116
|
-
plain: "plain";
|
|
117
|
-
S256: "S256";
|
|
118
|
-
}>;
|
|
119
|
-
}, z.core.$strip>;
|
|
120
|
-
/**
|
|
121
|
-
* Schema used in the callback action to validate the authorization response when the resource owner
|
|
122
|
-
* has granted.
|
|
123
|
-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2
|
|
124
|
-
*/
|
|
125
|
-
declare const OAuthAuthorizationResponse: z.ZodObject<{
|
|
126
|
-
state: z.ZodString;
|
|
127
|
-
code: z.ZodString;
|
|
128
|
-
}, z.core.$strip>;
|
|
129
|
-
/**
|
|
130
|
-
* Schema used in the callback action to validate the authorization error response when the resource owner
|
|
131
|
-
* has denied the authorization request.
|
|
132
|
-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1
|
|
133
|
-
*/
|
|
134
|
-
declare const OAuthAuthorizationErrorResponse: z.ZodObject<{
|
|
135
|
-
error: z.ZodEnum<{
|
|
136
|
-
invalid_request: "invalid_request";
|
|
137
|
-
unauthorized_client: "unauthorized_client";
|
|
138
|
-
access_denied: "access_denied";
|
|
139
|
-
unsupported_response_type: "unsupported_response_type";
|
|
140
|
-
invalid_scope: "invalid_scope";
|
|
141
|
-
server_error: "server_error";
|
|
142
|
-
temporarily_unavailable: "temporarily_unavailable";
|
|
143
|
-
}>;
|
|
144
|
-
error_description: z.ZodOptional<z.ZodString>;
|
|
145
|
-
error_uri: z.ZodOptional<z.ZodString>;
|
|
146
|
-
state: z.ZodString;
|
|
147
|
-
}, z.core.$strip>;
|
|
148
|
-
/**
|
|
149
|
-
* Schema for OAuth Access Token Request and OAuth Configuration
|
|
150
|
-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3
|
|
151
|
-
*/
|
|
152
|
-
declare const OAuthAccessToken: z.ZodObject<{
|
|
153
|
-
authorize: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
154
|
-
url: z.ZodString;
|
|
155
|
-
params: z.ZodObject<{
|
|
156
|
-
responseType: z.ZodOptional<z.ZodEnum<{
|
|
157
|
-
token: "token";
|
|
158
|
-
code: "code";
|
|
159
|
-
id_token: "id_token";
|
|
160
|
-
refresh_token: "refresh_token";
|
|
161
|
-
}>>;
|
|
162
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
163
|
-
}, z.core.$strip>;
|
|
164
|
-
}, z.core.$strip>]>>;
|
|
165
|
-
authorizeURL: z.ZodOptional<z.ZodString>;
|
|
166
|
-
accessToken: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
167
|
-
url: z.ZodString;
|
|
168
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
169
|
-
}, z.core.$strip>]>;
|
|
170
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
171
|
-
userInfo: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
172
|
-
url: z.ZodString;
|
|
173
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
174
|
-
method: z.ZodOptional<z.ZodString>;
|
|
175
|
-
}, z.core.$strip>]>;
|
|
176
|
-
responseType: z.ZodOptional<z.ZodEnum<{
|
|
177
|
-
token: "token";
|
|
178
|
-
code: "code";
|
|
179
|
-
id_token: "id_token";
|
|
180
|
-
refresh_token: "refresh_token";
|
|
181
|
-
}>>;
|
|
182
|
-
clientId: z.ZodString;
|
|
183
|
-
clientSecret: z.ZodString;
|
|
184
|
-
redirectURI: z.ZodString;
|
|
185
|
-
code: z.ZodString;
|
|
186
|
-
codeVerifier: z.ZodString;
|
|
187
|
-
}, z.core.$strip>;
|
|
188
|
-
/**
|
|
189
|
-
* Schema for OAuth Access Token Response
|
|
190
|
-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.1
|
|
191
|
-
* @see https://datatracker.ietf.org/doc/html/rfc7636#section-4
|
|
192
|
-
*/
|
|
193
|
-
declare const OAuthAccessTokenResponse: z.ZodObject<{
|
|
194
|
-
access_token: z.ZodString;
|
|
195
|
-
token_type: z.ZodOptional<z.ZodString>;
|
|
196
|
-
expires_in: z.ZodOptional<z.ZodNumber>;
|
|
197
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
198
|
-
scope: z.ZodUnion<readonly [z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodNull]>, z.ZodOptional<z.ZodArray<z.ZodString>>]>;
|
|
199
|
-
}, z.core.$strip>;
|
|
200
|
-
/**
|
|
201
|
-
* Schema for OAuth Access Token Error Response
|
|
202
|
-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
|
|
203
|
-
*/
|
|
204
|
-
declare const OAuthAccessTokenErrorResponse: z.ZodObject<{
|
|
205
|
-
error: z.ZodEnum<{
|
|
206
|
-
invalid_request: "invalid_request";
|
|
207
|
-
unauthorized_client: "unauthorized_client";
|
|
208
|
-
invalid_scope: "invalid_scope";
|
|
209
|
-
invalid_client: "invalid_client";
|
|
210
|
-
invalid_grant: "invalid_grant";
|
|
211
|
-
unsupported_grant_type: "unsupported_grant_type";
|
|
212
|
-
}>;
|
|
213
|
-
error_description: z.ZodOptional<z.ZodString>;
|
|
214
|
-
error_uri: z.ZodOptional<z.ZodString>;
|
|
215
|
-
}, z.core.$strip>;
|
|
216
|
-
/**
|
|
217
|
-
* @todo: verify if this schema is still needed
|
|
218
|
-
* @deprecated
|
|
219
|
-
*/
|
|
220
|
-
declare const OAuthErrorResponse: z.ZodObject<{
|
|
221
|
-
error: z.ZodString;
|
|
222
|
-
error_description: z.ZodOptional<z.ZodString>;
|
|
223
|
-
}, z.core.$strip>;
|
|
224
|
-
declare const OAuthEnvSchema: z.ZodObject<{
|
|
225
|
-
clientId: z.ZodString;
|
|
226
|
-
clientSecret: z.ZodString;
|
|
227
|
-
}, z.core.$strip>;
|
|
228
|
-
|
|
229
|
-
export { OAuthAccessToken, OAuthAccessTokenErrorResponse, OAuthAccessTokenResponse, OAuthAuthorization, OAuthAuthorizationErrorResponse, OAuthAuthorizationResponse, OAuthEnvSchema, OAuthErrorResponse, OAuthProviderConfigSchema, OAuthProviderCredentialsSchema };
|
package/dist/schemas.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
OAuthAccessToken,
|
|
3
|
-
OAuthAccessTokenErrorResponse,
|
|
4
|
-
OAuthAccessTokenResponse,
|
|
5
|
-
OAuthAuthorization,
|
|
6
|
-
OAuthAuthorizationErrorResponse,
|
|
7
|
-
OAuthAuthorizationResponse,
|
|
8
|
-
OAuthEnvSchema,
|
|
9
|
-
OAuthErrorResponse,
|
|
10
|
-
OAuthProviderConfigSchema,
|
|
11
|
-
OAuthProviderCredentialsSchema
|
|
12
|
-
} from "./chunk-2A5B7GWR.js";
|
|
13
|
-
export {
|
|
14
|
-
OAuthAccessToken,
|
|
15
|
-
OAuthAccessTokenErrorResponse,
|
|
16
|
-
OAuthAccessTokenResponse,
|
|
17
|
-
OAuthAuthorization,
|
|
18
|
-
OAuthAuthorizationErrorResponse,
|
|
19
|
-
OAuthAuthorizationResponse,
|
|
20
|
-
OAuthEnvSchema,
|
|
21
|
-
OAuthErrorResponse,
|
|
22
|
-
OAuthProviderConfigSchema,
|
|
23
|
-
OAuthProviderCredentialsSchema
|
|
24
|
-
};
|
package/dist/secure.cjs
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/secure.ts
|
|
21
|
-
var secure_exports = {};
|
|
22
|
-
__export(secure_exports, {
|
|
23
|
-
createCSRF: () => createCSRF,
|
|
24
|
-
createHash: () => createHash,
|
|
25
|
-
createPKCE: () => createPKCE,
|
|
26
|
-
createSecretValue: () => createSecretValue,
|
|
27
|
-
generateSecure: () => generateSecure,
|
|
28
|
-
verifyCSRF: () => verifyCSRF
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(secure_exports);
|
|
31
|
-
|
|
32
|
-
// src/utils.ts
|
|
33
|
-
var import_router = require("@aura-stack/router");
|
|
34
|
-
|
|
35
|
-
// src/errors.ts
|
|
36
|
-
var AuthSecurityError = class extends Error {
|
|
37
|
-
type = "AUTH_SECURITY_ERROR";
|
|
38
|
-
code;
|
|
39
|
-
constructor(code, message, options) {
|
|
40
|
-
super(message, options);
|
|
41
|
-
this.code = code;
|
|
42
|
-
this.name = new.target.name;
|
|
43
|
-
Error.captureStackTrace(this, new.target);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// src/env.ts
|
|
48
|
-
var import_meta = {};
|
|
49
|
-
var env = new Proxy({}, {
|
|
50
|
-
get(_, prop) {
|
|
51
|
-
if (typeof prop !== "string") return void 0;
|
|
52
|
-
const hasProperty = (process2) => {
|
|
53
|
-
return process2 && Object.prototype.hasOwnProperty.call(process2, prop);
|
|
54
|
-
};
|
|
55
|
-
try {
|
|
56
|
-
if (typeof process !== "undefined" && hasProperty(process.env)) {
|
|
57
|
-
return process.env[prop];
|
|
58
|
-
}
|
|
59
|
-
if (typeof import_meta !== "undefined" && hasProperty(import_meta.env)) {
|
|
60
|
-
return import_meta.env[prop];
|
|
61
|
-
}
|
|
62
|
-
if (typeof Deno !== "undefined" && Deno.env?.get) {
|
|
63
|
-
return Deno.env.get(prop);
|
|
64
|
-
}
|
|
65
|
-
if (typeof Bun !== "undefined" && hasProperty(Bun.env)) {
|
|
66
|
-
return Bun.env[prop];
|
|
67
|
-
}
|
|
68
|
-
const globalValue = globalThis[prop];
|
|
69
|
-
return typeof globalValue === "string" ? globalValue : void 0;
|
|
70
|
-
} catch {
|
|
71
|
-
return void 0;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// src/assert.ts
|
|
77
|
-
var import_crypto = require("@aura-stack/jose/crypto");
|
|
78
|
-
var isJWTPayloadWithToken = (payload) => {
|
|
79
|
-
return typeof payload === "object" && payload !== null && "token" in payload && typeof payload?.token === "string";
|
|
80
|
-
};
|
|
81
|
-
var timingSafeEqual = (a, b) => {
|
|
82
|
-
const bufferA = import_crypto.encoder.encode(a);
|
|
83
|
-
const bufferB = import_crypto.encoder.encode(b);
|
|
84
|
-
const len = Math.max(bufferA.length, bufferB.length);
|
|
85
|
-
let diff = 0;
|
|
86
|
-
for (let i = 0; i < len; i++) {
|
|
87
|
-
diff |= (bufferA[i] ?? 0) ^ (bufferB[i] ?? 0);
|
|
88
|
-
}
|
|
89
|
-
return diff === 0 && bufferA.length === bufferB.length;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// src/utils.ts
|
|
93
|
-
var equals = (a, b) => {
|
|
94
|
-
if (a === null || b === null || a === void 0 || b === void 0) return false;
|
|
95
|
-
return a === b;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// src/jose.ts
|
|
99
|
-
var import_jose = require("@aura-stack/jose");
|
|
100
|
-
var import_jose2 = require("@aura-stack/jose/jose");
|
|
101
|
-
var import_crypto2 = require("@aura-stack/jose/crypto");
|
|
102
|
-
var jwtVerificationOptions = {
|
|
103
|
-
algorithms: ["HS256"],
|
|
104
|
-
typ: "JWT"
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// src/secure.ts
|
|
108
|
-
var generateSecure = (length = 32) => {
|
|
109
|
-
return import_jose2.base64url.encode((0, import_crypto2.getRandomBytes)(length));
|
|
110
|
-
};
|
|
111
|
-
var createSecretValue = (length = 32) => {
|
|
112
|
-
return import_jose2.base64url.encode((0, import_crypto2.getRandomBytes)(length));
|
|
113
|
-
};
|
|
114
|
-
var createHash = async (data) => {
|
|
115
|
-
const subtle = (0, import_crypto2.getSubtleCrypto)();
|
|
116
|
-
const digest = await subtle.digest("SHA-256", import_crypto2.encoder.encode(data));
|
|
117
|
-
return import_jose2.base64url.encode(new Uint8Array(digest));
|
|
118
|
-
};
|
|
119
|
-
var createPKCE = async (verifier) => {
|
|
120
|
-
const byteLength = verifier ? void 0 : Math.floor(Math.random() * (96 - 32 + 1) + 32);
|
|
121
|
-
const codeVerifier = verifier ?? generateSecure(byteLength ?? 64);
|
|
122
|
-
if (codeVerifier.length < 43 || codeVerifier.length > 128) {
|
|
123
|
-
throw new AuthSecurityError("PKCE_VERIFIER_INVALID", "The code verifier must be between 43 and 128 characters in length.");
|
|
124
|
-
}
|
|
125
|
-
const codeChallenge = await createHash(codeVerifier);
|
|
126
|
-
return { codeVerifier, codeChallenge, method: "S256" };
|
|
127
|
-
};
|
|
128
|
-
var createCSRF = async (jose, csrfCookie) => {
|
|
129
|
-
try {
|
|
130
|
-
const token = generateSecure(32);
|
|
131
|
-
if (csrfCookie) {
|
|
132
|
-
await jose.verifyJWS(csrfCookie, jwtVerificationOptions);
|
|
133
|
-
return csrfCookie;
|
|
134
|
-
}
|
|
135
|
-
return jose.signJWS({ token });
|
|
136
|
-
} catch {
|
|
137
|
-
const token = generateSecure(32);
|
|
138
|
-
return jose.signJWS({ token });
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
var verifyCSRF = async (jose, cookie, header) => {
|
|
142
|
-
try {
|
|
143
|
-
const cookiePayload = await jose.verifyJWS(cookie, jwtVerificationOptions);
|
|
144
|
-
const headerPayload = await jose.verifyJWS(header, jwtVerificationOptions);
|
|
145
|
-
if (!isJWTPayloadWithToken(cookiePayload)) {
|
|
146
|
-
throw new AuthSecurityError("CSRF_TOKEN_INVALID", "Cookie payload missing token field.");
|
|
147
|
-
}
|
|
148
|
-
if (!isJWTPayloadWithToken(headerPayload)) {
|
|
149
|
-
throw new AuthSecurityError("CSRF_TOKEN_INVALID", "Header payload missing token field.");
|
|
150
|
-
}
|
|
151
|
-
if (!equals(cookiePayload.token.length, headerPayload.token.length)) {
|
|
152
|
-
throw new AuthSecurityError("CSRF_TOKEN_INVALID", "The CSRF tokens do not match.");
|
|
153
|
-
}
|
|
154
|
-
if (!timingSafeEqual(cookiePayload.token, headerPayload.token)) {
|
|
155
|
-
throw new AuthSecurityError("CSRF_TOKEN_INVALID", "The CSRF tokens do not match.");
|
|
156
|
-
}
|
|
157
|
-
return true;
|
|
158
|
-
} catch {
|
|
159
|
-
throw new AuthSecurityError("CSRF_TOKEN_INVALID", "The CSRF tokens do not match.");
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
163
|
-
0 && (module.exports = {
|
|
164
|
-
createCSRF,
|
|
165
|
-
createHash,
|
|
166
|
-
createPKCE,
|
|
167
|
-
createSecretValue,
|
|
168
|
-
generateSecure,
|
|
169
|
-
verifyCSRF
|
|
170
|
-
});
|
package/dist/secure.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { c as AuthRuntimeConfig } from './index-_aXtxb_s.js';
|
|
2
|
-
import 'zod';
|
|
3
|
-
import './schemas.js';
|
|
4
|
-
import 'zod/v4';
|
|
5
|
-
import '@aura-stack/jose';
|
|
6
|
-
import '@aura-stack/jose/jose';
|
|
7
|
-
import '@aura-stack/jose/crypto';
|
|
8
|
-
import '@aura-stack/router/cookie';
|
|
9
|
-
import './@types/utility.js';
|
|
10
|
-
import 'jose';
|
|
11
|
-
import '@aura-stack/router';
|
|
12
|
-
import 'zod/v4/core';
|
|
13
|
-
|
|
14
|
-
/** @deprecated use `createSecretValue` instead */
|
|
15
|
-
declare const generateSecure: (length?: number) => string;
|
|
16
|
-
declare const createSecretValue: (length?: number) => string;
|
|
17
|
-
declare const createHash: (data: string) => Promise<string>;
|
|
18
|
-
/**
|
|
19
|
-
* Creates the code challenge flow for PKCE OAuth flow. It generates a code verifier and its corresponding
|
|
20
|
-
* code challenge using SHA-256 hashing.
|
|
21
|
-
* - code_verifier: A cryptographically random string used to mitigate authorization code interception attacks.
|
|
22
|
-
* - code_challenge: A hashed version of the code_verifier sent in the authorization request.
|
|
23
|
-
* - method: The method used to generate the code challenge, typically "S256" for SHA-256.
|
|
24
|
-
*
|
|
25
|
-
* @see https://datatracker.ietf.org/doc/html/rfc7636#section-4.1
|
|
26
|
-
*/
|
|
27
|
-
declare const createPKCE: (verifier?: string) => Promise<{
|
|
28
|
-
codeVerifier: string;
|
|
29
|
-
codeChallenge: string;
|
|
30
|
-
method: string;
|
|
31
|
-
}>;
|
|
32
|
-
/**
|
|
33
|
-
* Creates a CSRF token to be used in OAuth flows to prevent cross-site request forgery attacks.
|
|
34
|
-
*
|
|
35
|
-
* @param csrfCookie - Optional existing CSRF cookie to verify and reuse
|
|
36
|
-
* @returns Signed CSRF token
|
|
37
|
-
*/
|
|
38
|
-
declare const createCSRF: (jose: AuthRuntimeConfig["jose"], csrfCookie?: string) => Promise<string>;
|
|
39
|
-
declare const verifyCSRF: (jose: AuthRuntimeConfig["jose"], cookie: string, header: string) => Promise<boolean>;
|
|
40
|
-
|
|
41
|
-
export { createCSRF, createHash, createPKCE, createSecretValue, generateSecure, verifyCSRF };
|
package/dist/secure.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createCSRF,
|
|
3
|
-
createHash,
|
|
4
|
-
createPKCE,
|
|
5
|
-
createSecretValue,
|
|
6
|
-
generateSecure,
|
|
7
|
-
verifyCSRF
|
|
8
|
-
} from "./chunk-V6LLEAR4.js";
|
|
9
|
-
import "./chunk-UZQJJD6A.js";
|
|
10
|
-
import "./chunk-LX3TJ2TJ.js";
|
|
11
|
-
import "./chunk-WHNDRO3N.js";
|
|
12
|
-
import "./chunk-U5663F2U.js";
|
|
13
|
-
export {
|
|
14
|
-
createCSRF,
|
|
15
|
-
createHash,
|
|
16
|
-
createPKCE,
|
|
17
|
-
createSecretValue,
|
|
18
|
-
generateSecure,
|
|
19
|
-
verifyCSRF
|
|
20
|
-
};
|