@aura-stack/auth 0.2.0 → 0.4.0-rc.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/@types/index.d.ts +3 -2
- package/dist/@types/router.d.d.ts +3 -2
- package/dist/actions/callback/access-token.cjs +52 -41
- package/dist/actions/callback/access-token.d.ts +5 -4
- package/dist/actions/callback/access-token.js +3 -2
- package/dist/actions/callback/callback.cjs +69 -52
- package/dist/actions/callback/callback.d.ts +26 -3
- package/dist/actions/callback/callback.js +6 -5
- package/dist/actions/callback/userinfo.cjs +54 -43
- package/dist/actions/callback/userinfo.d.ts +3 -2
- package/dist/actions/callback/userinfo.js +3 -2
- package/dist/actions/csrfToken/csrfToken.cjs +2 -2
- package/dist/actions/csrfToken/csrfToken.d.ts +3 -1
- package/dist/actions/csrfToken/csrfToken.js +2 -2
- package/dist/actions/index.cjs +93 -71
- package/dist/actions/index.d.ts +3 -2
- package/dist/actions/index.js +15 -14
- package/dist/actions/session/session.d.ts +3 -1
- package/dist/actions/session/session.js +2 -2
- package/dist/actions/signIn/authorization.cjs +40 -40
- package/dist/actions/signIn/authorization.d.ts +3 -2
- package/dist/actions/signIn/authorization.js +2 -2
- package/dist/actions/signIn/signIn.cjs +63 -50
- package/dist/actions/signIn/signIn.d.ts +25 -3
- package/dist/actions/signIn/signIn.js +4 -3
- package/dist/actions/signOut/signOut.cjs +66 -66
- package/dist/actions/signOut/signOut.d.ts +9 -1
- package/dist/actions/signOut/signOut.js +4 -4
- package/dist/assert.d.ts +3 -2
- package/dist/{chunk-2RXNXMCZ.js → chunk-3EUWD5BB.js} +15 -7
- package/dist/{chunk-NEVKX6K2.js → chunk-A3N4PVAT.js} +3 -3
- package/dist/chunk-B737EUJV.js +22 -0
- package/dist/{chunk-7H3OR6UU.js → chunk-EMKJA2GJ.js} +18 -10
- package/dist/{chunk-4V4JNXVF.js → chunk-GA2SMTJO.js} +9 -6
- package/dist/chunk-HP34YGGJ.js +22 -0
- package/dist/{chunk-QDO2KSRJ.js → chunk-HT4YLL7N.js} +1 -1
- package/dist/{chunk-ZLR3LI6X.js → chunk-IVET23KF.js} +7 -4
- package/dist/{chunk-PTJUYB33.js → chunk-JVFTCTTE.js} +1 -1
- package/dist/{chunk-UEH3LVON.js → chunk-KSWLO5ZU.js} +21 -16
- package/dist/{chunk-QEZL7EYN.js → chunk-N4SX7TZT.js} +3 -3
- package/dist/{chunk-IMICRJ5U.js → chunk-W6LG7BFW.js} +14 -14
- package/dist/{chunk-WD7AUHQ5.js → chunk-YRCB5FLE.js} +8 -8
- package/dist/chunk-ZNCZVF6U.js +14 -0
- package/dist/cookie.cjs +14 -14
- package/dist/cookie.d.ts +3 -2
- package/dist/cookie.js +1 -1
- package/dist/errors.d.ts +3 -2
- package/dist/{index-EqsoyjrF.d.ts → index-B8jeIElf.d.ts} +57 -8
- package/dist/index.cjs +159 -95
- package/dist/index.d.ts +66 -5
- package/dist/index.js +23 -19
- package/dist/jose.cjs +2 -2
- package/dist/oauth/bitbucket.d.ts +3 -2
- package/dist/oauth/discord.d.ts +3 -2
- package/dist/oauth/figma.d.ts +3 -2
- package/dist/oauth/github.d.ts +3 -2
- package/dist/oauth/gitlab.d.ts +3 -2
- package/dist/oauth/index.cjs +85 -41
- package/dist/oauth/index.d.ts +3 -2
- package/dist/oauth/index.js +16 -8
- package/dist/oauth/mailchimp.cjs +46 -0
- package/dist/oauth/mailchimp.d.ts +7 -0
- package/dist/oauth/mailchimp.js +6 -0
- package/dist/oauth/pinterest.cjs +46 -0
- package/dist/oauth/pinterest.d.ts +7 -0
- package/dist/oauth/pinterest.js +6 -0
- package/dist/oauth/spotify.d.ts +3 -2
- package/dist/oauth/strava.d.ts +3 -2
- package/dist/oauth/x.d.ts +3 -2
- package/dist/request.cjs +38 -0
- package/dist/request.d.ts +13 -0
- package/dist/request.js +6 -0
- package/dist/schemas.cjs +40 -40
- package/dist/schemas.d.ts +15 -15
- package/dist/schemas.js +1 -1
- package/dist/secure.cjs +5 -5
- package/dist/secure.d.ts +3 -2
- package/dist/utils.d.ts +3 -3
- package/package.json +7 -5
package/dist/schemas.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Schema for OAuth Provider Configuration
|
|
5
5
|
*/
|
|
6
6
|
declare const OAuthProviderConfigSchema: z.ZodObject<{
|
|
7
|
-
authorizeURL: z.
|
|
8
|
-
accessToken: z.
|
|
7
|
+
authorizeURL: z.ZodString;
|
|
8
|
+
accessToken: z.ZodString;
|
|
9
9
|
scope: z.ZodOptional<z.ZodString>;
|
|
10
|
-
userInfo: z.
|
|
10
|
+
userInfo: z.ZodString;
|
|
11
11
|
responseType: z.ZodEnum<{
|
|
12
|
-
code: "code";
|
|
13
12
|
token: "token";
|
|
13
|
+
code: "code";
|
|
14
14
|
id_token: "id_token";
|
|
15
15
|
}>;
|
|
16
16
|
clientId: z.ZodString;
|
|
@@ -22,13 +22,13 @@ declare const OAuthProviderConfigSchema: z.ZodObject<{
|
|
|
22
22
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1
|
|
23
23
|
*/
|
|
24
24
|
declare const OAuthAuthorization: z.ZodObject<{
|
|
25
|
-
authorizeURL: z.
|
|
26
|
-
accessToken: z.
|
|
25
|
+
authorizeURL: z.ZodString;
|
|
26
|
+
accessToken: z.ZodString;
|
|
27
27
|
scope: z.ZodOptional<z.ZodString>;
|
|
28
|
-
userInfo: z.
|
|
28
|
+
userInfo: z.ZodString;
|
|
29
29
|
responseType: z.ZodEnum<{
|
|
30
|
-
code: "code";
|
|
31
30
|
token: "token";
|
|
31
|
+
code: "code";
|
|
32
32
|
id_token: "id_token";
|
|
33
33
|
}>;
|
|
34
34
|
clientId: z.ZodString;
|
|
@@ -74,13 +74,13 @@ declare const OAuthAuthorizationErrorResponse: z.ZodObject<{
|
|
|
74
74
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3
|
|
75
75
|
*/
|
|
76
76
|
declare const OAuthAccessToken: z.ZodObject<{
|
|
77
|
-
authorizeURL: z.
|
|
78
|
-
accessToken: z.
|
|
77
|
+
authorizeURL: z.ZodString;
|
|
78
|
+
accessToken: z.ZodString;
|
|
79
79
|
scope: z.ZodOptional<z.ZodString>;
|
|
80
|
-
userInfo: z.
|
|
80
|
+
userInfo: z.ZodString;
|
|
81
81
|
responseType: z.ZodEnum<{
|
|
82
|
-
code: "code";
|
|
83
82
|
token: "token";
|
|
83
|
+
code: "code";
|
|
84
84
|
id_token: "id_token";
|
|
85
85
|
}>;
|
|
86
86
|
clientId: z.ZodString;
|
|
@@ -96,10 +96,10 @@ declare const OAuthAccessToken: z.ZodObject<{
|
|
|
96
96
|
*/
|
|
97
97
|
declare const OAuthAccessTokenResponse: z.ZodObject<{
|
|
98
98
|
access_token: z.ZodString;
|
|
99
|
-
token_type: z.ZodString
|
|
99
|
+
token_type: z.ZodOptional<z.ZodString>;
|
|
100
100
|
expires_in: z.ZodOptional<z.ZodNumber>;
|
|
101
101
|
refresh_token: z.ZodOptional<z.ZodString>;
|
|
102
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
102
|
+
scope: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodNull]>;
|
|
103
103
|
}, z.core.$strip>;
|
|
104
104
|
/**
|
|
105
105
|
* Schema for OAuth Access Token Error Response
|
package/dist/schemas.js
CHANGED
package/dist/secure.cjs
CHANGED
|
@@ -38,7 +38,7 @@ __export(secure_exports, {
|
|
|
38
38
|
verifyCSRF: () => verifyCSRF
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(secure_exports);
|
|
41
|
-
var
|
|
41
|
+
var import_crypto = __toESM(require("crypto"), 1);
|
|
42
42
|
|
|
43
43
|
// src/utils.ts
|
|
44
44
|
var import_router = require("@aura-stack/router");
|
|
@@ -68,10 +68,10 @@ var isJWTPayloadWithToken = (payload) => {
|
|
|
68
68
|
|
|
69
69
|
// src/secure.ts
|
|
70
70
|
var generateSecure = (length = 32) => {
|
|
71
|
-
return
|
|
71
|
+
return import_crypto.default.randomBytes(length).toString("base64url");
|
|
72
72
|
};
|
|
73
73
|
var createHash = (data, base = "hex") => {
|
|
74
|
-
return
|
|
74
|
+
return import_crypto.default.createHash("sha256").update(data).digest().toString(base);
|
|
75
75
|
};
|
|
76
76
|
var createPKCE = async (verifier) => {
|
|
77
77
|
const codeVerifier = verifier ?? generateSecure(86);
|
|
@@ -106,7 +106,7 @@ var verifyCSRF = async (jose, cookie, header) => {
|
|
|
106
106
|
if (!equals(headerBuffer.length, cookieBuffer.length)) {
|
|
107
107
|
throw new AuthSecurityError("CSRF_TOKEN_INVALID", "The CSRF tokens do not match.");
|
|
108
108
|
}
|
|
109
|
-
if (!
|
|
109
|
+
if (!import_crypto.default.timingSafeEqual(cookieBuffer, headerBuffer)) {
|
|
110
110
|
throw new AuthSecurityError("CSRF_TOKEN_INVALID", "The CSRF tokens do not match.");
|
|
111
111
|
}
|
|
112
112
|
return true;
|
|
@@ -115,7 +115,7 @@ var verifyCSRF = async (jose, cookie, header) => {
|
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
var createDerivedSalt = (secret) => {
|
|
118
|
-
return
|
|
118
|
+
return import_crypto.default.createHash("sha256").update(secret).update("aura-auth-salt").digest("hex");
|
|
119
119
|
};
|
|
120
120
|
// Annotate the CommonJS export names for ESM import in node:
|
|
121
121
|
0 && (module.exports = {
|
package/dist/secure.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { A as AuthRuntimeConfig } from './index-
|
|
2
|
-
import 'zod
|
|
1
|
+
import { A as AuthRuntimeConfig } from './index-B8jeIElf.js';
|
|
2
|
+
import 'zod';
|
|
3
3
|
import './schemas.js';
|
|
4
4
|
import '@aura-stack/router/cookie';
|
|
5
|
+
import '@aura-stack/jose';
|
|
5
6
|
import '@aura-stack/jose/jose';
|
|
6
7
|
import './@types/utility.js';
|
|
7
8
|
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ZodError } from 'zod';
|
|
2
1
|
import { RouterConfig } from '@aura-stack/router';
|
|
3
|
-
import { i as APIErrorMap } from './index-
|
|
4
|
-
import 'zod
|
|
2
|
+
import { i as APIErrorMap } from './index-B8jeIElf.js';
|
|
3
|
+
import { ZodError } from 'zod';
|
|
5
4
|
import './schemas.js';
|
|
6
5
|
import '@aura-stack/router/cookie';
|
|
6
|
+
import '@aura-stack/jose';
|
|
7
7
|
import '@aura-stack/jose/jose';
|
|
8
8
|
import './@types/utility.js';
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aura-stack/auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-rc.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Core auth for @aura-stack/auth",
|
|
@@ -44,14 +44,16 @@
|
|
|
44
44
|
},
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@aura-stack/router": "
|
|
47
|
+
"@aura-stack/router": "0.6.0-rc.1",
|
|
48
48
|
"dotenv": "^17.2.3",
|
|
49
|
-
"zod": "^4.
|
|
49
|
+
"zod": "^4.3.5",
|
|
50
50
|
"@aura-stack/jose": "0.2.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
53
|
+
"@types/node": "^24.9.2",
|
|
54
|
+
"typescript": "^5.9.2",
|
|
55
|
+
"@aura-stack/tsconfig": "0.0.0",
|
|
56
|
+
"@aura-stack/tsup-config": "0.0.0"
|
|
55
57
|
},
|
|
56
58
|
"scripts": {
|
|
57
59
|
"dev": "tsup --watch",
|