@canton-network/core-wallet-auth 1.7.0 → 1.9.0

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.
package/dist/index.js CHANGED
@@ -1,347 +1,355 @@
1
- import { decodeJwt, SignJWT } from 'jose';
2
- import { providerErrors } from '@canton-network/core-rpc-errors';
3
- import { z } from 'zod';
4
-
5
- var __defProp = Object.defineProperty;
6
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
1
+ import { SignJWT, decodeJwt } from "jose";
2
+ import { providerErrors } from "@canton-network/core-rpc-errors";
3
+ import { z } from "zod";
4
+ //#region src/auth-utils.ts
8
5
  function assertConnected(authContext) {
9
- if (!authContext) {
10
- throw providerErrors.unauthorized({
11
- message: "User is not connected"
12
- });
13
- }
14
- return authContext;
6
+ if (!authContext) throw providerErrors.unauthorized({ message: "User is not connected" });
7
+ return authContext;
15
8
  }
9
+ /**
10
+ * Extract a User ID from the `sub` claim of a JWT. Throws if `sub` is missing.
11
+ *
12
+ * @param token a base64 encoded JWT token
13
+ * @returns
14
+ */
16
15
  function jwtUserId(token) {
17
- const { sub } = decodeJwt(token);
18
- if (!sub) {
19
- throw new Error("token did not contain a subject field");
20
- }
21
- return sub;
16
+ const { sub } = decodeJwt(token);
17
+ if (!sub) throw new Error("token did not contain a subject field");
18
+ return sub;
22
19
  }
20
+ /**
21
+ * Extract the optional `email` claim from a JWT.
22
+ *
23
+ * @param token a base64 encoded JWT token
24
+ * @returns email when present, otherwise undefined
25
+ */
23
26
  function jwtUserEmail(token) {
24
- const { email } = decodeJwt(token);
25
- if (typeof email !== "string" || email.length === 0) {
26
- return void 0;
27
- }
28
- return email;
27
+ const { email } = decodeJwt(token);
28
+ if (typeof email !== "string" || email.length === 0) return;
29
+ return email;
29
30
  }
31
+ /**
32
+ * Fetches user claims from the OIDC UserInfo endpoint.
33
+ * Discovers the endpoint via the OIDC discovery document at configUrl.
34
+ *
35
+ * @param configUrl - The OIDC discovery document URL (/.well-known/openid-configuration)
36
+ * @param accessToken - The user's bearer access token
37
+ * @returns The UserInfo claims, or undefined if the IDP does not expose a userinfo endpoint
38
+ * @throws If any network request fails
39
+ */
30
40
  async function fetchOidcUserInfo(configUrl, accessToken) {
31
- const configResponse = await fetch(configUrl);
32
- if (!configResponse.ok) {
33
- throw new Error(
34
- `Failed to fetch OIDC discovery document: ${configResponse.status} ${configResponse.statusText}`
35
- );
36
- }
37
- const config = await configResponse.json();
38
- if (!config.userinfo_endpoint) {
39
- return void 0;
40
- }
41
- const userInfoResponse = await fetch(config.userinfo_endpoint, {
42
- headers: { Authorization: `Bearer ${accessToken}` }
43
- });
44
- if (!userInfoResponse.ok) {
45
- throw new Error(
46
- `Failed to fetch OIDC userinfo: ${userInfoResponse.status} ${userInfoResponse.statusText}`
47
- );
48
- }
49
- return await userInfoResponse.json();
41
+ const configResponse = await fetch(configUrl);
42
+ if (!configResponse.ok) throw new Error(`Failed to fetch OIDC discovery document: ${configResponse.status} ${configResponse.statusText}`);
43
+ const config = await configResponse.json();
44
+ if (!config.userinfo_endpoint) return;
45
+ const userInfoResponse = await fetch(config.userinfo_endpoint, { headers: { Authorization: `Bearer ${accessToken}` } });
46
+ if (!userInfoResponse.ok) throw new Error(`Failed to fetch OIDC userinfo: ${userInfoResponse.status} ${userInfoResponse.statusText}`);
47
+ return await userInfoResponse.json();
50
48
  }
49
+ /**
50
+ * Resolve the user email from the OIDC userinfo endpoint.
51
+ *
52
+ * @param authContext - The authentication context
53
+ * @param idp - The IDP configuration
54
+ * @param logger - The logger
55
+ * @returns The user email, or undefined if the email is not found
56
+ */
51
57
  async function resolveUserEmail(authContext, idp, logger) {
52
- if (authContext.email) {
53
- return authContext.email;
54
- }
55
- try {
56
- if (idp.type !== "oauth") {
57
- return void 0;
58
- }
59
- const userInfo = await fetchOidcUserInfo(
60
- idp.configUrl,
61
- authContext.accessToken
62
- );
63
- return userInfo?.email;
64
- } catch (error) {
65
- logger?.warn(error, "Failed to resolve user email from OIDC userinfo");
66
- return void 0;
67
- }
58
+ if (authContext.email) return authContext.email;
59
+ try {
60
+ if (idp.type !== "oauth") return;
61
+ return (await fetchOidcUserInfo(idp.configUrl, authContext.accessToken))?.email;
62
+ } catch (error) {
63
+ logger?.warn(error, "Failed to resolve user email from OIDC userinfo");
64
+ return;
65
+ }
68
66
  }
67
+ /**
68
+ * Determine if a given JWT is still valid based on its expiry time.
69
+ *
70
+ * @param token a base64 encoded JWT token
71
+ * @returns true if the token is expired, false if not
72
+ */
69
73
  function jwtExpired(token) {
70
- try {
71
- const payload = decodeJwt(token);
72
- const now = Math.floor(Date.now() / 1e3);
73
- return typeof payload.exp === "number" && payload.exp <= now;
74
- } catch {
75
- return true;
76
- }
74
+ try {
75
+ const payload = decodeJwt(token);
76
+ const now = Math.floor(Date.now() / 1e3);
77
+ return typeof payload.exp === "number" && payload.exp <= now;
78
+ } catch {
79
+ return true;
80
+ }
77
81
  }
78
-
79
- // src/client-credentials-service.ts
82
+ //#endregion
83
+ //#region src/client-credentials-service.ts
80
84
  var ClientCredentialsService = class {
81
- constructor(configUrl, logger) {
82
- this.configUrl = configUrl;
83
- this.logger = logger;
84
- }
85
- /**
86
- * Fetches the JWT token (M2M) using client credentials.
87
- *
88
- * @returns The JWT access token as a string.
89
- * @throws If fetching the token fails or the response is invalid.
90
- */
91
- async fetchToken(credentials) {
92
- try {
93
- const oidcConfig = await this.getOIDCConfig(this.configUrl);
94
- this.logger?.debug({ oidcConfig }, "Fetched OIDC config");
95
- const res = await this.fetchTokenEndpoint(
96
- oidcConfig.token_endpoint,
97
- credentials
98
- );
99
- const json = await res.json();
100
- this.logger?.info(
101
- { response: json },
102
- `Fetched admin token for clientId: ${credentials.clientId}`
103
- );
104
- if (!json.access_token) {
105
- throw new Error("No access_token in token endpoint response");
106
- }
107
- return json.access_token;
108
- } catch (error) {
109
- this.logger?.error({ err: error }, "Failed to fetch admin token");
110
- throw error;
111
- }
112
- }
113
- async fetchTokenEndpoint(tokenEndpoint, credentials) {
114
- const params = new URLSearchParams({
115
- grant_type: "client_credentials",
116
- scope: credentials.scope ?? "",
117
- audience: credentials.audience ?? ""
118
- });
119
- const password = toClientPassword(
120
- credentials.clientId,
121
- credentials.clientSecret
122
- );
123
- const res = await fetch(tokenEndpoint, {
124
- method: "POST",
125
- headers: {
126
- "Content-Type": "application/x-www-form-urlencoded",
127
- Authorization: `Basic ${password}`
128
- },
129
- body: params.toString()
130
- });
131
- if (!res.ok) {
132
- this.logger?.error(
133
- { status: res.status, statusText: res.statusText },
134
- "Token endpoint error"
135
- );
136
- throw new Error(
137
- `Token endpoint error: ${res.status} ${res.statusText}`
138
- );
139
- }
140
- return res;
141
- }
142
- async getOIDCConfig(url) {
143
- const res = await fetch(url);
144
- if (!res.ok) {
145
- const text = await res.text();
146
- this.logger?.error(
147
- { status: res.status, statusText: res.statusText, body: text },
148
- "Failed to fetch OIDC config"
149
- );
150
- throw new Error(
151
- `OIDC config error: ${res.status} ${res.statusText}`
152
- );
153
- }
154
- return res.json();
155
- }
85
+ constructor(configUrl, logger) {
86
+ this.configUrl = configUrl;
87
+ this.logger = logger;
88
+ }
89
+ /**
90
+ * Fetches the JWT token (M2M) using client credentials.
91
+ *
92
+ * @returns The JWT access token as a string.
93
+ * @throws If fetching the token fails or the response is invalid.
94
+ */
95
+ async fetchToken(credentials) {
96
+ try {
97
+ const oidcConfig = await this.getOIDCConfig(this.configUrl);
98
+ this.logger?.debug({ oidcConfig }, "Fetched OIDC config");
99
+ const json = await (await this.fetchTokenEndpoint(oidcConfig.token_endpoint, credentials)).json();
100
+ this.logger?.info({ response: json }, `Fetched admin token for clientId: ${credentials.clientId}`);
101
+ if (!json.access_token) throw new Error("No access_token in token endpoint response");
102
+ return json.access_token;
103
+ } catch (error) {
104
+ this.logger?.error({ err: error }, "Failed to fetch admin token");
105
+ throw error;
106
+ }
107
+ }
108
+ async fetchTokenEndpoint(tokenEndpoint, credentials) {
109
+ const params = new URLSearchParams({
110
+ grant_type: "client_credentials",
111
+ scope: credentials.scope ?? "",
112
+ audience: credentials.audience ?? ""
113
+ });
114
+ const password = toClientPassword(credentials.clientId, credentials.clientSecret);
115
+ const res = await fetch(tokenEndpoint, {
116
+ method: "POST",
117
+ headers: {
118
+ "Content-Type": "application/x-www-form-urlencoded",
119
+ Authorization: `Basic ${password}`
120
+ },
121
+ body: params.toString()
122
+ });
123
+ if (!res.ok) {
124
+ this.logger?.error({
125
+ status: res.status,
126
+ statusText: res.statusText
127
+ }, "Token endpoint error");
128
+ throw new Error(`Token endpoint error: ${res.status} ${res.statusText}`);
129
+ }
130
+ return res;
131
+ }
132
+ async getOIDCConfig(url) {
133
+ const res = await fetch(url);
134
+ if (!res.ok) {
135
+ const text = await res.text();
136
+ this.logger?.error({
137
+ status: res.status,
138
+ statusText: res.statusText,
139
+ body: text
140
+ }, "Failed to fetch OIDC config");
141
+ throw new Error(`OIDC config error: ${res.status} ${res.statusText}`);
142
+ }
143
+ return res.json();
144
+ }
156
145
  };
157
- var toClientPassword = (clientId, clientSecret) => {
158
- const credentials = `${clientId}:${clientSecret}`;
159
- return btoa(credentials);
146
+ const toClientPassword = (clientId, clientSecret) => {
147
+ const credentials = `${clientId}:${clientSecret}`;
148
+ return btoa(credentials);
160
149
  };
161
- var clientCredentialsService = (configUrl, logger) => ({
162
- fetchToken: async (credentials) => new ClientCredentialsService(configUrl, logger).fetchToken(credentials)
163
- });
150
+ const clientCredentialsService = (configUrl, logger) => ({ fetchToken: async (credentials) => new ClientCredentialsService(configUrl, logger).fetchToken(credentials) });
151
+ //#endregion
152
+ //#region src/self-signed-token-service.ts
164
153
  var SelfSignedTokenService = class {
165
- static async fetchToken(logger, credentials, issuer, expirySeconds = 3600) {
166
- const secret = new TextEncoder().encode(credentials.clientSecret);
167
- const now = Math.floor(Date.now() / 1e3);
168
- const jwt = await new SignJWT({
169
- sub: credentials.clientId,
170
- aud: credentials.audience || "",
171
- scope: credentials.scope || "",
172
- iat: now,
173
- exp: now + expirySeconds,
174
- iss: issuer
175
- }).setProtectedHeader({ alg: "HS256" }).sign(secret);
176
- logger.info(`Generated self-signed JWT token: ${jwt}`);
177
- return jwt;
178
- }
154
+ static async fetchToken(logger, credentials, issuer, expirySeconds = 3600) {
155
+ const secret = new TextEncoder().encode(credentials.clientSecret);
156
+ const now = Math.floor(Date.now() / 1e3);
157
+ const jwt = await new SignJWT({
158
+ sub: credentials.clientId,
159
+ aud: credentials.audience || "",
160
+ scope: credentials.scope || "",
161
+ iat: now,
162
+ exp: now + expirySeconds,
163
+ iss: issuer
164
+ }).setProtectedHeader({ alg: "HS256" }).sign(secret);
165
+ logger.info(`Generated self-signed JWT token: ${jwt}`);
166
+ return jwt;
167
+ }
179
168
  };
180
-
181
- // src/auth-token-provider.ts
182
- var AuthTokenProvider = class _AuthTokenProvider {
183
- constructor(config, logger) {
184
- this.config = config;
185
- this.logger = logger;
186
- __publicField(this, "cachedToken");
187
- }
188
- static fromToken(token, logger) {
189
- return new _AuthTokenProvider({ method: "static", token }, logger);
190
- }
191
- static fromGatewayConfig(idp, auth, logger) {
192
- if (auth.method === "self_signed") {
193
- return new _AuthTokenProvider(
194
- {
195
- method: auth.method,
196
- issuer: auth.issuer,
197
- credentials: {
198
- clientId: auth.clientId,
199
- clientSecret: auth.clientSecret,
200
- scope: auth.scope,
201
- audience: auth.audience
202
- }
203
- },
204
- logger
205
- );
206
- }
207
- if (auth.method === "client_credentials") {
208
- if (idp.type === "oauth")
209
- return new _AuthTokenProvider(
210
- {
211
- method: auth.method,
212
- configUrl: idp.configUrl,
213
- credentials: {
214
- clientId: auth.clientId,
215
- clientSecret: auth.clientSecret,
216
- scope: auth.scope,
217
- audience: auth.audience
218
- }
219
- },
220
- logger
221
- );
222
- else {
223
- throw new Error(
224
- `IDP type ${idp.type} not supported for client_credentials auth`
225
- );
226
- }
227
- }
228
- throw new Error(
229
- `Auth method ${auth.method} not supported for programmatic access token`
230
- );
231
- }
232
- async _fetchToken() {
233
- this.logger.debug("Fetching user auth token");
234
- switch (this.config.method) {
235
- case "static":
236
- return this.config.token;
237
- case "self_signed":
238
- return SelfSignedTokenService.fetchToken(
239
- this.logger,
240
- this.config.credentials,
241
- this.config.issuer
242
- );
243
- case "client_credentials":
244
- return clientCredentialsService(
245
- this.config.configUrl,
246
- this.logger
247
- ).fetchToken(this.config.credentials);
248
- }
249
- }
250
- /**
251
- *
252
- * @returns A valid JWT token retrieved according to the auth configuration given.
253
- */
254
- async getAccessToken() {
255
- if (this.cachedToken && !jwtExpired(this.cachedToken)) {
256
- return this.cachedToken;
257
- } else {
258
- const newToken = await this._fetchToken();
259
- if (jwtExpired(newToken)) {
260
- throw new Error(
261
- "Attempted to refresh a token, but it came back expired."
262
- );
263
- }
264
- this.cachedToken = newToken;
265
- return newToken;
266
- }
267
- }
268
- /**
269
- *
270
- * @returns An AuthContext containing a valid token and userId.
271
- */
272
- async getAuthContext() {
273
- const accessToken = await this.getAccessToken();
274
- const userId = jwtUserId(accessToken);
275
- const email = jwtUserEmail(accessToken);
276
- return {
277
- accessToken,
278
- userId,
279
- ...email ? { email } : {}
280
- };
281
- }
169
+ //#endregion
170
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/typeof.js
171
+ function _typeof(o) {
172
+ "@babel/helpers - typeof";
173
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
174
+ return typeof o;
175
+ } : function(o) {
176
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
177
+ }, _typeof(o);
178
+ }
179
+ //#endregion
180
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/toPrimitive.js
181
+ function toPrimitive(t, r) {
182
+ if ("object" != _typeof(t) || !t) return t;
183
+ var e = t[Symbol.toPrimitive];
184
+ if (void 0 !== e) {
185
+ var i = e.call(t, r || "default");
186
+ if ("object" != _typeof(i)) return i;
187
+ throw new TypeError("@@toPrimitive must return a primitive value.");
188
+ }
189
+ return ("string" === r ? String : Number)(t);
190
+ }
191
+ //#endregion
192
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/toPropertyKey.js
193
+ function toPropertyKey(t) {
194
+ var i = toPrimitive(t, "string");
195
+ return "symbol" == _typeof(i) ? i : i + "";
196
+ }
197
+ //#endregion
198
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/defineProperty.js
199
+ function _defineProperty(e, r, t) {
200
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
201
+ value: t,
202
+ enumerable: !0,
203
+ configurable: !0,
204
+ writable: !0
205
+ }) : e[r] = t, e;
206
+ }
207
+ //#endregion
208
+ //#region src/auth-token-provider.ts
209
+ /**
210
+ * AuthTokenProvider provides some common functionality across token providers.
211
+ *
212
+ * 1. Token caching: tokens are cached in-memory, so long as the token lifespan is not expired.
213
+ * 2. Context retrieval: deriving a user context from the stored access token.
214
+ *
215
+ *
216
+ * The following programmatic methods of token fetching are supported:
217
+ *
218
+ * - `static`: a fixed, in-memory token. Only used for compatibility, it will totally break for expired tokens.
219
+ * - `self_signed`: only for development purposes, used for Canton setups that accept HMAC256 self signed tokens.
220
+ * - `client_credentials`: used to programmatically acquire tokens via oauth2, a.k.a "machine-to-machine" tokens.
221
+ */
222
+ var AuthTokenProvider = class AuthTokenProvider {
223
+ constructor(config, logger) {
224
+ this.config = config;
225
+ this.logger = logger;
226
+ _defineProperty(this, "cachedToken", void 0);
227
+ }
228
+ static fromToken(token, logger) {
229
+ return new AuthTokenProvider({
230
+ method: "static",
231
+ token
232
+ }, logger);
233
+ }
234
+ static fromGatewayConfig(idp, auth, logger) {
235
+ if (auth.method === "self_signed") return new AuthTokenProvider({
236
+ method: auth.method,
237
+ issuer: auth.issuer,
238
+ credentials: {
239
+ clientId: auth.clientId,
240
+ clientSecret: auth.clientSecret,
241
+ scope: auth.scope,
242
+ audience: auth.audience
243
+ }
244
+ }, logger);
245
+ if (auth.method === "client_credentials") if (idp.type === "oauth") return new AuthTokenProvider({
246
+ method: auth.method,
247
+ configUrl: idp.configUrl,
248
+ credentials: {
249
+ clientId: auth.clientId,
250
+ clientSecret: auth.clientSecret,
251
+ scope: auth.scope,
252
+ audience: auth.audience
253
+ }
254
+ }, logger);
255
+ else throw new Error(`IDP type ${idp.type} not supported for client_credentials auth`);
256
+ throw new Error(`Auth method ${auth.method} not supported for programmatic access token`);
257
+ }
258
+ async _fetchToken() {
259
+ this.logger.debug("Fetching user auth token");
260
+ switch (this.config.method) {
261
+ case "static": return this.config.token;
262
+ case "self_signed": return SelfSignedTokenService.fetchToken(this.logger, this.config.credentials, this.config.issuer);
263
+ case "client_credentials": return clientCredentialsService(this.config.configUrl, this.logger).fetchToken(this.config.credentials);
264
+ }
265
+ }
266
+ /**
267
+ *
268
+ * @returns A valid JWT token retrieved according to the auth configuration given.
269
+ */
270
+ async getAccessToken() {
271
+ if (this.cachedToken && !jwtExpired(this.cachedToken)) return this.cachedToken;
272
+ else {
273
+ const newToken = await this._fetchToken();
274
+ if (jwtExpired(newToken)) throw new Error("Attempted to refresh a token, but it came back expired.");
275
+ this.cachedToken = newToken;
276
+ return newToken;
277
+ }
278
+ }
279
+ /**
280
+ *
281
+ * @returns An AuthContext containing a valid token and userId.
282
+ */
283
+ async getAuthContext() {
284
+ const accessToken = await this.getAccessToken();
285
+ const userId = jwtUserId(accessToken);
286
+ const email = jwtUserEmail(accessToken);
287
+ return {
288
+ accessToken,
289
+ userId,
290
+ ...email ? { email } : {}
291
+ };
292
+ }
282
293
  };
283
- var authorizationCodeAuthSchema = z.object({
284
- method: z.literal("authorization_code"),
285
- audience: z.string(),
286
- scope: z.string(),
287
- clientId: z.string()
288
- }).meta({
289
- description: "Authorization code flow authentication configuration. This is used for browser-based application login."
290
- });
291
- var clientCredentialsAuthSchema = z.object({
292
- method: z.literal("client_credentials"),
293
- audience: z.string(),
294
- scope: z.string(),
295
- clientId: z.string(),
296
- clientSecret: z.string()
294
+ //#endregion
295
+ //#region src/config/schema.ts
296
+ const authorizationCodeAuthSchema = z.object({
297
+ method: z.literal("authorization_code"),
298
+ audience: z.string(),
299
+ scope: z.string(),
300
+ clientId: z.string()
301
+ }).meta({ description: "Authorization code flow authentication configuration. This is used for browser-based application login." });
302
+ const clientCredentialsAuthSchema = z.object({
303
+ method: z.literal("client_credentials"),
304
+ audience: z.string(),
305
+ scope: z.string(),
306
+ clientId: z.string(),
307
+ clientSecret: z.string()
297
308
  });
298
- var selfSignedAuthSchema = z.object({
299
- method: z.literal("self_signed"),
300
- issuer: z.string(),
301
- audience: z.string(),
302
- scope: z.string(),
303
- clientId: z.string(),
304
- clientSecret: z.string()
309
+ const selfSignedAuthSchema = z.object({
310
+ method: z.literal("self_signed"),
311
+ issuer: z.string(),
312
+ audience: z.string(),
313
+ scope: z.string(),
314
+ clientId: z.string(),
315
+ clientSecret: z.string()
305
316
  });
306
- var clientCredentialsEnvAuthSchema = z.object({
307
- method: z.literal("client_credentials"),
308
- audience: z.string(),
309
- scope: z.string(),
310
- clientId: z.string(),
311
- clientSecretEnv: z.string()
317
+ const clientCredentialsEnvAuthSchema = z.object({
318
+ method: z.literal("client_credentials"),
319
+ audience: z.string(),
320
+ scope: z.string(),
321
+ clientId: z.string(),
322
+ clientSecretEnv: z.string()
312
323
  });
313
- var selfSignedEnvAuthSchema = z.object({
314
- method: z.literal("self_signed"),
315
- issuer: z.string(),
316
- audience: z.string(),
317
- scope: z.string(),
318
- clientId: z.string(),
319
- clientSecretEnv: z.string()
324
+ const selfSignedEnvAuthSchema = z.object({
325
+ method: z.literal("self_signed"),
326
+ issuer: z.string(),
327
+ audience: z.string(),
328
+ scope: z.string(),
329
+ clientId: z.string(),
330
+ clientSecretEnv: z.string()
320
331
  });
321
- var authSchema = z.discriminatedUnion("method", [
322
- authorizationCodeAuthSchema,
323
- clientCredentialsAuthSchema,
324
- selfSignedAuthSchema
332
+ const authSchema = z.discriminatedUnion("method", [
333
+ authorizationCodeAuthSchema,
334
+ clientCredentialsAuthSchema,
335
+ selfSignedAuthSchema
325
336
  ]);
326
- var authFromEnvSchema = z.discriminatedUnion("method", [
327
- authorizationCodeAuthSchema,
328
- clientCredentialsEnvAuthSchema,
329
- selfSignedEnvAuthSchema
337
+ const authFromEnvSchema = z.discriminatedUnion("method", [
338
+ authorizationCodeAuthSchema,
339
+ clientCredentialsEnvAuthSchema,
340
+ selfSignedEnvAuthSchema
330
341
  ]);
331
- var idpSchema = z.discriminatedUnion("type", [
332
- z.object({
333
- id: z.string(),
334
- type: z.literal("self_signed"),
335
- issuer: z.string()
336
- }),
337
- z.object({
338
- id: z.string(),
339
- type: z.literal("oauth"),
340
- issuer: z.string(),
341
- configUrl: z.string().url()
342
- })
343
- ]);
344
-
342
+ const idpSchema = z.discriminatedUnion("type", [z.object({
343
+ id: z.string(),
344
+ type: z.literal("self_signed"),
345
+ issuer: z.string()
346
+ }), z.object({
347
+ id: z.string(),
348
+ type: z.literal("oauth"),
349
+ issuer: z.string(),
350
+ configUrl: z.string().url()
351
+ })]);
352
+ //#endregion
345
353
  export { AuthTokenProvider, ClientCredentialsService, assertConnected, authFromEnvSchema, authSchema, clientCredentialsService, fetchOidcUserInfo, idpSchema, jwtExpired, jwtUserEmail, jwtUserId, resolveUserEmail };
346
- //# sourceMappingURL=index.js.map
354
+
347
355
  //# sourceMappingURL=index.js.map