@aura-stack/auth 0.1.0 → 0.2.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/dist/@types/index.d.ts +3 -4
- package/dist/@types/router.d.d.ts +3 -4
- package/dist/@types/utility.d.ts +1 -5
- package/dist/actions/callback/access-token.cjs +51 -41
- package/dist/actions/callback/access-token.d.ts +3 -4
- package/dist/actions/callback/access-token.js +4 -3
- package/dist/actions/callback/callback.cjs +115 -210
- package/dist/actions/callback/callback.d.ts +3 -4
- package/dist/actions/callback/callback.js +9 -10
- package/dist/actions/callback/userinfo.cjs +35 -22
- package/dist/actions/callback/userinfo.d.ts +3 -4
- package/dist/actions/callback/userinfo.js +6 -5
- package/dist/actions/csrfToken/csrfToken.cjs +34 -103
- package/dist/actions/csrfToken/csrfToken.js +6 -6
- package/dist/actions/index.cjs +234 -391
- package/dist/actions/index.d.ts +3 -4
- package/dist/actions/index.js +16 -17
- package/dist/actions/session/session.cjs +25 -109
- package/dist/actions/session/session.js +4 -5
- package/dist/actions/signIn/authorization.cjs +64 -55
- package/dist/actions/signIn/authorization.d.ts +3 -4
- package/dist/actions/signIn/authorization.js +5 -5
- package/dist/actions/signIn/signIn.cjs +84 -206
- package/dist/actions/signIn/signIn.d.ts +3 -4
- package/dist/actions/signIn/signIn.js +7 -9
- package/dist/actions/signOut/signOut.cjs +88 -234
- package/dist/actions/signOut/signOut.js +8 -9
- package/dist/assert.cjs +5 -0
- package/dist/assert.d.ts +9 -1
- package/dist/assert.js +3 -1
- package/dist/chunk-2RXNXMCZ.js +55 -0
- package/dist/{chunk-UJJ7R56J.js → chunk-4V4JNXVF.js} +13 -10
- package/dist/chunk-6R2YZ4AC.js +22 -0
- package/dist/{chunk-VFTYH33W.js → chunk-7H3OR6UU.js} +29 -9
- package/dist/{chunk-256KIVJL.js → chunk-CXLATHS5.js} +53 -9
- package/dist/{chunk-6SM22VVJ.js → chunk-EIL2FPSS.js} +5 -1
- package/dist/chunk-IMICRJ5U.js +197 -0
- package/dist/{chunk-EBPE35JT.js → chunk-IUYZQTJV.js} +0 -1
- package/dist/{chunk-GZU3RBTB.js → chunk-N2APGLXA.js} +19 -10
- package/dist/chunk-NEVKX6K2.js +70 -0
- package/dist/{chunk-XXJKNKGQ.js → chunk-PTJUYB33.js} +9 -13
- package/dist/chunk-QDO2KSRJ.js +35 -0
- package/dist/{chunk-CAKJT3KS.js → chunk-QEZL7EYN.js} +21 -17
- package/dist/chunk-RRLIF4PQ.js +55 -0
- package/dist/chunk-TLE4PXY3.js +39 -0
- package/dist/chunk-UEH3LVON.js +97 -0
- package/dist/{chunk-HMRKN75I.js → chunk-WD7AUHQ5.js} +12 -7
- package/dist/{chunk-RLT4RFKV.js → chunk-ZLR3LI6X.js} +19 -9
- package/dist/cookie.cjs +140 -99
- package/dist/cookie.d.ts +33 -43
- package/dist/cookie.js +10 -17
- package/dist/errors.cjs +85 -0
- package/dist/errors.d.ts +48 -0
- package/dist/errors.js +18 -0
- package/dist/{index-DpfbvTZ_.d.ts → index-EqsoyjrF.d.ts} +139 -57
- package/dist/index.cjs +427 -389
- package/dist/index.d.ts +4 -5
- package/dist/index.js +37 -26
- package/dist/jose.cjs +23 -12
- package/dist/jose.d.ts +4 -1
- package/dist/jose.js +5 -4
- package/dist/oauth/bitbucket.d.ts +3 -4
- package/dist/oauth/discord.cjs +0 -1
- package/dist/oauth/discord.d.ts +3 -4
- package/dist/oauth/discord.js +1 -1
- package/dist/oauth/figma.d.ts +3 -4
- package/dist/oauth/github.d.ts +3 -4
- package/dist/oauth/gitlab.d.ts +3 -4
- package/dist/oauth/index.cjs +132 -6
- package/dist/oauth/index.d.ts +3 -4
- package/dist/oauth/index.js +12 -5
- package/dist/oauth/spotify.d.ts +3 -4
- package/dist/{response.cjs → oauth/strava.cjs} +21 -9
- package/dist/oauth/strava.d.ts +6 -0
- package/dist/oauth/strava.js +6 -0
- package/dist/oauth/x.d.ts +3 -4
- package/dist/schemas.cjs +11 -5
- package/dist/schemas.d.ts +70 -67
- package/dist/schemas.js +3 -1
- package/dist/secure.cjs +27 -19
- package/dist/secure.d.ts +3 -4
- package/dist/secure.js +4 -3
- package/dist/utils.cjs +90 -15
- package/dist/utils.d.ts +11 -2
- package/dist/utils.js +8 -4
- package/package.json +5 -6
- package/dist/chunk-FJUDBLCP.js +0 -59
- package/dist/chunk-HGJ4TXY4.js +0 -137
- package/dist/chunk-JAPMIE6S.js +0 -10
- package/dist/chunk-LLR722CL.js +0 -96
- package/dist/chunk-SJPDVKUS.js +0 -112
- package/dist/chunk-SMQO5WD7.js +0 -30
- package/dist/chunk-UTDLUEEG.js +0 -31
- package/dist/chunk-ZV4BH47P.js +0 -154
- package/dist/error.cjs +0 -88
- package/dist/error.d.ts +0 -62
- package/dist/error.js +0 -16
- package/dist/response.d.ts +0 -10
- package/dist/response.js +0 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { C as CookieConfig, E as ErrorType,
|
|
1
|
+
import { d as AuthConfig, e as AuthInstance } from './index-EqsoyjrF.js';
|
|
2
|
+
export { C as CookieConfig, E as ErrorType, f as JoseInstance, O as OAuthProvider, g as OAuthProviderConfig, h as OAuthProviderCredentials, S as Session, U as User } from './index-EqsoyjrF.js';
|
|
3
3
|
import 'zod/v4';
|
|
4
|
-
import '@aura-stack/jose/jose';
|
|
5
4
|
import './schemas.js';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
5
|
+
import '@aura-stack/router/cookie';
|
|
6
|
+
import '@aura-stack/jose/jose';
|
|
8
7
|
import './@types/utility.js';
|
|
9
8
|
|
|
10
9
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,62 +1,73 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createBuiltInOAuthProviders
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-FKRDCWBF.js";
|
|
3
|
+
} from "./chunk-7H3OR6UU.js";
|
|
5
4
|
import "./chunk-IKHPGFCW.js";
|
|
6
5
|
import "./chunk-KRNOMBXQ.js";
|
|
7
6
|
import "./chunk-E3OXBRYF.js";
|
|
7
|
+
import "./chunk-6R2YZ4AC.js";
|
|
8
8
|
import "./chunk-42XB3YCW.js";
|
|
9
9
|
import "./chunk-ITQ7352M.js";
|
|
10
10
|
import {
|
|
11
11
|
csrfTokenAction
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
sessionAction
|
|
15
|
-
} from "./chunk-XXJKNKGQ.js";
|
|
12
|
+
} from "./chunk-QDO2KSRJ.js";
|
|
16
13
|
import {
|
|
17
14
|
signInAction
|
|
18
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2RXNXMCZ.js";
|
|
16
|
+
import {
|
|
17
|
+
sessionAction
|
|
18
|
+
} from "./chunk-PTJUYB33.js";
|
|
19
19
|
import {
|
|
20
20
|
signOutAction
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-NEVKX6K2.js";
|
|
22
|
+
import "./chunk-QEZL7EYN.js";
|
|
23
23
|
import {
|
|
24
24
|
callbackAction
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-UEH3LVON.js";
|
|
26
|
+
import "./chunk-ZLR3LI6X.js";
|
|
27
|
+
import "./chunk-4V4JNXVF.js";
|
|
28
28
|
import "./chunk-FIPU4MLT.js";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-IUYZQTJV.js";
|
|
30
|
+
import "./chunk-FKRDCWBF.js";
|
|
30
31
|
import {
|
|
31
|
-
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-6SM22VVJ.js";
|
|
32
|
+
createCookieStore
|
|
33
|
+
} from "./chunk-IMICRJ5U.js";
|
|
34
34
|
import "./chunk-STHEPPUZ.js";
|
|
35
35
|
import {
|
|
36
36
|
createJoseInstance
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-TLE4PXY3.js";
|
|
38
|
+
import "./chunk-WD7AUHQ5.js";
|
|
39
|
+
import "./chunk-N2APGLXA.js";
|
|
39
40
|
import {
|
|
40
|
-
onErrorHandler
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
41
|
+
onErrorHandler,
|
|
42
|
+
useSecureCookies
|
|
43
|
+
} from "./chunk-CXLATHS5.js";
|
|
44
|
+
import "./chunk-EIL2FPSS.js";
|
|
45
|
+
import "./chunk-RRLIF4PQ.js";
|
|
45
46
|
|
|
46
47
|
// src/index.ts
|
|
47
48
|
import "dotenv/config";
|
|
48
49
|
import { createRouter } from "@aura-stack/router";
|
|
49
50
|
var createInternalConfig = (authConfig) => {
|
|
51
|
+
const useSecure = authConfig?.trustedProxyHeaders ?? false;
|
|
50
52
|
return {
|
|
51
53
|
basePath: authConfig?.basePath ?? "/auth",
|
|
52
54
|
onError: onErrorHandler,
|
|
53
55
|
context: {
|
|
54
56
|
oauth: createBuiltInOAuthProviders(authConfig?.oauth),
|
|
55
|
-
cookies: authConfig?.cookies ??
|
|
57
|
+
cookies: createCookieStore(useSecure, authConfig?.cookies?.prefix, authConfig?.cookies?.overrides ?? {}),
|
|
56
58
|
jose: createJoseInstance(authConfig?.secret),
|
|
59
|
+
secret: authConfig?.secret,
|
|
57
60
|
basePath: authConfig?.basePath ?? "/auth",
|
|
58
|
-
trustedProxyHeaders:
|
|
59
|
-
}
|
|
61
|
+
trustedProxyHeaders: useSecure
|
|
62
|
+
},
|
|
63
|
+
middlewares: [
|
|
64
|
+
(ctx) => {
|
|
65
|
+
const useSecure2 = useSecureCookies(ctx.request, ctx.context.trustedProxyHeaders);
|
|
66
|
+
const cookies = createCookieStore(useSecure2, authConfig?.cookies?.prefix, authConfig?.cookies?.overrides ?? {});
|
|
67
|
+
ctx.context.cookies = cookies;
|
|
68
|
+
return ctx;
|
|
69
|
+
}
|
|
70
|
+
]
|
|
60
71
|
};
|
|
61
72
|
};
|
|
62
73
|
var createAuth = (authConfig) => {
|
package/dist/jose.cjs
CHANGED
|
@@ -42,12 +42,15 @@ var import_node_crypto = __toESM(require("crypto"), 1);
|
|
|
42
42
|
// src/utils.ts
|
|
43
43
|
var import_router = require("@aura-stack/router");
|
|
44
44
|
|
|
45
|
-
// src/
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
// src/errors.ts
|
|
46
|
+
var AuthInternalError = class extends Error {
|
|
47
|
+
type = "AUTH_INTERNAL_ERROR";
|
|
48
|
+
code;
|
|
49
|
+
constructor(code, message, options) {
|
|
50
|
+
super(message, options);
|
|
51
|
+
this.code = code;
|
|
52
|
+
this.name = new.target.name;
|
|
53
|
+
Error.captureStackTrace(this, new.target);
|
|
51
54
|
}
|
|
52
55
|
};
|
|
53
56
|
|
|
@@ -58,20 +61,28 @@ var createDerivedSalt = (secret) => {
|
|
|
58
61
|
|
|
59
62
|
// src/jose.ts
|
|
60
63
|
var createJoseInstance = (secret) => {
|
|
61
|
-
|
|
64
|
+
const env = process.env;
|
|
65
|
+
secret ??= env.AURA_AUTH_SECRET ?? env.AUTH_SECRET;
|
|
62
66
|
if (!secret) {
|
|
63
|
-
throw new
|
|
67
|
+
throw new AuthInternalError(
|
|
68
|
+
"JOSE_INITIALIZATION_FAILED",
|
|
69
|
+
"AURA_AUTH_SECRET environment variable is not set and no secret was provided."
|
|
70
|
+
);
|
|
64
71
|
}
|
|
65
|
-
const salt =
|
|
66
|
-
const { derivedKey:
|
|
72
|
+
const salt = env.AURA_AUTH_SALT ?? env.AUTH_SALT ?? createDerivedSalt(secret);
|
|
73
|
+
const { derivedKey: derivedSigningKey } = (0, import_jose.createDeriveKey)(secret, salt, "signing");
|
|
74
|
+
const { derivedKey: derivedEncryptionKey } = (0, import_jose.createDeriveKey)(secret, salt, "encryption");
|
|
67
75
|
const { derivedKey: derivedCsrfTokenKey } = (0, import_jose.createDeriveKey)(secret, salt, "csrfToken");
|
|
68
|
-
const { decodeJWT, encodeJWT } = (0, import_jose.createJWT)(
|
|
76
|
+
const { decodeJWT, encodeJWT } = (0, import_jose.createJWT)({ jws: derivedSigningKey, jwe: derivedEncryptionKey });
|
|
69
77
|
const { signJWS, verifyJWS } = (0, import_jose.createJWS)(derivedCsrfTokenKey);
|
|
78
|
+
const { encryptJWE, decryptJWE } = (0, import_jose.createJWE)(derivedEncryptionKey);
|
|
70
79
|
return {
|
|
71
80
|
decodeJWT,
|
|
72
81
|
encodeJWT,
|
|
73
82
|
signJWS,
|
|
74
|
-
verifyJWS
|
|
83
|
+
verifyJWS,
|
|
84
|
+
encryptJWE,
|
|
85
|
+
decryptJWE
|
|
75
86
|
};
|
|
76
87
|
};
|
|
77
88
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/jose.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _aura_stack_jose from '@aura-stack/jose';
|
|
1
2
|
import * as _aura_stack_jose_jose from '@aura-stack/jose/jose';
|
|
2
3
|
export { JWTPayload } from '@aura-stack/jose/jose';
|
|
3
4
|
|
|
@@ -14,7 +15,9 @@ declare const createJoseInstance: (secret?: string) => {
|
|
|
14
15
|
decodeJWT: (token: string) => Promise<_aura_stack_jose_jose.JWTPayload>;
|
|
15
16
|
encodeJWT: (payload: _aura_stack_jose_jose.JWTPayload) => Promise<string>;
|
|
16
17
|
signJWS: (payload: _aura_stack_jose_jose.JWTPayload) => Promise<string>;
|
|
17
|
-
verifyJWS: (payload: string) => Promise<_aura_stack_jose_jose.JWTPayload>;
|
|
18
|
+
verifyJWS: (payload: string, options?: _aura_stack_jose.JWTVerifyOptions) => Promise<_aura_stack_jose_jose.JWTPayload>;
|
|
19
|
+
encryptJWE: (payload: string, options?: _aura_stack_jose.EncryptOptions) => Promise<string>;
|
|
20
|
+
decryptJWE: (payload: string, options?: _aura_stack_jose.JWTDecryptOptions) => Promise<string>;
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
export { createJoseInstance };
|
package/dist/jose.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createJoseInstance
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-TLE4PXY3.js";
|
|
4
|
+
import "./chunk-N2APGLXA.js";
|
|
5
|
+
import "./chunk-CXLATHS5.js";
|
|
6
|
+
import "./chunk-EIL2FPSS.js";
|
|
7
|
+
import "./chunk-RRLIF4PQ.js";
|
|
7
8
|
export {
|
|
8
9
|
createJoseInstance
|
|
9
10
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { B as BitbucketProfile,
|
|
1
|
+
export { B as BitbucketProfile, r as bitbucket } from '../index-EqsoyjrF.js';
|
|
2
2
|
import '../@types/utility.js';
|
|
3
3
|
import 'zod/v4';
|
|
4
|
-
import '@aura-stack/jose/jose';
|
|
5
4
|
import '../schemas.js';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
5
|
+
import '@aura-stack/router/cookie';
|
|
6
|
+
import '@aura-stack/jose/jose';
|
package/dist/oauth/discord.cjs
CHANGED
package/dist/oauth/discord.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { D as DiscordProfile, N as Nameplate,
|
|
1
|
+
export { D as DiscordProfile, N as Nameplate, p as discord } from '../index-EqsoyjrF.js';
|
|
2
2
|
import 'zod/v4';
|
|
3
|
-
import '@aura-stack/jose/jose';
|
|
4
3
|
import '../schemas.js';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
4
|
+
import '@aura-stack/router/cookie';
|
|
5
|
+
import '@aura-stack/jose/jose';
|
|
7
6
|
import '../@types/utility.js';
|
package/dist/oauth/discord.js
CHANGED
package/dist/oauth/figma.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { F as FigmaProfile,
|
|
1
|
+
export { F as FigmaProfile, q as figma } from '../index-EqsoyjrF.js';
|
|
2
2
|
import 'zod/v4';
|
|
3
|
-
import '@aura-stack/jose/jose';
|
|
4
3
|
import '../schemas.js';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
4
|
+
import '@aura-stack/router/cookie';
|
|
5
|
+
import '@aura-stack/jose/jose';
|
|
7
6
|
import '../@types/utility.js';
|
package/dist/oauth/github.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { t as GitHubProfile, u as github } from '../index-EqsoyjrF.js';
|
|
2
2
|
import 'zod/v4';
|
|
3
|
-
import '@aura-stack/jose/jose';
|
|
4
3
|
import '../schemas.js';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
4
|
+
import '@aura-stack/router/cookie';
|
|
5
|
+
import '@aura-stack/jose/jose';
|
|
7
6
|
import '../@types/utility.js';
|
package/dist/oauth/gitlab.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { G as GitLabProfile,
|
|
1
|
+
export { G as GitLabProfile, o as gitlab } from '../index-EqsoyjrF.js';
|
|
2
2
|
import 'zod/v4';
|
|
3
|
-
import '@aura-stack/jose/jose';
|
|
4
3
|
import '../schemas.js';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
4
|
+
import '@aura-stack/router/cookie';
|
|
5
|
+
import '@aura-stack/jose/jose';
|
|
7
6
|
import '../@types/utility.js';
|
package/dist/oauth/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ __export(oauth_exports, {
|
|
|
28
28
|
github: () => github,
|
|
29
29
|
gitlab: () => gitlab,
|
|
30
30
|
spotify: () => spotify,
|
|
31
|
+
strava: () => strava,
|
|
31
32
|
x: () => x
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(oauth_exports);
|
|
@@ -100,7 +101,6 @@ var discord = {
|
|
|
100
101
|
}
|
|
101
102
|
return {
|
|
102
103
|
sub: profile.id,
|
|
103
|
-
// https://discord.com/developers/docs/change-log#display-names
|
|
104
104
|
name: profile.global_name ?? profile.username,
|
|
105
105
|
email: profile.email ?? "",
|
|
106
106
|
image
|
|
@@ -165,6 +165,123 @@ var x = {
|
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
167
|
|
|
168
|
+
// src/oauth/strava.ts
|
|
169
|
+
var strava = {
|
|
170
|
+
id: "strava",
|
|
171
|
+
name: "Strava",
|
|
172
|
+
authorizeURL: "https://www.strava.com/oauth/authorize",
|
|
173
|
+
accessToken: "https://www.strava.com/oauth/token",
|
|
174
|
+
userInfo: "https://www.strava.com/api/v3/athlete",
|
|
175
|
+
scope: "read",
|
|
176
|
+
responseType: "code",
|
|
177
|
+
profile(profile) {
|
|
178
|
+
return {
|
|
179
|
+
sub: profile.id.toString(),
|
|
180
|
+
name: `${profile.firstname} ${profile.lastname}`,
|
|
181
|
+
image: profile.profile,
|
|
182
|
+
email: ""
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// src/schemas.ts
|
|
188
|
+
var import_v4 = require("zod/v4");
|
|
189
|
+
var OAuthProviderConfigSchema = (0, import_v4.object)({
|
|
190
|
+
authorizeURL: (0, import_v4.httpUrl)(),
|
|
191
|
+
accessToken: (0, import_v4.httpUrl)(),
|
|
192
|
+
scope: (0, import_v4.string)().optional(),
|
|
193
|
+
userInfo: (0, import_v4.httpUrl)(),
|
|
194
|
+
responseType: (0, import_v4.enum)(["code", "token", "id_token"]),
|
|
195
|
+
clientId: (0, import_v4.string)(),
|
|
196
|
+
clientSecret: (0, import_v4.string)()
|
|
197
|
+
});
|
|
198
|
+
var OAuthAuthorization = OAuthProviderConfigSchema.extend({
|
|
199
|
+
redirectURI: (0, import_v4.string)(),
|
|
200
|
+
state: (0, import_v4.string)(),
|
|
201
|
+
codeChallenge: (0, import_v4.string)(),
|
|
202
|
+
codeChallengeMethod: (0, import_v4.enum)(["plain", "S256"])
|
|
203
|
+
});
|
|
204
|
+
var OAuthAuthorizationResponse = (0, import_v4.object)({
|
|
205
|
+
state: (0, import_v4.string)("Missing state parameter in the OAuth authorization response."),
|
|
206
|
+
code: (0, import_v4.string)("Missing code parameter in the OAuth authorization response.")
|
|
207
|
+
});
|
|
208
|
+
var OAuthAuthorizationErrorResponse = (0, import_v4.object)({
|
|
209
|
+
error: (0, import_v4.enum)([
|
|
210
|
+
"invalid_request",
|
|
211
|
+
"unauthorized_client",
|
|
212
|
+
"access_denied",
|
|
213
|
+
"unsupported_response_type",
|
|
214
|
+
"invalid_scope",
|
|
215
|
+
"server_error",
|
|
216
|
+
"temporarily_unavailable"
|
|
217
|
+
]),
|
|
218
|
+
error_description: (0, import_v4.string)().optional(),
|
|
219
|
+
error_uri: (0, import_v4.string)().optional(),
|
|
220
|
+
state: (0, import_v4.string)()
|
|
221
|
+
});
|
|
222
|
+
var OAuthAccessToken = OAuthProviderConfigSchema.extend({
|
|
223
|
+
redirectURI: (0, import_v4.string)(),
|
|
224
|
+
code: (0, import_v4.string)(),
|
|
225
|
+
codeVerifier: (0, import_v4.string)().min(43).max(128)
|
|
226
|
+
});
|
|
227
|
+
var OAuthAccessTokenResponse = (0, import_v4.object)({
|
|
228
|
+
access_token: (0, import_v4.string)(),
|
|
229
|
+
token_type: (0, import_v4.string)(),
|
|
230
|
+
expires_in: (0, import_v4.number)().optional(),
|
|
231
|
+
refresh_token: (0, import_v4.string)().optional(),
|
|
232
|
+
scope: (0, import_v4.string)().optional()
|
|
233
|
+
});
|
|
234
|
+
var OAuthAccessTokenErrorResponse = (0, import_v4.object)({
|
|
235
|
+
error: (0, import_v4.enum)([
|
|
236
|
+
"invalid_request",
|
|
237
|
+
"invalid_client",
|
|
238
|
+
"invalid_grant",
|
|
239
|
+
"unauthorized_client",
|
|
240
|
+
"unsupported_grant_type",
|
|
241
|
+
"invalid_scope"
|
|
242
|
+
]),
|
|
243
|
+
error_description: (0, import_v4.string)().optional(),
|
|
244
|
+
error_uri: (0, import_v4.string)().optional()
|
|
245
|
+
});
|
|
246
|
+
var OAuthErrorResponse = (0, import_v4.object)({
|
|
247
|
+
error: (0, import_v4.string)(),
|
|
248
|
+
error_description: (0, import_v4.string)().optional()
|
|
249
|
+
});
|
|
250
|
+
var OAuthEnvSchema = (0, import_v4.object)({
|
|
251
|
+
clientId: import_v4.z.string().min(1, "OAuth Client ID is required in the environment variables."),
|
|
252
|
+
clientSecret: import_v4.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// src/errors.ts
|
|
256
|
+
var AuthInternalError = class extends Error {
|
|
257
|
+
type = "AUTH_INTERNAL_ERROR";
|
|
258
|
+
code;
|
|
259
|
+
constructor(code, message, options2) {
|
|
260
|
+
super(message, options2);
|
|
261
|
+
this.code = code;
|
|
262
|
+
this.name = new.target.name;
|
|
263
|
+
Error.captureStackTrace(this, new.target);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
// src/utils.ts
|
|
268
|
+
var import_router = require("@aura-stack/router");
|
|
269
|
+
var formatZodError = (error) => {
|
|
270
|
+
if (!error.issues || error.issues.length === 0) {
|
|
271
|
+
return {};
|
|
272
|
+
}
|
|
273
|
+
return error.issues.reduce((previous, issue) => {
|
|
274
|
+
const key = issue.path.join(".");
|
|
275
|
+
return {
|
|
276
|
+
...previous,
|
|
277
|
+
[key]: {
|
|
278
|
+
code: issue.code,
|
|
279
|
+
message: issue.message
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}, {});
|
|
283
|
+
};
|
|
284
|
+
|
|
168
285
|
// src/oauth/index.ts
|
|
169
286
|
var builtInOAuthProviders = {
|
|
170
287
|
github,
|
|
@@ -173,14 +290,22 @@ var builtInOAuthProviders = {
|
|
|
173
290
|
discord,
|
|
174
291
|
gitlab,
|
|
175
292
|
spotify,
|
|
176
|
-
x
|
|
293
|
+
x,
|
|
294
|
+
strava
|
|
177
295
|
};
|
|
178
296
|
var defineOAuthEnvironment = (oauth) => {
|
|
179
297
|
const env = process.env;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
298
|
+
const clientIdSuffix = `${oauth.toUpperCase()}_CLIENT_ID`;
|
|
299
|
+
const clientSecretSuffix = `${oauth.toUpperCase()}_CLIENT_SECRET`;
|
|
300
|
+
const loadEnvs = OAuthEnvSchema.safeParse({
|
|
301
|
+
clientId: env[`AURA_AUTH_${clientIdSuffix}`] ?? env[`AUTH_${clientIdSuffix}`] ?? env[`${clientIdSuffix}`],
|
|
302
|
+
clientSecret: env[`AURA_AUTH_${clientSecretSuffix}`] ?? env[`AUTH_${clientSecretSuffix}`] ?? env[`${clientSecretSuffix}`]
|
|
303
|
+
});
|
|
304
|
+
if (!loadEnvs.success) {
|
|
305
|
+
const msg = JSON.stringify(formatZodError(loadEnvs.error), null, 2);
|
|
306
|
+
throw new AuthInternalError("INVALID_ENVIRONMENT_CONFIGURATION", msg);
|
|
307
|
+
}
|
|
308
|
+
return loadEnvs.data;
|
|
184
309
|
};
|
|
185
310
|
var defineOAuthProviderConfig = (config) => {
|
|
186
311
|
if (typeof config === "string") {
|
|
@@ -209,5 +334,6 @@ var createBuiltInOAuthProviders = (oauth = []) => {
|
|
|
209
334
|
github,
|
|
210
335
|
gitlab,
|
|
211
336
|
spotify,
|
|
337
|
+
strava,
|
|
212
338
|
x
|
|
213
339
|
});
|
package/dist/oauth/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { B as BitbucketProfile,
|
|
1
|
+
export { B as BitbucketProfile, y as BuiltInOAuthProvider, D as DiscordProfile, F as FigmaProfile, t as GitHubProfile, G as GitLabProfile, I as Image, N as Nameplate, m as SpotifyProfile, l as StravaProfile, j as SummaryClub, k as SummaryGear, X as XProfile, r as bitbucket, v as builtInOAuthProviders, w as createBuiltInOAuthProviders, p as discord, q as figma, u as github, o as gitlab, n as spotify, s as strava, x } from '../index-EqsoyjrF.js';
|
|
2
2
|
import '../@types/utility.js';
|
|
3
3
|
import 'zod/v4';
|
|
4
|
-
import '@aura-stack/jose/jose';
|
|
5
4
|
import '../schemas.js';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
5
|
+
import '@aura-stack/router/cookie';
|
|
6
|
+
import '@aura-stack/jose/jose';
|
package/dist/oauth/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
builtInOAuthProviders,
|
|
3
3
|
createBuiltInOAuthProviders
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import {
|
|
6
|
-
figma
|
|
7
|
-
} from "../chunk-FKRDCWBF.js";
|
|
4
|
+
} from "../chunk-7H3OR6UU.js";
|
|
8
5
|
import {
|
|
9
6
|
github
|
|
10
7
|
} from "../chunk-IKHPGFCW.js";
|
|
@@ -14,6 +11,9 @@ import {
|
|
|
14
11
|
import {
|
|
15
12
|
spotify
|
|
16
13
|
} from "../chunk-E3OXBRYF.js";
|
|
14
|
+
import {
|
|
15
|
+
strava
|
|
16
|
+
} from "../chunk-6R2YZ4AC.js";
|
|
17
17
|
import {
|
|
18
18
|
x
|
|
19
19
|
} from "../chunk-42XB3YCW.js";
|
|
@@ -22,7 +22,13 @@ import {
|
|
|
22
22
|
} from "../chunk-FIPU4MLT.js";
|
|
23
23
|
import {
|
|
24
24
|
discord
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-IUYZQTJV.js";
|
|
26
|
+
import {
|
|
27
|
+
figma
|
|
28
|
+
} from "../chunk-FKRDCWBF.js";
|
|
29
|
+
import "../chunk-WD7AUHQ5.js";
|
|
30
|
+
import "../chunk-CXLATHS5.js";
|
|
31
|
+
import "../chunk-RRLIF4PQ.js";
|
|
26
32
|
export {
|
|
27
33
|
bitbucket,
|
|
28
34
|
builtInOAuthProviders,
|
|
@@ -32,5 +38,6 @@ export {
|
|
|
32
38
|
github,
|
|
33
39
|
gitlab,
|
|
34
40
|
spotify,
|
|
41
|
+
strava,
|
|
35
42
|
x
|
|
36
43
|
};
|
package/dist/oauth/spotify.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { I as Image, m as SpotifyProfile, n as spotify } from '../index-EqsoyjrF.js';
|
|
2
2
|
import 'zod/v4';
|
|
3
|
-
import '@aura-stack/jose/jose';
|
|
4
3
|
import '../schemas.js';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
4
|
+
import '@aura-stack/router/cookie';
|
|
5
|
+
import '@aura-stack/jose/jose';
|
|
7
6
|
import '../@types/utility.js';
|
|
@@ -17,18 +17,30 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
20
|
+
// src/oauth/strava.ts
|
|
21
|
+
var strava_exports = {};
|
|
22
|
+
__export(strava_exports, {
|
|
23
|
+
strava: () => strava
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
module.exports = __toCommonJS(strava_exports);
|
|
26
|
+
var strava = {
|
|
27
|
+
id: "strava",
|
|
28
|
+
name: "Strava",
|
|
29
|
+
authorizeURL: "https://www.strava.com/oauth/authorize",
|
|
30
|
+
accessToken: "https://www.strava.com/oauth/token",
|
|
31
|
+
userInfo: "https://www.strava.com/api/v3/athlete",
|
|
32
|
+
scope: "read",
|
|
33
|
+
responseType: "code",
|
|
34
|
+
profile(profile) {
|
|
35
|
+
return {
|
|
36
|
+
sub: profile.id.toString(),
|
|
37
|
+
name: `${profile.firstname} ${profile.lastname}`,
|
|
38
|
+
image: profile.profile,
|
|
39
|
+
email: ""
|
|
40
|
+
};
|
|
29
41
|
}
|
|
30
42
|
};
|
|
31
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
44
|
0 && (module.exports = {
|
|
33
|
-
|
|
45
|
+
strava
|
|
34
46
|
});
|
package/dist/oauth/x.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { X as XProfile, x } from '../index-
|
|
1
|
+
export { X as XProfile, x } from '../index-EqsoyjrF.js';
|
|
2
2
|
import 'zod/v4';
|
|
3
|
-
import '@aura-stack/jose/jose';
|
|
4
3
|
import '../schemas.js';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
4
|
+
import '@aura-stack/router/cookie';
|
|
5
|
+
import '@aura-stack/jose/jose';
|
|
7
6
|
import '../@types/utility.js';
|
package/dist/schemas.cjs
CHANGED
|
@@ -26,16 +26,17 @@ __export(schemas_exports, {
|
|
|
26
26
|
OAuthAuthorization: () => OAuthAuthorization,
|
|
27
27
|
OAuthAuthorizationErrorResponse: () => OAuthAuthorizationErrorResponse,
|
|
28
28
|
OAuthAuthorizationResponse: () => OAuthAuthorizationResponse,
|
|
29
|
+
OAuthEnvSchema: () => OAuthEnvSchema,
|
|
29
30
|
OAuthErrorResponse: () => OAuthErrorResponse,
|
|
30
31
|
OAuthProviderConfigSchema: () => OAuthProviderConfigSchema
|
|
31
32
|
});
|
|
32
33
|
module.exports = __toCommonJS(schemas_exports);
|
|
33
34
|
var import_v4 = require("zod/v4");
|
|
34
35
|
var OAuthProviderConfigSchema = (0, import_v4.object)({
|
|
35
|
-
authorizeURL: (0, import_v4.
|
|
36
|
-
accessToken: (0, import_v4.
|
|
36
|
+
authorizeURL: (0, import_v4.httpUrl)(),
|
|
37
|
+
accessToken: (0, import_v4.httpUrl)(),
|
|
37
38
|
scope: (0, import_v4.string)().optional(),
|
|
38
|
-
userInfo: (0, import_v4.
|
|
39
|
+
userInfo: (0, import_v4.httpUrl)(),
|
|
39
40
|
responseType: (0, import_v4.enum)(["code", "token", "id_token"]),
|
|
40
41
|
clientId: (0, import_v4.string)(),
|
|
41
42
|
clientSecret: (0, import_v4.string)()
|
|
@@ -47,8 +48,8 @@ var OAuthAuthorization = OAuthProviderConfigSchema.extend({
|
|
|
47
48
|
codeChallengeMethod: (0, import_v4.enum)(["plain", "S256"])
|
|
48
49
|
});
|
|
49
50
|
var OAuthAuthorizationResponse = (0, import_v4.object)({
|
|
50
|
-
state: (0, import_v4.string)(),
|
|
51
|
-
code: (0, import_v4.string)()
|
|
51
|
+
state: (0, import_v4.string)("Missing state parameter in the OAuth authorization response."),
|
|
52
|
+
code: (0, import_v4.string)("Missing code parameter in the OAuth authorization response.")
|
|
52
53
|
});
|
|
53
54
|
var OAuthAuthorizationErrorResponse = (0, import_v4.object)({
|
|
54
55
|
error: (0, import_v4.enum)([
|
|
@@ -92,6 +93,10 @@ var OAuthErrorResponse = (0, import_v4.object)({
|
|
|
92
93
|
error: (0, import_v4.string)(),
|
|
93
94
|
error_description: (0, import_v4.string)().optional()
|
|
94
95
|
});
|
|
96
|
+
var OAuthEnvSchema = (0, import_v4.object)({
|
|
97
|
+
clientId: import_v4.z.string().min(1, "OAuth Client ID is required in the environment variables."),
|
|
98
|
+
clientSecret: import_v4.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
|
|
99
|
+
});
|
|
95
100
|
// Annotate the CommonJS export names for ESM import in node:
|
|
96
101
|
0 && (module.exports = {
|
|
97
102
|
OAuthAccessToken,
|
|
@@ -100,6 +105,7 @@ var OAuthErrorResponse = (0, import_v4.object)({
|
|
|
100
105
|
OAuthAuthorization,
|
|
101
106
|
OAuthAuthorizationErrorResponse,
|
|
102
107
|
OAuthAuthorizationResponse,
|
|
108
|
+
OAuthEnvSchema,
|
|
103
109
|
OAuthErrorResponse,
|
|
104
110
|
OAuthProviderConfigSchema
|
|
105
111
|
});
|