Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions apps/bun/src/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { createAuth, type AuthInstance } from "@aura-stack/auth"
import { createAuth } from "@aura-stack/auth"

/**
* @todo: fix the types for the handlers, jose, and api properties of the AuthInstance
*/
export const { handlers, jose, api }: AuthInstance = createAuth({
export const { handlers, jose, api } = createAuth({
oauth: ["github"],
basePath: "/api/auth",
trustedOrigins: ["http://localhost:3000", "https://*.vercel.app"],
Expand Down
4 changes: 2 additions & 2 deletions apps/cloudflare/src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type AuthInstance, createAuth } from "@aura-stack/auth"
import { createAuth } from "@aura-stack/auth"

export const { handlers, jose, api }: AuthInstance = createAuth({
export const { handlers, jose, api } = createAuth({
oauth: ["github"],
basePath: "/api/auth",
trustedOrigins: ["http://127.0.0.1:8787", "http://localhost:8787"],
Expand Down
4 changes: 2 additions & 2 deletions apps/deno/src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type AuthInstance, createAuth } from "@aura-stack/auth"
import { createAuth } from "@aura-stack/auth"

export const { handlers, jose, api }: AuthInstance = createAuth({
export const { handlers, jose, api } = createAuth({
oauth: ["github"],
basePath: "/api/auth",
trustedOrigins: ["http://localhost:3000", "https://*.vercel.app"],
Expand Down
4 changes: 2 additions & 2 deletions apps/oak/src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type AuthInstance, createAuth } from "@aura-stack/auth"
import { createAuth } from "@aura-stack/auth"

export const { handlers, jose, api }: AuthInstance = createAuth({
export const { handlers, jose, api } = createAuth({
oauth: ["github"],
basePath: "/api/auth",
trustedOrigins: ["http://localhost:3000", "https://*.vercel.app"],
Expand Down
4 changes: 2 additions & 2 deletions apps/supabase/functions/_shared/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type AuthInstance, createAuth } from "@aura-stack/auth"
import { createAuth } from "@aura-stack/auth"

export const { handlers, jose, api }: AuthInstance = createAuth({
export const { handlers, jose, api } = createAuth({
oauth: ["github"],
basePath: "/api/auth",
trustedOrigins: ["http://localhost:3000", "http://127.0.0.1:3000"],
Expand Down
5 changes: 4 additions & 1 deletion configs/tsconfig/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"isolatedModules": true
"isolatedModules": true,
"noEmit": true,
"verbatimModuleSyntax": true,
"allowImportingTsExtensions": true
},
"include": ["src"],
"exclude": ["node_modules"]
Expand Down
20 changes: 17 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.7.0",
"private": false,
"type": "module",
"description": "Core auth for @aura-stack/auth",
"description": "Open-source authentication and authorization library for modern TypeScript and JavaScript applications. Framework-agnostic, runtime-agnostic and built on web standards.",
"scripts": {
"dev": "tsdown --watch",
"build": "tsdown",
Expand All @@ -16,7 +16,7 @@
"format:check": "oxfmt --check",
"type-check": "tsc --noEmit",
"clean": "rm -rf dist",
"clean:cts": "find dist -type f -name \"*.cts\" -delete",
"clean:cts": "[ -d dist ] && find dist -type f -name \"*.cts\" -delete || true",
"prepublishOnly": "pnpm build && pnpm clean:cts"
},
"repository": {
Expand Down Expand Up @@ -80,8 +80,22 @@
},
"keywords": [
"auth",
"oauth",
"oauth2",
"security",
"session",
"authentication"
"authentication",
"authorization",
"typescript",
"javascript",
"node",
"bun",
"deno",
"edge",
"aura-stack",
"aura-stack-ts",
"aura auth",
"aura-auth"
],
"author": "Aura Stack <aurastackjs@gmail.com> | Hernan Alvarado <halvaradop.dev@gmail.com>",
"homepage": "https://aura-stack-auth.vercel.app",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/signIn/authorization-url.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { OAuthProvider } from "@/@types/index.ts"
import { AuthInternalError } from "@/shared/errors.ts"
import { OAuthAuthorization } from "@/schemas.ts"
import { createPKCE, createSecretValue } from "@/shared/crypto.ts"
import type { OAuthProvider } from "@/@types/index.ts"
import type { GlobalContext } from "@aura-stack/router"

export const setSearchParams = (url: URL, params: Record<string, string | undefined>) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/signIn/authorization.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { getEnv } from "@/shared/env.ts"
import { Identities } from "@/shared/identity.ts"
import { AuthInternalError } from "@/shared/errors.ts"
import { equals, extractPath, patternToRegex } from "@/shared/utils.ts"
import { isRelativeURL, isSameOrigin, isValidURL, isTrustedOrigin } from "@/shared/assert.ts"
import type { AuthConfig } from "@/@types/index.ts"
import type { Identities } from "@/shared/identity.ts"
import type { GlobalContext } from "@aura-stack/router"

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/router/context.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createJoseInstance } from "@/jose.ts"
import { createCookieStore } from "@/cookie.ts"
import { Identities } from "@/shared/identity.ts"
import { createProxyLogger } from "@/shared/logger.ts"
import { createSessionStrategy } from "@/session/strategy.ts"
import { createSchemaRegistry } from "@/validator/registry.ts"
import { createBuiltInOAuthProviders } from "@/oauth/index.ts"
import { getEnv, getEnvArray, getEnvBoolean } from "@/shared/env.ts"
import type { Identities } from "@/shared/identity.ts"
import type { AuthConfig, InternalContext, FromShapeToObject } from "@/@types/index.ts"

export const createContext = <Identity extends Identities>(config?: AuthConfig<Identity>) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/shared/assert.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Type } from "arktype"
import { ZodObject, ZodTypeAny } from "zod"
import type { ZodObject, ZodTypeAny } from "zod"
import { Type as TypeboxType } from "typebox"
import { BaseSchema, ObjectSchema } from "valibot"
import type { BaseSchema, ObjectSchema } from "valibot"
import { equals, patternToRegex } from "@/shared/utils.ts"
import type {
AsymmetricKeyPair,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/crypto.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AuthSecurityError } from "@/shared/errors.ts"
import { isJWTPayloadWithToken } from "@/shared/assert.ts"
import { equals, timingSafeEqual } from "@/shared/utils.ts"
import { exportJWK, generateKeyPair, GenerateKeyPairOptions, importPKCS8, importSPKI } from "@aura-stack/jose/jose"
import { exportJWK, generateKeyPair, importPKCS8, importSPKI, type GenerateKeyPairOptions } from "@aura-stack/jose/jose"
import { base64url, encoder, getRandomBytes, getSubtleCrypto } from "@/jose.ts"
import type { AsymmetricKeyPairFromEnv, AuthRuntimeConfig, JoseInstance, User } from "@/@types/index.ts"

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/logger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getEnv, getEnvBoolean } from "@/shared/env.ts"
import type { Identities } from "./identity.ts"
import type { AuthConfig, InternalLogger, Logger, LogLevel, SyslogOptions } from "@/@types/index.ts"
import { Identities } from "./identity.ts"

/**
* Log message definitions organized by category.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/validator/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import * as valibot from "valibot"
import { type } from "arktype"
import { formatZodError } from "@/shared/utils.ts"
import { IsObject, Type as Typebox } from "typebox"
import { IdentityConfig } from "@/@types/config.ts"
import { AuthValidationError } from "@/shared/errors.ts"
import { createValidator } from "@/validator/validator.ts"
import { UserIdentity, type SchemaTypes } from "@/shared/identity.ts"
import { isArkType, isValibotSchema, isZodSchema } from "@/shared/assert.ts"
import type { IdentityConfig } from "@/@types/config.ts"

export const deriveSchema = <Schema extends SchemaTypes>(
schema: Schema,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/actions/callback/userinfo.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, test, expect, vi } from "vitest"
import { getUserInfo } from "@/actions/callback/userinfo.ts"
import { OAuthProviderConfig, OAuthProviderCredentials } from "@/@types/index.ts"
import { oauthCustomService } from "@test/presets.ts"
import { AURA_AUTH_VERSION } from "@/shared/utils.ts"
import type { OAuthProviderConfig, OAuthProviderCredentials } from "@/@types/index.ts"

describe("getUserInfo", () => {
test("get user info", async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/identity.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { describe, test, expect, expectTypeOf, vi, afterEach } from "vitest"
import {
createIdentity,
InferUser,
UserIdentity,
UserIdentityArkType,
UserIdentityTypeBox,
UserIdentityValibot,
type InferUser,
} from "@/shared/identity.ts"
import { z } from "zod/v4"
import * as valibot from "valibot"
import { createAuth } from "@/createAuth.ts"
import { createSchemaRegistry, deriveSchema } from "@/validator/registry.ts"
import { ArkErrors, type } from "arktype"
import { Static, Type as Typebox } from "typebox"
import { type Static, Type as Typebox } from "typebox"
import { Value } from "typebox/value"

afterEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/oauth.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, test, expect } from "vitest"
import { createBuiltInOAuthProviders, builtInOAuthProviders, GitHubProfile } from "@/oauth/index.ts"
import { OAuthProviderCredentials, User } from "@/@types/index.ts"
import { createBuiltInOAuthProviders, builtInOAuthProviders, type GitHubProfile } from "@/oauth/index.ts"
import type { OAuthProviderCredentials, User } from "@/@types/index.ts"

describe("createBuiltInOAuthProviders", () => {
test("create oauth config for github", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/types.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { createAuth } from "@/createAuth.ts"
import { z, ZodOptional, ZodString } from "zod/v4"
import { Type as Typebox } from "typebox"
import {
Identities,
UserIdentity,
UserIdentityArkType,
UserIdentityTypeBox,
UserIdentityValibot,
UserShapeValibot,
type Identities,
type UserShapeValibot,
} from "@/shared/identity.ts"
import { github, type GitHubProfile } from "@/oauth/github.ts"
import type {
Expand Down
5 changes: 1 addition & 4 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"paths": {
"@/*": ["./src/*"],
"@test/*": ["./test/*"]
},
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"noEmit": true
}
},
"include": ["src", "test"],
"exclude": ["dist", "node_modules"]
Expand Down
2 changes: 1 addition & 1 deletion packages/device/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"format": "oxfmt",
"format:check": "oxfmt --check",
"type-check": "tsc --noEmit",
"clean:cts": "if [ -d dist ]; then find dist -type f -name \"*.cts\" -delete; fi",
"clean:cts": "[ -d dist ] && find dist -type f -name \"*.cts\" -delete || true",
"prepublishOnly": "pnpm clean:cts && pnpm build && pnpm clean:cts"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/device/src/providers/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DeviceProviderCredentials } from "@/@types/device.ts"
import { LiteralUnion } from "@/@types/index.ts"
import { github } from "@/providers/github.ts"
import { DeviceProviderCredentialsSchema } from "@/schemas.ts"
import { getEnv } from "@/shared/env.ts"
import { pick, safeParse } from "valibot"
import type { LiteralUnion } from "@/@types/index.ts"
import type { DeviceProviderCredentials } from "@/@types/device.ts"

export * from "@/providers/github.ts"

Expand Down
2 changes: 1 addition & 1 deletion packages/device/test/providers.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, test, expect, vi, afterEach } from "vitest"
import { createBuiltInDeviceProviders } from "@/providers/index.ts"
import { DeviceProviderCredentials } from "@/@types/device.ts"
import type { DeviceProviderCredentials } from "@/@types/device.ts"

afterEach(() => {
vi.unstubAllEnvs()
Expand Down
24 changes: 19 additions & 5 deletions packages/elysia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": false,
"type": "module",
"description": "Elysia integration for Aura Stack authentication library",
"description": "Authentication integration for Elysia applications. Provides middleware, route handlers and session verification powered by Aura Auth.",
"scripts": {
"dev": "tsdown --watch",
"build": "pnpm sync:modules && tsdown",
Expand All @@ -16,7 +16,7 @@
"format:check": "oxfmt --check",
"type-check": "tsc --noEmit",
"clean": "rm -rf dist src/_core src/oauth",
"clean:cts": "if [ -d dist ]; then find dist -type f -name \"*.cts\" -delete; fi",
"clean:cts": "[ -d dist ] && find dist -type f -name \"*.cts\" -delete || true",
"prepublishOnly": "pnpm sync:modules && pnpm build && pnpm clean:cts",
"sync:modules": "node ../shared/scripts/modules.js"
},
Expand Down Expand Up @@ -67,9 +67,23 @@
},
"keywords": [
"auth",
"elysia",
"oauth",
"oauth2",
"security",
"session",
"authentication",
"aura-stack"
"authorization",
"elysia",
"elysiajs",
"bun",
"middleware",
"typescript",
"javascript",
"web-api",
"aura-stack",
"aura-stack-ts",
"aura auth",
"aura-auth"
],
"author": "Aura Stack <aurastackjs@gmail.com> | Hernan Alvarado <halvaradop.dev@gmail.com>",
"homepage": "https://aura-stack-auth.vercel.app",
Expand All @@ -90,4 +104,4 @@
"elysia": ">=1.0.0"
},
"packageManager": "pnpm@10.15.0"
}
}
4 changes: 1 addition & 3 deletions packages/elysia/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"paths": {
"@/*": ["./src/*"],
"@test/*": ["./test/*"]
},
"allowImportingTsExtensions": true,
"noEmit": true
}
},
"include": ["src", "test"],
"exclude": ["dist", "node_modules"]
Expand Down
29 changes: 25 additions & 4 deletions packages/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": false,
"type": "module",
"description": "Express integration for Aura Stack authentication library",
"description": "Authentication integration for Express applications. Provides middleware, route handlers and session verification powered by Aura Auth.",
"scripts": {
"dev": "tsdown --watch",
"build": "pnpm sync:modules && tsdown",
Expand All @@ -16,7 +16,7 @@
"format:check": "oxfmt --check",
"type-check": "tsc --noEmit",
"clean": "rm -rf dist src/_core src/oauth",
"clean:cts": "if [ -d dist ]; then find dist -type f -name \"*.cts\" -delete; fi",
"clean:cts": "[ -d dist ] && find dist -type f -name \"*.cts\" -delete || true",
"prepublishOnly": "pnpm sync:modules && pnpm build && pnpm clean:cts",
"sync:modules": "node ../shared/scripts/modules.js"
},
Expand Down Expand Up @@ -65,7 +65,28 @@
"require": "./dist/_core/cookies.cjs"
}
},
"keywords": [],
"keywords": [
"auth",
"oauth",
"oauth2",
"security",
"session",
"authentication",
"authorization",
"express",
"expressjs",
"node",
"bun",
"deno",
"middleware",
"typescript",
"javascript",
"web-api",
"aura-stack",
"aura-stack-ts",
"aura auth",
"aura-auth"
],
"author": "Aura Stack <aurastackjs@gmail.com> | Hernan Alvarado <halvaradop.dev@gmail.com>",
"homepage": "https://aura-stack-auth.vercel.app",
"bugs": {
Expand All @@ -88,4 +109,4 @@
"express": ">=4.0.0"
},
"packageManager": "pnpm@10.15.0"
}
}
Loading
Loading