hazo_auth 10.4.6 → 10.4.7

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.
@@ -90,12 +90,22 @@ export const _cryptoLoader = {
90
90
 
91
91
  async function load_crypto_module() {
92
92
  let cryptoModule: typeof import("hazo_secure/crypto") | null;
93
+ let importError: string | null = null;
93
94
  try {
94
95
  cryptoModule = await _cryptoLoader.load();
95
- } catch {
96
+ } catch (err) {
97
+ importError = err instanceof Error ? err.message : String(err);
96
98
  cryptoModule = null;
97
99
  }
98
- if (!cryptoModule) throw new GoogleTokenStorageUnconfigured();
100
+ if (!cryptoModule) {
101
+ const logger = create_app_logger();
102
+ logger.error("google_token_service_crypto_unavailable", {
103
+ filename: "google_token_service.ts",
104
+ reason: importError ?? "import returned null",
105
+ fix: "Install hazo_secure (npm install hazo_secure) and add 'hazo_secure' to serverExternalPackages in next.config.ts",
106
+ });
107
+ throw new GoogleTokenStorageUnconfigured();
108
+ }
99
109
  return cryptoModule;
100
110
  }
101
111
 
@@ -119,9 +129,16 @@ export async function store_google_oauth_token(
119
129
  await (keys as unknown as { current(): Promise<unknown> }).current();
120
130
  } catch (err) {
121
131
  const msg = err instanceof Error ? err.message : String(err);
132
+ const currentKeyId = process.env.HAZO_AUTH_OAUTH_KEY_CURRENT;
133
+ const missingVars: string[] = [];
134
+ if (!currentKeyId) missingVars.push("HAZO_AUTH_OAUTH_KEY_CURRENT");
135
+ else if (!process.env[`HAZO_AUTH_OAUTH_KEY_${currentKeyId.toUpperCase()}`])
136
+ missingVars.push(`HAZO_AUTH_OAUTH_KEY_${currentKeyId.toUpperCase()}`);
122
137
  logger.error("google_token_service_key_provider_failed", {
123
138
  filename: "google_token_service.ts",
124
139
  error: msg,
140
+ missing_env_vars: missingVars.length ? missingVars : "unknown — check HAZO_AUTH_OAUTH_KEY_CURRENT and HAZO_AUTH_OAUTH_KEY_<ID>",
141
+ fix: "Set HAZO_AUTH_OAUTH_KEY_CURRENT=<key-id> and HAZO_AUTH_OAUTH_KEY_<KEY-ID>=<base64-aes-key> in your environment",
125
142
  });
126
143
  throw new GoogleTokenStorageUnconfigured();
127
144
  }
@@ -1 +1 @@
1
- {"version":3,"file":"google_token_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/google_token_service.ts"],"names":[],"mappings":"AASA,qBAAa,8BAA+B,SAAQ,KAAK;;CAOxD;AAID,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,eAAe,GAAG,oBAAoB,GAAG,gBAAgB,GAAG,cAAc,CAAA;CAAE,CAAC;AAErG,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAmCF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa;gBACd,OAAO,CAAC,cAAc,oBAAoB,CAAC,CAAC;CACvD,CAAC;AAeF;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,IAAI,CAAC,CA0Ef;AAID;;;GAGG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CA6I5B;AAID;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA6D1C;AAID;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAexF"}
1
+ {"version":3,"file":"google_token_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/google_token_service.ts"],"names":[],"mappings":"AASA,qBAAa,8BAA+B,SAAQ,KAAK;;CAOxD;AAID,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,eAAe,GAAG,oBAAoB,GAAG,gBAAgB,GAAG,cAAc,CAAA;CAAE,CAAC;AAErG,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAmCF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa;gBACd,OAAO,CAAC,cAAc,oBAAoB,CAAC,CAAC;CACvD,CAAC;AAyBF;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,IAAI,CAAC,CAiFf;AAID;;;GAGG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CA6I5B;AAID;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA6D1C;AAID;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAexF"}
@@ -45,14 +45,23 @@ export const _cryptoLoader = {
45
45
  };
46
46
  async function load_crypto_module() {
47
47
  let cryptoModule;
48
+ let importError = null;
48
49
  try {
49
50
  cryptoModule = await _cryptoLoader.load();
50
51
  }
51
- catch (_a) {
52
+ catch (err) {
53
+ importError = err instanceof Error ? err.message : String(err);
52
54
  cryptoModule = null;
53
55
  }
54
- if (!cryptoModule)
56
+ if (!cryptoModule) {
57
+ const logger = create_app_logger();
58
+ logger.error("google_token_service_crypto_unavailable", {
59
+ filename: "google_token_service.ts",
60
+ reason: importError !== null && importError !== void 0 ? importError : "import returned null",
61
+ fix: "Install hazo_secure (npm install hazo_secure) and add 'hazo_secure' to serverExternalPackages in next.config.ts",
62
+ });
55
63
  throw new GoogleTokenStorageUnconfigured();
64
+ }
56
65
  return cryptoModule;
57
66
  }
58
67
  // section: store
@@ -71,9 +80,17 @@ export async function store_google_oauth_token(params) {
71
80
  }
72
81
  catch (err) {
73
82
  const msg = err instanceof Error ? err.message : String(err);
83
+ const currentKeyId = process.env.HAZO_AUTH_OAUTH_KEY_CURRENT;
84
+ const missingVars = [];
85
+ if (!currentKeyId)
86
+ missingVars.push("HAZO_AUTH_OAUTH_KEY_CURRENT");
87
+ else if (!process.env[`HAZO_AUTH_OAUTH_KEY_${currentKeyId.toUpperCase()}`])
88
+ missingVars.push(`HAZO_AUTH_OAUTH_KEY_${currentKeyId.toUpperCase()}`);
74
89
  logger.error("google_token_service_key_provider_failed", {
75
90
  filename: "google_token_service.ts",
76
91
  error: msg,
92
+ missing_env_vars: missingVars.length ? missingVars : "unknown — check HAZO_AUTH_OAUTH_KEY_CURRENT and HAZO_AUTH_OAUTH_KEY_<ID>",
93
+ fix: "Set HAZO_AUTH_OAUTH_KEY_CURRENT=<key-id> and HAZO_AUTH_OAUTH_KEY_<KEY-ID>=<base64-aes-key> in your environment",
77
94
  });
78
95
  throw new GoogleTokenStorageUnconfigured();
79
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hazo_auth",
3
- "version": "10.4.6",
3
+ "version": "10.4.7",
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",