@mindfulauth/core 2.0.0-beta.9 → 2.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"auth-handler.d.ts","sourceRoot":"","sources":["../../src/core/auth-handler.ts"],"names":[],"mappings":"AAwEA,2EAA2E;AAC3E,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6BpH;AAED,gEAAgE;AAChE,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAyDrH"}
1
+ {"version":3,"file":"auth-handler.d.ts","sourceRoot":"","sources":["../../src/core/auth-handler.ts"],"names":[],"mappings":"AAoEA,2EAA2E;AAC3E,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6BpH;AAED,gEAAgE;AAChE,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAyDrH"}
@@ -1,12 +1,8 @@
1
1
  // Auth proxy handler for Mindful Auth
2
2
  // Forwards authentication requests to the central Mindful Auth service
3
- //
4
- // ASTRO 6 MIGRATION:
5
- // - Astro v6 removed context.locals.runtime.env. Env vars now import from 'cloudflare:workers'.
6
- // - Note: @cloudflare/workers-types must be installed and referenced in env.d.ts.
7
3
  import { env } from 'cloudflare:workers';
8
- import { CENTRAL_AUTH_ORIGIN, ALLOWED_AUTH_METHODS, MAX_BODY_SIZE_BYTES, AUTH_PROXY_TIMEOUT_MS } from './config';
9
- import { sanitizeEndpoint } from './security';
4
+ import { CENTRAL_AUTH_ORIGIN, ALLOWED_AUTH_METHODS, MAX_BODY_SIZE_BYTES, AUTH_PROXY_TIMEOUT_MS } from './config.js';
5
+ import { sanitizeEndpoint } from './security.js';
10
6
  const JSON_HEADERS = { 'Content-Type': 'application/json' };
11
7
  const jsonError = (error, status) => new Response(JSON.stringify({ error }), { status, headers: JSON_HEADERS });
12
8
  /** Build proxy headers from incoming request */
@@ -1,4 +1,4 @@
1
- import type { SessionValidationResult } from './types';
1
+ import type { SessionValidationResult } from './types.js';
2
2
  /** Validate session with Mindful Auth central service */
3
3
  export declare function validateSession(request: Request, tenantDomain: string, pathname: string, internalApiKey: string): Promise<SessionValidationResult>;
4
4
  /** Validate memberid in URL matches session (or just check structure if sessionRecordId is null) */
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/core/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,yDAAyD;AACzD,wBAAsB,eAAe,CACjC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,uBAAuB,CAAC,CAsClC;AAED,oGAAoG;AACpG,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,CAerI"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/core/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D,yDAAyD;AACzD,wBAAsB,eAAe,CACjC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,uBAAuB,CAAC,CAsClC;AAED,oGAAoG;AACpG,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,CAerI"}
package/dist/core/auth.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Authentication and session validation for Mindful Auth
2
- import { CENTRAL_AUTH_ORIGIN, SESSION_VALIDATION_TIMEOUT_MS } from './config';
2
+ import { CENTRAL_AUTH_ORIGIN, SESSION_VALIDATION_TIMEOUT_MS } from './config.js';
3
3
  /** Validate session with Mindful Auth central service */
4
4
  export async function validateSession(request, tenantDomain, pathname, internalApiKey) {
5
5
  const sessionId = request.headers.get('Cookie')?.match(/session_id=([^;]+)/)?.[1];
@@ -41,8 +41,7 @@ export declare const PUBLIC_PREFIXES: string[];
41
41
  * Astro 6's native security.csp in astro.config.mjs using hashes.
42
42
  * The remaining headers here cover transport security, framing, and permissions.
43
43
  *
44
- * Note: X-Frame-Options: SAMEORIGIN covers clickjacking protection
45
- * (equivalent to CSP frame-ancestors 'self', which cannot be set via meta tag).
44
+ * Note: X-Frame-Options: DENY prevents this portal from being embedded in iframes on any domain, protecting against clickjacking attacks.
46
45
  */
47
46
  export declare function GET_SECURITY_HEADERS(): Record<string, string>;
48
47
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,gCAAgC,CAAC;AAGjE,eAAO,MAAM,oBAAoB,UAAkB,CAAC;AACpD,eAAO,MAAM,mBAAmB,UAA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AAE,MAAM,CAAC,CAIzB;AAID,eAAO,MAAM,aAAa,UAQzB,CAAC;AAIF,eAAO,MAAM,eAAe,UAO3B,CAAC;AAMF;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAU7D"}
@@ -80,15 +80,16 @@ export const PUBLIC_PREFIXES = [
80
80
  * Astro 6's native security.csp in astro.config.mjs using hashes.
81
81
  * The remaining headers here cover transport security, framing, and permissions.
82
82
  *
83
- * Note: X-Frame-Options: SAMEORIGIN covers clickjacking protection
84
- * (equivalent to CSP frame-ancestors 'self', which cannot be set via meta tag).
83
+ * Note: X-Frame-Options: DENY prevents this portal from being embedded in iframes on any domain, protecting against clickjacking attacks.
85
84
  */
86
85
  export function GET_SECURITY_HEADERS() {
87
86
  return {
88
87
  'X-Content-Type-Options': 'nosniff',
89
- 'X-Frame-Options': 'SAMEORIGIN',
88
+ 'X-Frame-Options': 'DENY',
90
89
  'Referrer-Policy': 'strict-origin-when-cross-origin',
91
- 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
92
- 'Permissions-Policy': 'geolocation=(), microphone=(), camera=()',
90
+ 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload',
91
+ 'Permissions-Policy': 'geolocation=(), microphone=(), camera=(), payment=(), usb=(), magnetometer=(), gyroscope=(), accelerometer=()',
92
+ 'Cross-Origin-Opener-Policy': 'same-origin',
93
+ 'Cross-Origin-Resource-Policy': 'same-origin',
93
94
  };
94
95
  }
@@ -1,8 +1,6 @@
1
- export * from './types';
2
- export * from './config';
3
- export * from './auth';
4
- export * from './auth-handler';
5
- export * from './security';
6
- export * from './middleware';
7
- export * from './csp';
1
+ export * from './types.js';
2
+ export * from './config.js';
3
+ export * from './auth.js';
4
+ export * from './security.js';
5
+ export * from './csp.js';
8
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAGA,cAAc,SAAS,CAAC;AAGxB,cAAc,UAAU,CAAC;AAGzB,cAAc,QAAQ,CAAC;AAGvB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAG7B,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAM1B,cAAc,eAAe,CAAC;AAQ9B,cAAc,UAAU,CAAC"}
@@ -1,15 +1,17 @@
1
1
  // Mindful Auth Core - Main exports
2
2
  // Types
3
- export * from './types';
3
+ export * from './types.js';
4
4
  // Configuration
5
- export * from './config';
5
+ export * from './config.js';
6
6
  // Authentication
7
- export * from './auth';
8
- // Auth handler for API routes
9
- export * from './auth-handler';
7
+ export * from './auth.js';
8
+ // Auth handler for API routes — NOT re-exported here.
9
+ // auth-handler.ts imports 'cloudflare:workers' which is only available at runtime (SSR), not at config-load time. Import it directly where needed: import { handleAuthProxy } from './auth-handler.js';
10
10
  // Security utilities
11
- export * from './security';
12
- // Middleware
13
- export * from './middleware';
11
+ export * from './security.js';
12
+ // Middleware — NOT re-exported here.
13
+ // middleware.ts imports 'astro:middleware' and 'cloudflare:workers' which are
14
+ // only available at runtime (SSR), not at config-load time.
15
+ // Import it directly: import { onRequest } from './middleware.js';
14
16
  // Build-time CSP utilities
15
- export * from './csp';
17
+ export * from './csp.js';
@@ -7,9 +7,9 @@
7
7
  // - Dev mode bypass uses import.meta.env.DEV (build-time constant: true in dev, false in prod).
8
8
  import { defineMiddleware } from 'astro:middleware';
9
9
  import { env } from 'cloudflare:workers';
10
- import { PUBLIC_ROUTES, PUBLIC_PREFIXES, GET_SECURITY_HEADERS, GET_SKIP_ASSETS } from './config';
11
- import { sanitizePath } from './security';
12
- import { validateSession, validateMemberIdInUrl } from './auth';
10
+ import { PUBLIC_ROUTES, PUBLIC_PREFIXES, GET_SECURITY_HEADERS, GET_SKIP_ASSETS } from './config.js';
11
+ import { sanitizePath } from './security.js';
12
+ import { validateSession, validateMemberIdInUrl } from './auth.js';
13
13
  /** Check if a path is a public route (no auth required) */
14
14
  function isPublicRoute(pathname) {
15
15
  return PUBLIC_ROUTES.includes(pathname) ||
@@ -1,11 +1,6 @@
1
1
  import type { MiddlewareHandler } from 'astro';
2
2
  export interface MindfulAuthLocals {
3
3
  recordId: string | null;
4
- runtime?: {
5
- env?: {
6
- INTERNAL_API_KEY?: string;
7
- };
8
- };
9
4
  }
10
5
  declare global {
11
6
  namespace App {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE;QACR,GAAG,CAAC,EAAE;YACJ,gBAAgB,CAAC,EAAE,MAAM,CAAC;SAC3B,CAAC;KACH,CAAC;CACH;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,MAAO,SAAQ,iBAAiB;SAAG;KAC9C;CACF;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,MAAO,SAAQ,iBAAiB;SAAG;KAC9C;CACF;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@mindfulauth/core",
3
- "version": "2.0.0-beta.9",
3
+ "version": "2.0.1",
4
4
  "description": "Mindful Auth core authentication library for Astro 6",
5
5
  "type": "module",
6
- "main": "./dist/core/index.js",
7
- "types": "./dist/core/index.d.ts",
6
+ "sideEffects": false,
8
7
  "exports": {
9
8
  ".": {
10
9
  "types": "./dist/core/index.d.ts",
@@ -51,12 +50,12 @@
51
50
  "author": "Mindful Auth",
52
51
  "license": "MIT",
53
52
  "peerDependencies": {
54
- "astro": "^6.0.0-beta.20"
53
+ "astro": "^6.0.1"
55
54
  },
56
55
  "devDependencies": {
57
- "@cloudflare/workers-types": "^4.20260307.1",
58
- "@types/node": "^25.3.5",
59
- "astro": "^6.0.0-beta.20",
56
+ "@cloudflare/workers-types": "^4.20260310.1",
57
+ "@types/node": "^25.4.0",
58
+ "astro": "^6.0.1",
60
59
  "typescript": "^5.9.3"
61
60
  }
62
61
  }