hazo_auth 5.1.11 → 5.1.13

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.
@@ -52,11 +52,6 @@ function get_client_ip(request) {
52
52
  }
53
53
  return "unknown";
54
54
  }
55
- /**
56
- * Fetches user data and permissions from database
57
- * @param user_id - User ID
58
- * @returns Object with user, permissions, and role_ids
59
- */
60
55
  /**
61
56
  * CRUD service options for hazo_user_scopes table
62
57
  * This table uses a composite primary key (user_id, scope_id) and no 'id' column
@@ -65,6 +60,48 @@ const USER_SCOPES_CRUD_OPTIONS = {
65
60
  primaryKeys: ["user_id", "scope_id"],
66
61
  autoId: false,
67
62
  };
63
+ /**
64
+ * Fetches full scope details for user's scope assignments
65
+ * Joins hazo_user_scopes with hazo_scopes to get name, slug, branding
66
+ * @param user_id - User ID
67
+ * @returns Array of scope details with branding information
68
+ */
69
+ async function fetch_user_scope_details(user_id) {
70
+ const hazoConnect = get_hazo_connect_instance();
71
+ const user_scopes_service = createCrudService(hazoConnect, "hazo_user_scopes", USER_SCOPES_CRUD_OPTIONS);
72
+ const scopes_service = createCrudService(hazoConnect, "hazo_scopes");
73
+ const user_scope_assignments = await user_scopes_service.findBy({ user_id });
74
+ if (!Array.isArray(user_scope_assignments) || user_scope_assignments.length === 0) {
75
+ return [];
76
+ }
77
+ const scope_details = [];
78
+ for (const assignment of user_scope_assignments) {
79
+ const scope_id = assignment.scope_id;
80
+ const role_id = assignment.role_id;
81
+ const scopes = await scopes_service.findBy({ id: scope_id });
82
+ if (Array.isArray(scopes) && scopes.length > 0) {
83
+ const scope = scopes[0];
84
+ scope_details.push({
85
+ id: scope_id,
86
+ name: scope.name,
87
+ slug: scope.slug || null,
88
+ level: scope.level,
89
+ parent_id: scope.parent_id,
90
+ role_id,
91
+ logo_url: scope.logo_url || null,
92
+ primary_color: scope.primary_color || null,
93
+ secondary_color: scope.secondary_color || null,
94
+ tagline: scope.tagline || null,
95
+ });
96
+ }
97
+ }
98
+ return scope_details;
99
+ }
100
+ /**
101
+ * Fetches user data and permissions from database
102
+ * @param user_id - User ID
103
+ * @returns Object with user, permissions, role_ids, and scopes
104
+ */
68
105
  async function fetch_user_data_from_db(user_id) {
69
106
  const hazoConnect = get_hazo_connect_instance();
70
107
  const users_service = createCrudService(hazoConnect, "hazo_users");
@@ -138,7 +175,9 @@ async function fetch_user_data_from_db(user_id) {
138
175
  }
139
176
  }
140
177
  const permissions = Array.from(permissions_set);
141
- return { user, permissions, role_ids };
178
+ // v5.2: Fetch full scope details for caching
179
+ const scopes = await fetch_user_scope_details(user_id);
180
+ return { user, permissions, role_ids, scopes };
142
181
  }
143
182
  /**
144
183
  * Checks if user has required permissions
@@ -325,8 +364,8 @@ export async function hazo_get_auth(request, options) {
325
364
  user = user_data.user;
326
365
  permissions = user_data.permissions;
327
366
  role_ids = user_data.role_ids;
328
- // Update cache
329
- cache.set(user_id, user, permissions, role_ids);
367
+ // Update cache (v5.2: includes scope details for tenant auth)
368
+ cache.set(user_id, user, permissions, role_ids, user_data.scopes);
330
369
  }
331
370
  catch (error) {
332
371
  const error_message = error instanceof Error ? error.message : "Unknown error";
@@ -0,0 +1,64 @@
1
+ import { NextRequest } from "next/server";
2
+ import type { TenantAuthOptions, TenantAuthResult, RequiredTenantAuthResult } from "./auth_types";
3
+ /**
4
+ * Extracts scope ID from request headers or cookies
5
+ * Priority: Header > Cookie
6
+ * @param request - NextRequest object
7
+ * @param options - TenantAuthOptions for customization
8
+ * @returns Scope ID if found, undefined otherwise
9
+ */
10
+ export declare function extract_scope_id_from_request(request: NextRequest, options: TenantAuthOptions): string | undefined;
11
+ /**
12
+ * Tenant-aware authentication function
13
+ *
14
+ * Extracts tenant/scope context from request headers or cookies,
15
+ * validates access, and returns enriched result with organization info.
16
+ *
17
+ * Header priority: X-Hazo-Scope-Id > Cookie
18
+ *
19
+ * @param request - NextRequest object
20
+ * @param options - TenantAuthOptions for customization
21
+ * @returns TenantAuthResult with user, permissions, organization, and user_scopes
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const auth = await hazo_get_tenant_auth(request);
26
+ * if (auth.authenticated && auth.organization) {
27
+ * // Access tenant-specific data
28
+ * const data = await getData(auth.organization.id);
29
+ * }
30
+ * ```
31
+ */
32
+ export declare function hazo_get_tenant_auth(request: NextRequest, options?: TenantAuthOptions): Promise<TenantAuthResult>;
33
+ /**
34
+ * Strict tenant authentication helper
35
+ *
36
+ * Wraps hazo_get_tenant_auth and throws appropriate errors:
37
+ * - AuthenticationRequiredError (401) if not authenticated
38
+ * - TenantRequiredError (403) if no tenant context in request
39
+ * - TenantAccessDeniedError (403) if user lacks access to requested tenant
40
+ *
41
+ * @param request - NextRequest object
42
+ * @param options - TenantAuthOptions for customization
43
+ * @returns RequiredTenantAuthResult with guaranteed non-null organization
44
+ * @throws AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * try {
49
+ * const auth = await require_tenant_auth(request);
50
+ * // auth.organization is guaranteed non-null here
51
+ * const data = await getData(auth.organization.id);
52
+ * } catch (error) {
53
+ * if (error instanceof HazoAuthError) {
54
+ * return NextResponse.json(
55
+ * { error: error.message, code: error.code },
56
+ * { status: error.status_code }
57
+ * );
58
+ * }
59
+ * throw error;
60
+ * }
61
+ * ```
62
+ */
63
+ export declare function require_tenant_auth(request: NextRequest, options?: TenantAuthOptions): Promise<RequiredTenantAuthResult>;
64
+ //# sourceMappingURL=hazo_get_tenant_auth.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hazo_get_tenant_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_tenant_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EAGzB,MAAM,cAAc,CAAC;AAqBtB;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,iBAAiB,GACzB,MAAM,GAAG,SAAS,CAYpB;AAiCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CA0F3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,wBAAwB,CAAC,CA0BnC"}
@@ -0,0 +1,203 @@
1
+ import { hazo_get_auth } from "./hazo_get_auth.server.js";
2
+ import { get_auth_cache } from "./auth_cache.js";
3
+ import { get_scope_by_id } from "../services/scope_service.js";
4
+ import { get_hazo_connect_instance } from "../hazo_connect_instance.server.js";
5
+ import { get_cookie_name } from "../cookies_config.server.js";
6
+ import { get_auth_utility_config } from "../auth_utility_config.server.js";
7
+ import { AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError, } from "./auth_types.js";
8
+ // section: constants
9
+ /**
10
+ * Default header name for scope ID
11
+ */
12
+ const DEFAULT_SCOPE_HEADER = "X-Hazo-Scope-Id";
13
+ /**
14
+ * Base cookie name for scope ID (will have prefix applied)
15
+ */
16
+ const BASE_SCOPE_COOKIE = "hazo_auth_scope_id";
17
+ // section: helpers
18
+ /**
19
+ * Extracts scope ID from request headers or cookies
20
+ * Priority: Header > Cookie
21
+ * @param request - NextRequest object
22
+ * @param options - TenantAuthOptions for customization
23
+ * @returns Scope ID if found, undefined otherwise
24
+ */
25
+ export function extract_scope_id_from_request(request, options) {
26
+ var _a;
27
+ // Check header first
28
+ const header_name = options.scope_header_name || DEFAULT_SCOPE_HEADER;
29
+ const header_value = request.headers.get(header_name);
30
+ if (header_value) {
31
+ return header_value;
32
+ }
33
+ // Check cookie (with prefix)
34
+ const cookie_name = options.scope_cookie_name || get_cookie_name(BASE_SCOPE_COOKIE);
35
+ const cookie_value = (_a = request.cookies.get(cookie_name)) === null || _a === void 0 ? void 0 : _a.value;
36
+ return cookie_value;
37
+ }
38
+ /**
39
+ * Builds TenantOrganization from scope details and access info
40
+ * @param scope_details - Full scope details from cache
41
+ * @param is_super_admin - Whether user is accessing as super admin
42
+ * @returns TenantOrganization object
43
+ */
44
+ function build_tenant_organization(scope_details, is_super_admin) {
45
+ return {
46
+ id: scope_details.id,
47
+ name: scope_details.name,
48
+ slug: scope_details.slug,
49
+ level: scope_details.level,
50
+ role_id: scope_details.role_id,
51
+ is_super_admin,
52
+ branding: scope_details.logo_url || scope_details.primary_color
53
+ ? {
54
+ logo_url: scope_details.logo_url,
55
+ primary_color: scope_details.primary_color,
56
+ secondary_color: scope_details.secondary_color,
57
+ tagline: scope_details.tagline,
58
+ }
59
+ : undefined,
60
+ };
61
+ }
62
+ // section: main_functions
63
+ /**
64
+ * Tenant-aware authentication function
65
+ *
66
+ * Extracts tenant/scope context from request headers or cookies,
67
+ * validates access, and returns enriched result with organization info.
68
+ *
69
+ * Header priority: X-Hazo-Scope-Id > Cookie
70
+ *
71
+ * @param request - NextRequest object
72
+ * @param options - TenantAuthOptions for customization
73
+ * @returns TenantAuthResult with user, permissions, organization, and user_scopes
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * const auth = await hazo_get_tenant_auth(request);
78
+ * if (auth.authenticated && auth.organization) {
79
+ * // Access tenant-specific data
80
+ * const data = await getData(auth.organization.id);
81
+ * }
82
+ * ```
83
+ */
84
+ export async function hazo_get_tenant_auth(request, options = {}) {
85
+ // Extract scope_id from request
86
+ const scope_id = extract_scope_id_from_request(request, options);
87
+ // Build hazo_get_auth options, passing through scope_id if present
88
+ const auth_options = Object.assign(Object.assign({}, options), { scope_id: scope_id || options.scope_id });
89
+ // Call base hazo_get_auth
90
+ const auth_result = await hazo_get_auth(request, auth_options);
91
+ // Handle unauthenticated case
92
+ if (!auth_result.authenticated) {
93
+ return {
94
+ authenticated: false,
95
+ user: null,
96
+ permissions: [],
97
+ permission_ok: false,
98
+ organization: null,
99
+ organization_id: null,
100
+ user_scopes: [],
101
+ scope_ok: false,
102
+ };
103
+ }
104
+ // Get user's scopes from cache (already populated by hazo_get_auth)
105
+ const config = get_auth_utility_config();
106
+ const cache = get_auth_cache(config.cache_max_users, config.cache_ttl_minutes, config.cache_max_age_minutes);
107
+ const cached = cache.get(auth_result.user.id);
108
+ // User scopes from cache or empty array
109
+ const user_scopes = (cached === null || cached === void 0 ? void 0 : cached.scopes) || [];
110
+ // Build organization info if scope access was successful
111
+ let organization = null;
112
+ if (scope_id && auth_result.scope_ok && auth_result.scope_access_via) {
113
+ // Find the scope in user's scopes that matches the access_via scope
114
+ const access_scope = user_scopes.find((s) => { var _a; return s.id === ((_a = auth_result.scope_access_via) === null || _a === void 0 ? void 0 : _a.scope_id); });
115
+ if (access_scope) {
116
+ organization = build_tenant_organization(access_scope, auth_result.scope_access_via.is_super_admin || false);
117
+ }
118
+ else if (auth_result.scope_access_via.is_super_admin) {
119
+ // Super admin accessing scope they're not assigned to - fetch scope details
120
+ const hazoConnect = get_hazo_connect_instance();
121
+ const scope_result = await get_scope_by_id(hazoConnect, scope_id);
122
+ if (scope_result.success && scope_result.scope) {
123
+ organization = {
124
+ id: scope_result.scope.id,
125
+ name: scope_result.scope.name,
126
+ slug: null, // Could fetch from scope if slug column exists
127
+ level: scope_result.scope.level,
128
+ role_id: "", // Super admin doesn't have a role in the scope
129
+ is_super_admin: true,
130
+ branding: scope_result.scope.logo_url
131
+ ? {
132
+ logo_url: scope_result.scope.logo_url,
133
+ primary_color: scope_result.scope.primary_color,
134
+ secondary_color: scope_result.scope.secondary_color,
135
+ tagline: scope_result.scope.tagline,
136
+ }
137
+ : undefined,
138
+ };
139
+ }
140
+ }
141
+ }
142
+ return {
143
+ authenticated: true,
144
+ user: auth_result.user,
145
+ permissions: auth_result.permissions,
146
+ permission_ok: auth_result.permission_ok,
147
+ missing_permissions: auth_result.missing_permissions,
148
+ organization,
149
+ organization_id: (organization === null || organization === void 0 ? void 0 : organization.id) || null,
150
+ user_scopes,
151
+ scope_ok: auth_result.scope_ok,
152
+ scope_access_via: auth_result.scope_access_via,
153
+ };
154
+ }
155
+ /**
156
+ * Strict tenant authentication helper
157
+ *
158
+ * Wraps hazo_get_tenant_auth and throws appropriate errors:
159
+ * - AuthenticationRequiredError (401) if not authenticated
160
+ * - TenantRequiredError (403) if no tenant context in request
161
+ * - TenantAccessDeniedError (403) if user lacks access to requested tenant
162
+ *
163
+ * @param request - NextRequest object
164
+ * @param options - TenantAuthOptions for customization
165
+ * @returns RequiredTenantAuthResult with guaranteed non-null organization
166
+ * @throws AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * try {
171
+ * const auth = await require_tenant_auth(request);
172
+ * // auth.organization is guaranteed non-null here
173
+ * const data = await getData(auth.organization.id);
174
+ * } catch (error) {
175
+ * if (error instanceof HazoAuthError) {
176
+ * return NextResponse.json(
177
+ * { error: error.message, code: error.code },
178
+ * { status: error.status_code }
179
+ * );
180
+ * }
181
+ * throw error;
182
+ * }
183
+ * ```
184
+ */
185
+ export async function require_tenant_auth(request, options = {}) {
186
+ const result = await hazo_get_tenant_auth(request, options);
187
+ // Check authentication
188
+ if (!result.authenticated) {
189
+ throw new AuthenticationRequiredError();
190
+ }
191
+ // Extract scope_id from request for error messages
192
+ const scope_id = extract_scope_id_from_request(request, options);
193
+ // Check if scope was requested but access denied
194
+ if (scope_id && !result.scope_ok) {
195
+ throw new TenantAccessDeniedError(scope_id, result.user_scopes);
196
+ }
197
+ // Check if organization context is required but missing
198
+ if (!result.organization) {
199
+ throw new TenantRequiredError("No organization context provided. Include X-Hazo-Scope-Id header or scope cookie.", result.user_scopes);
200
+ }
201
+ // Type assertion: at this point we know organization is non-null
202
+ return result;
203
+ }
@@ -2,6 +2,9 @@ export * from "./auth_types.js";
2
2
  export { hazo_get_auth } from "./hazo_get_auth.server.js";
3
3
  export { get_authenticated_user, require_auth, is_authenticated, } from "./auth_utils.server.js";
4
4
  export type { AuthResult, AuthUser } from "./auth_utils.server";
5
+ export { hazo_get_tenant_auth, require_tenant_auth, extract_scope_id_from_request, } from "./hazo_get_tenant_auth.server.js";
6
+ export type { ScopeDetails, TenantOrganization, TenantAuthOptions, TenantAuthResult, RequiredTenantAuthResult, } from "./auth_types";
7
+ export { HazoAuthError, AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError, } from "./auth_types.js";
5
8
  export { get_server_auth_user } from "./server_auth.js";
6
9
  export type { ServerAuthResult } from "./server_auth";
7
10
  export { get_auth_cache, reset_auth_cache } from "./auth_cache.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGhE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -4,6 +4,9 @@ export * from "./auth_types.js";
4
4
  // section: server_exports
5
5
  export { hazo_get_auth } from "./hazo_get_auth.server.js";
6
6
  export { get_authenticated_user, require_auth, is_authenticated, } from "./auth_utils.server.js";
7
+ // section: tenant_auth_exports
8
+ export { hazo_get_tenant_auth, require_tenant_auth, extract_scope_id_from_request, } from "./hazo_get_tenant_auth.server.js";
9
+ export { HazoAuthError, AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError, } from "./auth_types.js";
7
10
  // section: client_exports
8
11
  export { get_server_auth_user } from "./server_auth.js";
9
12
  // section: cache_exports
@@ -9,6 +9,7 @@ export declare const BASE_COOKIE_NAMES: {
9
9
  readonly USER_EMAIL: "hazo_auth_user_email";
10
10
  readonly SESSION: "hazo_auth_session";
11
11
  readonly DEV_LOCK: "hazo_auth_dev_lock";
12
+ readonly SCOPE_ID: "hazo_auth_scope_id";
12
13
  };
13
14
  /**
14
15
  * Reads cookie configuration from hazo_auth_config.ini file
@@ -1 +1 @@
1
- {"version":3,"file":"cookies_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/cookies_config.server.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG;IAC1B,6FAA6F;IAC7F,aAAa,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAYF,eAAO,MAAM,iBAAiB;;;;;CAKpB,CAAC;AAGX;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,aAAa,CAWlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAQzG;AAKD;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,aAAa,CAKzD;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD"}
1
+ {"version":3,"file":"cookies_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/cookies_config.server.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG;IAC1B,6FAA6F;IAC7F,aAAa,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAYF,eAAO,MAAM,iBAAiB;;;;;;CAMpB,CAAC;AAGX;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,aAAa,CAWlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAQzG;AAKD;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,aAAa,CAKzD;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD"}
@@ -13,6 +13,7 @@ export const BASE_COOKIE_NAMES = {
13
13
  USER_EMAIL: "hazo_auth_user_email",
14
14
  SESSION: "hazo_auth_session",
15
15
  DEV_LOCK: "hazo_auth_dev_lock",
16
+ SCOPE_ID: "hazo_auth_scope_id", // v5.2: Tenant context cookie for multi-tenancy
16
17
  };
17
18
  // section: main_function
18
19
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hazo_auth",
3
- "version": "5.1.11",
3
+ "version": "5.1.13",
4
4
  "description": "Zero-config authentication UI components for Next.js with RBAC, OAuth, scope-based multi-tenancy, and invitations",
5
5
  "keywords": [
6
6
  "authentication",