@aura-stack/auth 0.1.0-rc.1 → 0.1.0-rc.10

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.
Files changed (50) hide show
  1. package/dist/@types/index.d.ts +2 -4
  2. package/dist/@types/router.d.d.ts +3 -8
  3. package/dist/@types/utility.d.ts +6 -2
  4. package/dist/actions/callback/access-token.d.ts +1 -3
  5. package/dist/actions/callback/callback.d.ts +1 -2
  6. package/dist/actions/callback/userinfo.d.ts +1 -3
  7. package/dist/actions/index.d.ts +1 -2
  8. package/dist/actions/index.js +3 -3
  9. package/dist/actions/signIn/authorization.d.ts +1 -3
  10. package/dist/actions/signIn/signIn.d.ts +1 -2
  11. package/dist/{chunk-X7M4CQTN.js → chunk-UTDLUEEG.js} +6 -0
  12. package/dist/cookie.d.ts +1 -3
  13. package/dist/error.d.ts +1 -3
  14. package/dist/{index-CGRZ0wrw.d.ts → index-DpfbvTZ_.d.ts} +25 -7
  15. package/dist/index.cjs +3 -0
  16. package/dist/index.d.ts +5 -14
  17. package/dist/index.js +4 -4
  18. package/dist/jose.cjs +12 -0
  19. package/dist/jose.js +1 -1
  20. package/dist/oauth/bitbucket.d.ts +1 -3
  21. package/dist/oauth/discord.d.ts +1 -3
  22. package/dist/oauth/figma.d.ts +1 -3
  23. package/dist/oauth/github.d.ts +1 -3
  24. package/dist/oauth/gitlab.d.ts +1 -3
  25. package/dist/oauth/index.d.ts +1 -3
  26. package/dist/oauth/spotify.d.ts +1 -3
  27. package/dist/oauth/x.d.ts +1 -3
  28. package/dist/schemas.d.ts +4 -4
  29. package/dist/secure.d.ts +1 -3
  30. package/package.json +2 -2
  31. package/dist/@types/index.d.cts +0 -9
  32. package/dist/@types/router.d.d.cts +0 -16
  33. package/dist/@types/utility.d.cts +0 -6
  34. package/dist/actions/callback/access-token.d.cts +0 -30
  35. package/dist/actions/callback/callback.d.cts +0 -13
  36. package/dist/actions/callback/userinfo.d.cts +0 -22
  37. package/dist/actions/csrfToken/csrfToken.d.cts +0 -5
  38. package/dist/actions/index.d.cts +0 -14
  39. package/dist/actions/session/session.d.cts +0 -5
  40. package/dist/actions/signIn/authorization.d.cts +0 -45
  41. package/dist/actions/signIn/signIn.d.cts +0 -13
  42. package/dist/actions/signOut/signOut.d.cts +0 -8
  43. package/dist/oauth/bitbucket.d.cts +0 -9
  44. package/dist/oauth/discord.d.cts +0 -9
  45. package/dist/oauth/figma.d.cts +0 -9
  46. package/dist/oauth/github.d.cts +0 -9
  47. package/dist/oauth/gitlab.d.cts +0 -9
  48. package/dist/oauth/index.d.cts +0 -9
  49. package/dist/oauth/spotify.d.cts +0 -9
  50. package/dist/oauth/x.d.cts +0 -9
@@ -1,9 +1,7 @@
1
1
  import 'zod/v4';
2
- import '../jose.js';
2
+ import '@aura-stack/jose/jose';
3
3
  import '../schemas.js';
4
- import '@aura-stack/router';
5
4
  import 'cookie';
6
5
  export { LiteralUnion, Prettify } from './utility.js';
7
- export { w as AccessTokenError, c as AuthConfig, A as AuthRuntimeConfig, v as AuthorizationError, C as CookieConfig, a as CookieConfigInternal, b as CookieName, t as CookieStrategyOptions, E as ErrorType, H as HostCookie, m as JWTStandardClaims, J as JoseInstance, u as OAuthError, p as OAuthProvider, o as OAuthProviderConfig, O as OAuthProviderCredentials, q as SecureCookie, n as Session, r as StandardCookie, T as TokenRevocationError, U as User } from '../index-CGRZ0wrw.js';
8
- import '@aura-stack/jose/jose';
6
+ export { y as AccessTokenError, c as AuthConfig, d as AuthInstance, A as AuthRuntimeConfig, w as AuthorizationError, C as CookieConfig, a as CookieConfigInternal, b as CookieName, u as CookieStrategyOptions, E as ErrorType, H as HostCookie, q as JWTStandardClaims, J as JoseInstance, v as OAuthError, O as OAuthProvider, e as OAuthProviderConfig, f as OAuthProviderCredentials, R as RouterGlobalContext, r as SecureCookie, S as Session, t as StandardCookie, T as TokenRevocationError, U as User } from '../index-DpfbvTZ_.js';
9
7
  import 'zod/v4/core';
@@ -1,16 +1,11 @@
1
- import { c as AuthConfig, d as createBuiltInOAuthProviders, J as JoseInstance } from '../index-CGRZ0wrw.js';
1
+ import { R as RouterGlobalContext } from '../index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import '../jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import '../schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import './utility.js';
10
8
 
11
- declare module "@aura-stack/router" {
12
- interface GlobalContext extends Required<Omit<AuthConfig, "secret" | "oauth">> {
13
- oauth: ReturnType<typeof createBuiltInOAuthProviders>
14
- jose: JoseInstance
15
- }
9
+ declare module "@aura-stack/router" {
10
+ interface GlobalContext extends RouterGlobalContext {}
16
11
  }
@@ -1,6 +1,10 @@
1
1
  type Prettify<T> = {
2
2
  [K in keyof T]: T[K];
3
- } & {};
4
- type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
3
+ } & {
4
+ __aura_auth_prettify_brand?: never;
5
+ };
6
+ type LiteralUnion<T extends U, U = string> = (T | (U & Record<never, never>)) & {
7
+ __aura_auth_literal_union_brand?: never;
8
+ };
5
9
 
6
10
  export type { LiteralUnion, Prettify };
@@ -1,10 +1,8 @@
1
- import { O as OAuthProviderCredentials } from '../../index-CGRZ0wrw.js';
1
+ import { f as OAuthProviderCredentials } from '../../index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import '../../jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import '../../schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import '../../@types/utility.js';
10
8
 
@@ -1,7 +1,6 @@
1
1
  import * as _aura_stack_router from '@aura-stack/router';
2
- import { A as AuthRuntimeConfig } from '../../index-CGRZ0wrw.js';
2
+ import { A as AuthRuntimeConfig } from '../../index-DpfbvTZ_.js';
3
3
  import 'zod/v4';
4
- import '../../jose.js';
5
4
  import '@aura-stack/jose/jose';
6
5
  import '../../schemas.js';
7
6
  import 'zod/v4/core';
@@ -1,10 +1,8 @@
1
- import { O as OAuthProviderCredentials, U as User } from '../../index-CGRZ0wrw.js';
1
+ import { f as OAuthProviderCredentials, U as User } from '../../index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import '../../jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import '../../schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import '../../@types/utility.js';
10
8
 
@@ -4,9 +4,8 @@ export { sessionAction } from './session/session.js';
4
4
  export { signOutAction } from './signOut/signOut.js';
5
5
  export { csrfTokenAction } from './csrfToken/csrfToken.js';
6
6
  import '@aura-stack/router';
7
- import '../index-CGRZ0wrw.js';
7
+ import '../index-DpfbvTZ_.js';
8
8
  import 'zod/v4';
9
- import '../jose.js';
10
9
  import '@aura-stack/jose/jose';
11
10
  import '../schemas.js';
12
11
  import 'zod/v4/core';
@@ -1,10 +1,10 @@
1
1
  import "../chunk-ITQ7352M.js";
2
- import {
3
- csrfTokenAction
4
- } from "../chunk-SMQO5WD7.js";
5
2
  import {
6
3
  sessionAction
7
4
  } from "../chunk-XXJKNKGQ.js";
5
+ import {
6
+ csrfTokenAction
7
+ } from "../chunk-SMQO5WD7.js";
8
8
  import {
9
9
  signInAction
10
10
  } from "../chunk-LLR722CL.js";
@@ -1,10 +1,8 @@
1
- import { O as OAuthProviderCredentials } from '../../index-CGRZ0wrw.js';
1
+ import { f as OAuthProviderCredentials } from '../../index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import '../../jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import '../../schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import '../../@types/utility.js';
10
8
 
@@ -1,7 +1,6 @@
1
1
  import * as _aura_stack_router from '@aura-stack/router';
2
- import { A as AuthRuntimeConfig } from '../../index-CGRZ0wrw.js';
2
+ import { A as AuthRuntimeConfig } from '../../index-DpfbvTZ_.js';
3
3
  import 'zod/v4';
4
- import '../../jose.js';
5
4
  import '@aura-stack/jose/jose';
6
5
  import '../../schemas.js';
7
6
  import 'zod/v4/core';
@@ -1,12 +1,18 @@
1
1
  import {
2
2
  createDerivedSalt
3
3
  } from "./chunk-GZU3RBTB.js";
4
+ import {
5
+ AuthError
6
+ } from "./chunk-FJUDBLCP.js";
4
7
 
5
8
  // src/jose.ts
6
9
  import "dotenv/config";
7
10
  import { createJWT, createJWS, createDeriveKey } from "@aura-stack/jose";
8
11
  var createJoseInstance = (secret) => {
9
12
  secret ?? (secret = process.env.AURA_AUTH_SECRET);
13
+ if (!secret) {
14
+ throw new AuthError("JOSE_INIT_ERROR", "AURA_AUTH_SECRET environment variable is not set and no secret was provided.");
15
+ }
10
16
  const salt = process.env.AURA_AUTH_SALT ?? createDerivedSalt(secret);
11
17
  const { derivedKey: derivedSessionKey } = createDeriveKey(secret, salt, "session");
12
18
  const { derivedKey: derivedCsrfTokenKey } = createDeriveKey(secret, salt, "csrfToken");
package/dist/cookie.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  import { SerializeOptions } from 'cookie';
2
2
  export { parse } from 'cookie';
3
3
  import { JWTPayload } from '@aura-stack/jose/jose';
4
- import { C as CookieConfig, a as CookieConfigInternal, b as CookieName, A as AuthRuntimeConfig } from './index-CGRZ0wrw.js';
4
+ import { C as CookieConfig, a as CookieConfigInternal, b as CookieName, A as AuthRuntimeConfig } from './index-DpfbvTZ_.js';
5
5
  import { LiteralUnion } from './@types/utility.js';
6
6
  import 'zod/v4';
7
- import './jose.js';
8
7
  import './schemas.js';
9
8
  import 'zod/v4/core';
10
- import '@aura-stack/router';
11
9
 
12
10
  /**
13
11
  * Prefix for all cookies set by Aura Auth.
package/dist/error.d.ts CHANGED
@@ -1,11 +1,9 @@
1
- import { E as ErrorType } from './index-CGRZ0wrw.js';
1
+ import { E as ErrorType } from './index-DpfbvTZ_.js';
2
2
  import { LiteralUnion } from './@types/utility.js';
3
3
  import 'zod/v4';
4
- import './jose.js';
5
4
  import '@aura-stack/jose/jose';
6
5
  import './schemas.js';
7
6
  import 'zod/v4/core';
8
- import '@aura-stack/router';
9
7
  import 'cookie';
10
8
 
11
9
  /**
@@ -1,10 +1,8 @@
1
1
  import { z } from 'zod/v4';
2
- import { createJoseInstance } from './jose.js';
2
+ import { JWTPayload } from '@aura-stack/jose/jose';
3
3
  import { OAuthAuthorizationErrorResponse, OAuthAccessTokenErrorResponse } from './schemas.js';
4
- import { Prettify, RoutePattern } from '@aura-stack/router';
5
4
  import { SerializeOptions } from 'cookie';
6
- import { LiteralUnion } from './@types/utility.js';
7
- import { JWTPayload } from '@aura-stack/jose/jose';
5
+ import { LiteralUnion, Prettify } from './@types/utility.js';
8
6
 
9
7
  /**
10
8
  * @see [X - Get my User](https://docs.x.com/x-api/users/get-my-user)
@@ -474,7 +472,7 @@ interface AuthConfig {
474
472
  /**
475
473
  * Base path for all authentication routes. Default is `/auth`.
476
474
  */
477
- basePath?: RoutePattern;
475
+ basePath?: `/${string}`;
478
476
  /**
479
477
  * Enable trusted proxy headers for scenarios where the application is behind a reverse proxy or load balancer.
480
478
  * This setting allows Aura Auth to correctly interpret headers like `X-Forwarded-For` and `X-Forwarded-Proto`
@@ -491,11 +489,17 @@ interface AuthConfig {
491
489
  */
492
490
  trustedProxyHeaders?: boolean;
493
491
  }
494
- type JoseInstance = ReturnType<typeof createJoseInstance>;
492
+ interface JoseInstance {
493
+ decodeJWT: (token: string) => Promise<JWTPayload>;
494
+ encodeJWT: (payload: JWTPayload) => Promise<string>;
495
+ signJWS: (payload: JWTPayload) => Promise<string>;
496
+ verifyJWS: (payload: string) => Promise<JWTPayload>;
497
+ }
495
498
  /**
496
499
  * Internal runtime configuration used within Aura Auth after initialization.
497
500
  * All optional fields from AuthConfig are resolved to their default values.
498
501
  * @internal
502
+ * @todo: is this needed?
499
503
  */
500
504
  interface AuthRuntimeConfig {
501
505
  oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
@@ -503,6 +507,20 @@ interface AuthRuntimeConfig {
503
507
  secret: string;
504
508
  jose: JoseInstance;
505
509
  }
510
+ interface RouterGlobalContext {
511
+ oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
512
+ cookies: CookieConfigInternal;
513
+ jose: JoseInstance;
514
+ basePath: string;
515
+ trustedProxyHeaders: boolean;
516
+ }
517
+ interface AuthInstance {
518
+ handlers: {
519
+ GET: (request: Request) => Response | Promise<Response>;
520
+ POST: (request: Request) => Response | Promise<Response>;
521
+ };
522
+ jose: JoseInstance;
523
+ }
506
524
  /**
507
525
  * Base OAuth error response structure.
508
526
  */
@@ -527,4 +545,4 @@ type AccessTokenError = OAuthError<z.infer<typeof OAuthAccessTokenErrorResponse>
527
545
  type TokenRevocationError = OAuthError<"invalid_session_token" | "invalid_csrf_token" | "invalid_redirect_to">;
528
546
  type ErrorType = AuthorizationError["error"] | AccessTokenError["error"] | TokenRevocationError["error"];
529
547
 
530
- export { type AuthRuntimeConfig as A, type BitbucketProfile as B, type CookieConfig as C, type DiscordProfile as D, type ErrorType as E, type FigmaProfile as F, type GitLabProfile as G, type HostCookie as H, type JoseInstance as J, type Nameplate as N, type OAuthProviderCredentials as O, type SpotifyProfile as S, type TokenRevocationError as T, type User as U, type XProfile as X, type CookieConfigInternal as a, type CookieName as b, type AuthConfig as c, createBuiltInOAuthProviders as d, discord as e, figma as f, gitlab as g, bitbucket as h, type GitHubProfile as i, github as j, builtInOAuthProviders as k, type BuiltInOAuthProvider as l, type JWTStandardClaims as m, type Session as n, type OAuthProviderConfig as o, type OAuthProvider as p, type SecureCookie as q, type StandardCookie as r, spotify as s, type CookieStrategyOptions as t, type OAuthError as u, type AuthorizationError as v, type AccessTokenError as w, x };
548
+ export { type AuthRuntimeConfig as A, type BitbucketProfile as B, type CookieConfig as C, type DiscordProfile as D, type ErrorType as E, type FigmaProfile as F, type GitLabProfile as G, type HostCookie as H, type JoseInstance as J, type Nameplate as N, type OAuthProvider as O, type RouterGlobalContext as R, type Session as S, type TokenRevocationError as T, type User as U, type XProfile as X, type CookieConfigInternal as a, type CookieName as b, type AuthConfig as c, type AuthInstance as d, type OAuthProviderConfig as e, type OAuthProviderCredentials as f, type SpotifyProfile as g, gitlab as h, discord as i, figma as j, bitbucket as k, type GitHubProfile as l, github as m, builtInOAuthProviders as n, createBuiltInOAuthProviders as o, type BuiltInOAuthProvider as p, type JWTStandardClaims as q, type SecureCookie as r, spotify as s, type StandardCookie as t, type CookieStrategyOptions as u, type OAuthError as v, type AuthorizationError as w, x, type AccessTokenError as y };
package/dist/index.cjs CHANGED
@@ -227,6 +227,9 @@ var createDerivedSalt = (secret) => {
227
227
  // src/jose.ts
228
228
  var createJoseInstance = (secret) => {
229
229
  secret ?? (secret = process.env.AURA_AUTH_SECRET);
230
+ if (!secret) {
231
+ throw new AuthError("JOSE_INIT_ERROR", "AURA_AUTH_SECRET environment variable is not set and no secret was provided.");
232
+ }
230
233
  const salt = process.env.AURA_AUTH_SALT ?? createDerivedSalt(secret);
231
234
  const { derivedKey: derivedSessionKey } = (0, import_jose.createDeriveKey)(secret, salt, "session");
232
235
  const { derivedKey: derivedCsrfTokenKey } = (0, import_jose.createDeriveKey)(secret, salt, "csrfToken");
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { JWTPayload } from '@aura-stack/jose/jose';
2
- import * as _aura_stack_router from '@aura-stack/router';
3
- import { c as AuthConfig } from './index-CGRZ0wrw.js';
1
+ import { c as AuthConfig, d as AuthInstance } from './index-DpfbvTZ_.js';
2
+ export { C as CookieConfig, E as ErrorType, J as JoseInstance, O as OAuthProvider, e as OAuthProviderConfig, f as OAuthProviderCredentials, S as Session, U as User } from './index-DpfbvTZ_.js';
4
3
  import 'zod/v4';
5
- import './jose.js';
4
+ import '@aura-stack/jose/jose';
6
5
  import './schemas.js';
7
6
  import 'zod/v4/core';
8
7
  import 'cookie';
@@ -30,14 +29,6 @@ import './@types/utility.js';
30
29
  * }]
31
30
  * })
32
31
  */
33
- declare const createAuth: (authConfig: AuthConfig) => {
34
- handlers: _aura_stack_router.GetHttpHandlers<[_aura_stack_router.RouteEndpoint<"GET", "/signIn/:oauth", {}>, _aura_stack_router.RouteEndpoint<"GET", "/callback/:oauth", {}>, _aura_stack_router.RouteEndpoint<"GET", "/session", {}>, _aura_stack_router.RouteEndpoint<"POST", "/signOut", {}>, _aura_stack_router.RouteEndpoint<"GET", "/csrfToken", {}>]>;
35
- jose: {
36
- decodeJWT: (token: string) => Promise<JWTPayload>;
37
- encodeJWT: (payload: JWTPayload) => Promise<string>;
38
- signJWS: (payload: JWTPayload) => Promise<string>;
39
- verifyJWS: (payload: string) => Promise<JWTPayload>;
40
- };
41
- };
32
+ declare const createAuth: (authConfig: AuthConfig) => AuthInstance;
42
33
 
43
- export { createAuth };
34
+ export { AuthConfig, AuthInstance, createAuth };
package/dist/index.js CHANGED
@@ -7,12 +7,12 @@ import "./chunk-KRNOMBXQ.js";
7
7
  import "./chunk-E3OXBRYF.js";
8
8
  import "./chunk-42XB3YCW.js";
9
9
  import "./chunk-ITQ7352M.js";
10
- import {
11
- csrfTokenAction
12
- } from "./chunk-SMQO5WD7.js";
13
10
  import {
14
11
  sessionAction
15
12
  } from "./chunk-XXJKNKGQ.js";
13
+ import {
14
+ csrfTokenAction
15
+ } from "./chunk-SMQO5WD7.js";
16
16
  import {
17
17
  signInAction
18
18
  } from "./chunk-LLR722CL.js";
@@ -34,7 +34,7 @@ import "./chunk-6SM22VVJ.js";
34
34
  import "./chunk-STHEPPUZ.js";
35
35
  import {
36
36
  createJoseInstance
37
- } from "./chunk-X7M4CQTN.js";
37
+ } from "./chunk-UTDLUEEG.js";
38
38
  import "./chunk-GZU3RBTB.js";
39
39
  import {
40
40
  onErrorHandler
package/dist/jose.cjs CHANGED
@@ -42,6 +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/error.ts
46
+ var AuthError = class extends Error {
47
+ constructor(type, message) {
48
+ super(message);
49
+ this.type = type;
50
+ this.name = "AuthError";
51
+ }
52
+ };
53
+
45
54
  // src/secure.ts
46
55
  var createDerivedSalt = (secret) => {
47
56
  return import_node_crypto.default.createHash("sha256").update(secret).update("aura-auth-salt").digest("hex");
@@ -50,6 +59,9 @@ var createDerivedSalt = (secret) => {
50
59
  // src/jose.ts
51
60
  var createJoseInstance = (secret) => {
52
61
  secret ?? (secret = process.env.AURA_AUTH_SECRET);
62
+ if (!secret) {
63
+ throw new AuthError("JOSE_INIT_ERROR", "AURA_AUTH_SECRET environment variable is not set and no secret was provided.");
64
+ }
53
65
  const salt = process.env.AURA_AUTH_SALT ?? createDerivedSalt(secret);
54
66
  const { derivedKey: derivedSessionKey } = (0, import_jose.createDeriveKey)(secret, salt, "session");
55
67
  const { derivedKey: derivedCsrfTokenKey } = (0, import_jose.createDeriveKey)(secret, salt, "csrfToken");
package/dist/jose.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createJoseInstance
3
- } from "./chunk-X7M4CQTN.js";
3
+ } from "./chunk-UTDLUEEG.js";
4
4
  import "./chunk-GZU3RBTB.js";
5
5
  import "./chunk-256KIVJL.js";
6
6
  import "./chunk-FJUDBLCP.js";
@@ -1,9 +1,7 @@
1
- export { B as BitbucketProfile, h as bitbucket } from '../index-CGRZ0wrw.js';
1
+ export { B as BitbucketProfile, k as bitbucket } from '../index-DpfbvTZ_.js';
2
2
  import '../@types/utility.js';
3
3
  import 'zod/v4';
4
- import '../jose.js';
5
4
  import '@aura-stack/jose/jose';
6
5
  import '../schemas.js';
7
6
  import 'zod/v4/core';
8
- import '@aura-stack/router';
9
7
  import 'cookie';
@@ -1,9 +1,7 @@
1
- export { D as DiscordProfile, N as Nameplate, e as discord } from '../index-CGRZ0wrw.js';
1
+ export { D as DiscordProfile, N as Nameplate, i as discord } from '../index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import '../jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import '../schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import '../@types/utility.js';
@@ -1,9 +1,7 @@
1
- export { F as FigmaProfile, f as figma } from '../index-CGRZ0wrw.js';
1
+ export { F as FigmaProfile, j as figma } from '../index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import '../jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import '../schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import '../@types/utility.js';
@@ -1,9 +1,7 @@
1
- export { i as GitHubProfile, j as github } from '../index-CGRZ0wrw.js';
1
+ export { l as GitHubProfile, m as github } from '../index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import '../jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import '../schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import '../@types/utility.js';
@@ -1,9 +1,7 @@
1
- export { G as GitLabProfile, g as gitlab } from '../index-CGRZ0wrw.js';
1
+ export { G as GitLabProfile, h as gitlab } from '../index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import '../jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import '../schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import '../@types/utility.js';
@@ -1,9 +1,7 @@
1
- export { B as BitbucketProfile, l as BuiltInOAuthProvider, D as DiscordProfile, F as FigmaProfile, i as GitHubProfile, G as GitLabProfile, N as Nameplate, S as SpotifyProfile, X as XProfile, h as bitbucket, k as builtInOAuthProviders, d as createBuiltInOAuthProviders, e as discord, f as figma, j as github, g as gitlab, s as spotify, x } from '../index-CGRZ0wrw.js';
1
+ export { B as BitbucketProfile, p as BuiltInOAuthProvider, D as DiscordProfile, F as FigmaProfile, l as GitHubProfile, G as GitLabProfile, N as Nameplate, g as SpotifyProfile, X as XProfile, k as bitbucket, n as builtInOAuthProviders, o as createBuiltInOAuthProviders, i as discord, j as figma, m as github, h as gitlab, s as spotify, x } from '../index-DpfbvTZ_.js';
2
2
  import '../@types/utility.js';
3
3
  import 'zod/v4';
4
- import '../jose.js';
5
4
  import '@aura-stack/jose/jose';
6
5
  import '../schemas.js';
7
6
  import 'zod/v4/core';
8
- import '@aura-stack/router';
9
7
  import 'cookie';
@@ -1,9 +1,7 @@
1
- export { S as SpotifyProfile, s as spotify } from '../index-CGRZ0wrw.js';
1
+ export { g as SpotifyProfile, s as spotify } from '../index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import '../jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import '../schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import '../@types/utility.js';
package/dist/oauth/x.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- export { X as XProfile, x } from '../index-CGRZ0wrw.js';
1
+ export { X as XProfile, x } from '../index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import '../jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import '../schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import '../@types/utility.js';
package/dist/schemas.d.ts CHANGED
@@ -10,8 +10,8 @@ declare const OAuthProviderConfigSchema: zod_v4.ZodObject<{
10
10
  scope: zod_v4.ZodOptional<zod_v4.ZodString>;
11
11
  userInfo: zod_v4.ZodURL;
12
12
  responseType: zod_v4.ZodEnum<{
13
- code: "code";
14
13
  token: "token";
14
+ code: "code";
15
15
  id_token: "id_token";
16
16
  }>;
17
17
  clientId: zod_v4.ZodString;
@@ -28,8 +28,8 @@ declare const OAuthAuthorization: zod_v4.ZodObject<{
28
28
  scope: zod_v4.ZodOptional<zod_v4.ZodString>;
29
29
  userInfo: zod_v4.ZodURL;
30
30
  responseType: zod_v4.ZodEnum<{
31
- code: "code";
32
31
  token: "token";
32
+ code: "code";
33
33
  id_token: "id_token";
34
34
  }>;
35
35
  clientId: zod_v4.ZodString;
@@ -38,8 +38,8 @@ declare const OAuthAuthorization: zod_v4.ZodObject<{
38
38
  state: zod_v4.ZodString;
39
39
  codeChallenge: zod_v4.ZodString;
40
40
  codeChallengeMethod: zod_v4.ZodEnum<{
41
- plain: "plain";
42
41
  S256: "S256";
42
+ plain: "plain";
43
43
  }>;
44
44
  }, zod_v4_core.$strip>;
45
45
  /**
@@ -80,8 +80,8 @@ declare const OAuthAccessToken: zod_v4.ZodObject<{
80
80
  scope: zod_v4.ZodOptional<zod_v4.ZodString>;
81
81
  userInfo: zod_v4.ZodURL;
82
82
  responseType: zod_v4.ZodEnum<{
83
- code: "code";
84
83
  token: "token";
84
+ code: "code";
85
85
  id_token: "id_token";
86
86
  }>;
87
87
  clientId: zod_v4.ZodString;
package/dist/secure.d.ts CHANGED
@@ -1,10 +1,8 @@
1
- import { A as AuthRuntimeConfig } from './index-CGRZ0wrw.js';
1
+ import { A as AuthRuntimeConfig } from './index-DpfbvTZ_.js';
2
2
  import 'zod/v4';
3
- import './jose.js';
4
3
  import '@aura-stack/jose/jose';
5
4
  import './schemas.js';
6
5
  import 'zod/v4/core';
7
- import '@aura-stack/router';
8
6
  import 'cookie';
9
7
  import './@types/utility.js';
10
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aura-stack/auth",
3
- "version": "0.1.0-rc.1",
3
+ "version": "0.1.0-rc.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Core auth for @aura-stack/auth",
@@ -64,7 +64,7 @@
64
64
  "format:check": "prettier --check . --cache --cache-location .cache/.prettiercache",
65
65
  "type-check": "tsc --noEmit",
66
66
  "clean": "rm -rf dist",
67
- "clean:cts": "rm -rf dist/*.cts",
67
+ "clean:cts": "find dist -type f -name \"*.cts\" -delete",
68
68
  "prepublish": "pnpm clean:cts"
69
69
  }
70
70
  }
@@ -1,9 +0,0 @@
1
- import 'zod/v4';
2
- import '../jose.cjs';
3
- import '../schemas.cjs';
4
- import '@aura-stack/router';
5
- import 'cookie';
6
- export { LiteralUnion, Prettify } from './utility.cjs';
7
- export { w as AccessTokenError, c as AuthConfig, A as AuthRuntimeConfig, v as AuthorizationError, C as CookieConfig, a as CookieConfigInternal, b as CookieName, t as CookieStrategyOptions, E as ErrorType, H as HostCookie, m as JWTStandardClaims, J as JoseInstance, u as OAuthError, p as OAuthProvider, o as OAuthProviderConfig, O as OAuthProviderCredentials, q as SecureCookie, n as Session, r as StandardCookie, T as TokenRevocationError, U as User } from '../index-B1vDUGwh.cjs';
8
- import '@aura-stack/jose/jose';
9
- import 'zod/v4/core';
@@ -1,16 +0,0 @@
1
- import { c as AuthConfig, d as createBuiltInOAuthProviders, J as JoseInstance } from '../index-B1vDUGwh.cjs';
2
- import 'zod/v4';
3
- import '../jose.cjs';
4
- import '@aura-stack/jose/jose';
5
- import '../schemas.cjs';
6
- import 'zod/v4/core';
7
- import '@aura-stack/router';
8
- import 'cookie';
9
- import './utility.cjs';
10
-
11
- declare module "@aura-stack/router" {
12
- interface GlobalContext extends Required<Omit<AuthConfig, "secret" | "oauth">> {
13
- oauth: ReturnType<typeof createBuiltInOAuthProviders>
14
- jose: JoseInstance
15
- }
16
- }
@@ -1,6 +0,0 @@
1
- type Prettify<T> = {
2
- [K in keyof T]: T[K];
3
- } & {};
4
- type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
5
-
6
- export type { LiteralUnion, Prettify };
@@ -1,30 +0,0 @@
1
- import { O as OAuthProviderCredentials } from '../../index-B1vDUGwh.cjs';
2
- import 'zod/v4';
3
- import '../../jose.cjs';
4
- import '@aura-stack/jose/jose';
5
- import '../../schemas.cjs';
6
- import 'zod/v4/core';
7
- import '@aura-stack/router';
8
- import 'cookie';
9
- import '../../@types/utility.cjs';
10
-
11
- /**
12
- * Make a request to the OAuth provider to the token endpoint to exchange the authorization code provided
13
- * by the authorization server.
14
- *
15
- * @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3
16
- * @see https://datatracker.ietf.org/doc/html/rfc6749#section-5
17
- * @param oauthConfig - OAuth provider configuration
18
- * @param redirectURI - The redirect URI registered in the Resource Owner's authorization request and sent in the authorization code exchange
19
- * @param code - The authorization code received from the OAuth server
20
- * @returns The access token response from the OAuth server
21
- */
22
- declare const createAccessToken: (oauthConfig: OAuthProviderCredentials, redirectURI: string, code: string, codeVerifier: string) => Promise<{
23
- access_token: string;
24
- token_type: string;
25
- expires_in?: number | undefined;
26
- refresh_token?: string | undefined;
27
- scope?: string | undefined;
28
- }>;
29
-
30
- export { createAccessToken };
@@ -1,13 +0,0 @@
1
- import * as _aura_stack_router from '@aura-stack/router';
2
- import { A as AuthRuntimeConfig } from '../../index-B1vDUGwh.cjs';
3
- import 'zod/v4';
4
- import '../../jose.cjs';
5
- import '@aura-stack/jose/jose';
6
- import '../../schemas.cjs';
7
- import 'zod/v4/core';
8
- import 'cookie';
9
- import '../../@types/utility.cjs';
10
-
11
- declare const callbackAction: (oauth: AuthRuntimeConfig["oauth"]) => _aura_stack_router.RouteEndpoint<"GET", "/callback/:oauth", {}>;
12
-
13
- export { callbackAction };
@@ -1,22 +0,0 @@
1
- import { O as OAuthProviderCredentials, U as User } from '../../index-B1vDUGwh.cjs';
2
- import 'zod/v4';
3
- import '../../jose.cjs';
4
- import '@aura-stack/jose/jose';
5
- import '../../schemas.cjs';
6
- import 'zod/v4/core';
7
- import '@aura-stack/router';
8
- import 'cookie';
9
- import '../../@types/utility.cjs';
10
-
11
- /**
12
- * Get user information from the OAuth provider's userinfo endpoint using the provided access token.
13
- * The response by default is mapped to the standardized `User` format unless a custom
14
- * `profile` function is provided in the `oauthConfig`.
15
- *
16
- * @param oauthConfig - OAuth provider configuration
17
- * @param accessToken - Access Token to access the userinfo endpoint
18
- * @returns The user information retrieved from the userinfo endpoint
19
- */
20
- declare const getUserInfo: (oauthConfig: OAuthProviderCredentials, accessToken: string) => Promise<User>;
21
-
22
- export { getUserInfo };
@@ -1,5 +0,0 @@
1
- import * as _aura_stack_router from '@aura-stack/router';
2
-
3
- declare const csrfTokenAction: _aura_stack_router.RouteEndpoint<"GET", "/csrfToken", {}>;
4
-
5
- export { csrfTokenAction };
@@ -1,14 +0,0 @@
1
- export { signInAction } from './signIn/signIn.cjs';
2
- export { callbackAction } from './callback/callback.cjs';
3
- export { sessionAction } from './session/session.cjs';
4
- export { signOutAction } from './signOut/signOut.cjs';
5
- export { csrfTokenAction } from './csrfToken/csrfToken.cjs';
6
- import '@aura-stack/router';
7
- import '../index-B1vDUGwh.cjs';
8
- import 'zod/v4';
9
- import '../jose.cjs';
10
- import '@aura-stack/jose/jose';
11
- import '../schemas.cjs';
12
- import 'zod/v4/core';
13
- import 'cookie';
14
- import '../@types/utility.cjs';
@@ -1,5 +0,0 @@
1
- import * as _aura_stack_router from '@aura-stack/router';
2
-
3
- declare const sessionAction: _aura_stack_router.RouteEndpoint<"GET", "/session", {}>;
4
-
5
- export { sessionAction };
@@ -1,45 +0,0 @@
1
- import { O as OAuthProviderCredentials } from '../../index-B1vDUGwh.cjs';
2
- import 'zod/v4';
3
- import '../../jose.cjs';
4
- import '@aura-stack/jose/jose';
5
- import '../../schemas.cjs';
6
- import 'zod/v4/core';
7
- import '@aura-stack/router';
8
- import 'cookie';
9
- import '../../@types/utility.cjs';
10
-
11
- /**
12
- * Constructs the request URI for the Authorization Request to the third-party OAuth service. It includes
13
- * the necessary query parameters such as `client_id`, `redirect_uri`, `response_type`, `scope`, `state`,
14
- * `code_challenge`, and `code_challenge_method`.
15
- *
16
- * @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1
17
- * @see https://datatracker.ietf.org/doc/html/rfc7636#section-4
18
- *
19
- * @param oauthConfig - The OAuth configuration for the third-party service.
20
- * @param redirectURI - The redirect URI where the OAuth service will send the user after authorization.
21
- * @param state - A unique string used to maintain state between the request and callback.
22
- */
23
- declare const createAuthorizationURL: (oauthConfig: OAuthProviderCredentials, redirectURI: string, state: string, codeChallenge: string, codeChallengeMethod: string) => string;
24
- declare const getOriginURL: (request: Request, trustedProxyHeaders?: boolean) => URL;
25
- /**
26
- * Creates the redirect URI for the OAuth callback based on the original request URL and the OAuth provider.
27
- *
28
- * @param requestURL - the original request URL
29
- * @param oauth - OAuth provider name
30
- * @returns The redirect URI for the OAuth callback.
31
- */
32
- declare const createRedirectURI: (request: Request, oauth: string, basePath: string, trustedProxyHeaders?: boolean) => string;
33
- /**
34
- * Verifies if the request's origin matches the expected origin. It accepts the redirectTo search
35
- * parameter for redirection. It checks the 'Referer' header of the request with the origin where
36
- * the authentication flow is hosted. If they do not match, it throws an AuthError to avoid
37
- * potential `Open URL Redirection` attacks.
38
- *
39
- * @param request The incoming request object
40
- * @param redirectTo Optional redirectTo parameter to override the referer
41
- * @returns The pathname of the referer URL if origins match
42
- */
43
- declare const createRedirectTo: (request: Request, redirectTo?: string, trustedProxyHeaders?: boolean) => string;
44
-
45
- export { createAuthorizationURL, createRedirectTo, createRedirectURI, getOriginURL };
@@ -1,13 +0,0 @@
1
- import * as _aura_stack_router from '@aura-stack/router';
2
- import { A as AuthRuntimeConfig } from '../../index-B1vDUGwh.cjs';
3
- import 'zod/v4';
4
- import '../../jose.cjs';
5
- import '@aura-stack/jose/jose';
6
- import '../../schemas.cjs';
7
- import 'zod/v4/core';
8
- import 'cookie';
9
- import '../../@types/utility.cjs';
10
-
11
- declare const signInAction: (oauth: AuthRuntimeConfig["oauth"]) => _aura_stack_router.RouteEndpoint<"GET", "/signIn/:oauth", {}>;
12
-
13
- export { signInAction };
@@ -1,8 +0,0 @@
1
- import * as _aura_stack_router from '@aura-stack/router';
2
-
3
- /**
4
- * @see https://datatracker.ietf.org/doc/html/rfc7009
5
- */
6
- declare const signOutAction: _aura_stack_router.RouteEndpoint<"POST", "/signOut", {}>;
7
-
8
- export { signOutAction };
@@ -1,9 +0,0 @@
1
- export { B as BitbucketProfile, h as bitbucket } from '../index-B1vDUGwh.cjs';
2
- import '../@types/utility.cjs';
3
- import 'zod/v4';
4
- import '../jose.cjs';
5
- import '@aura-stack/jose/jose';
6
- import '../schemas.cjs';
7
- import 'zod/v4/core';
8
- import '@aura-stack/router';
9
- import 'cookie';
@@ -1,9 +0,0 @@
1
- export { D as DiscordProfile, N as Nameplate, e as discord } from '../index-B1vDUGwh.cjs';
2
- import 'zod/v4';
3
- import '../jose.cjs';
4
- import '@aura-stack/jose/jose';
5
- import '../schemas.cjs';
6
- import 'zod/v4/core';
7
- import '@aura-stack/router';
8
- import 'cookie';
9
- import '../@types/utility.cjs';
@@ -1,9 +0,0 @@
1
- export { F as FigmaProfile, f as figma } from '../index-B1vDUGwh.cjs';
2
- import 'zod/v4';
3
- import '../jose.cjs';
4
- import '@aura-stack/jose/jose';
5
- import '../schemas.cjs';
6
- import 'zod/v4/core';
7
- import '@aura-stack/router';
8
- import 'cookie';
9
- import '../@types/utility.cjs';
@@ -1,9 +0,0 @@
1
- export { i as GitHubProfile, j as github } from '../index-B1vDUGwh.cjs';
2
- import 'zod/v4';
3
- import '../jose.cjs';
4
- import '@aura-stack/jose/jose';
5
- import '../schemas.cjs';
6
- import 'zod/v4/core';
7
- import '@aura-stack/router';
8
- import 'cookie';
9
- import '../@types/utility.cjs';
@@ -1,9 +0,0 @@
1
- export { G as GitLabProfile, g as gitlab } from '../index-B1vDUGwh.cjs';
2
- import 'zod/v4';
3
- import '../jose.cjs';
4
- import '@aura-stack/jose/jose';
5
- import '../schemas.cjs';
6
- import 'zod/v4/core';
7
- import '@aura-stack/router';
8
- import 'cookie';
9
- import '../@types/utility.cjs';
@@ -1,9 +0,0 @@
1
- export { B as BitbucketProfile, l as BuiltInOAuthProvider, D as DiscordProfile, F as FigmaProfile, i as GitHubProfile, G as GitLabProfile, N as Nameplate, S as SpotifyProfile, X as XProfile, h as bitbucket, k as builtInOAuthProviders, d as createBuiltInOAuthProviders, e as discord, f as figma, j as github, g as gitlab, s as spotify, x } from '../index-B1vDUGwh.cjs';
2
- import '../@types/utility.cjs';
3
- import 'zod/v4';
4
- import '../jose.cjs';
5
- import '@aura-stack/jose/jose';
6
- import '../schemas.cjs';
7
- import 'zod/v4/core';
8
- import '@aura-stack/router';
9
- import 'cookie';
@@ -1,9 +0,0 @@
1
- export { S as SpotifyProfile, s as spotify } from '../index-B1vDUGwh.cjs';
2
- import 'zod/v4';
3
- import '../jose.cjs';
4
- import '@aura-stack/jose/jose';
5
- import '../schemas.cjs';
6
- import 'zod/v4/core';
7
- import '@aura-stack/router';
8
- import 'cookie';
9
- import '../@types/utility.cjs';
@@ -1,9 +0,0 @@
1
- export { X as XProfile, x } from '../index-B1vDUGwh.cjs';
2
- import 'zod/v4';
3
- import '../jose.cjs';
4
- import '@aura-stack/jose/jose';
5
- import '../schemas.cjs';
6
- import 'zod/v4/core';
7
- import '@aura-stack/router';
8
- import 'cookie';
9
- import '../@types/utility.cjs';