@genation/sdk 0.2.9 → 0.2.10

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,51 +1,51 @@
1
- class m extends Error {
1
+ class N extends Error {
2
2
  code;
3
3
  cause;
4
- constructor(e, t, s) {
5
- super(e), this.name = "GenationError", this.code = t, this.cause = s;
4
+ constructor(e, r, n) {
5
+ super(e), this.name = "GenationError", this.code = r, this.cause = n;
6
6
  }
7
7
  }
8
- class l extends m {
9
- constructor(e, t, s) {
10
- super(e, t, s), this.name = "AuthError";
8
+ class g extends N {
9
+ constructor(e, r, n) {
10
+ super(e, r, n), this.name = "AuthError";
11
11
  }
12
12
  static invalidGrant(e = "Invalid authorization code or refresh token") {
13
- return new l(e, "invalid_grant");
13
+ return new g(e, "invalid_grant");
14
14
  }
15
15
  static accessDenied(e = "User denied access") {
16
- return new l(e, "access_denied");
16
+ return new g(e, "access_denied");
17
17
  }
18
18
  static expiredToken(e = "Token has expired") {
19
- return new l(e, "expired_token");
19
+ return new g(e, "expired_token");
20
20
  }
21
21
  static invalidState(e = "State mismatch, possible CSRF attack") {
22
- return new l(e, "invalid_state");
22
+ return new g(e, "invalid_state");
23
23
  }
24
24
  static pkceVerificationFailed(e = "PKCE verification failed") {
25
- return new l(e, "pkce_verification_failed");
25
+ return new g(e, "pkce_verification_failed");
26
26
  }
27
27
  }
28
- class h extends m {
28
+ class S extends N {
29
29
  status;
30
- constructor(e, t, s) {
31
- super(e, "network_error", s), this.name = "NetworkError", this.status = t;
30
+ constructor(e, r, n) {
31
+ super(e, "network_error", n), this.name = "NetworkError", this.status = r;
32
32
  }
33
33
  static fromResponse(e) {
34
- return new h(
34
+ return new S(
35
35
  `HTTP ${e.status}: ${e.statusText}`,
36
36
  e.status
37
37
  );
38
38
  }
39
39
  }
40
- class u extends m {
40
+ class v extends N {
41
41
  constructor(e) {
42
42
  super(e, "config_error"), this.name = "ConfigError";
43
43
  }
44
44
  static missingField(e) {
45
- return new u(`Missing required config field: ${e}`);
45
+ return new v(`Missing required config field: ${e}`);
46
46
  }
47
47
  }
48
- class p {
48
+ class D {
49
49
  baseUrl;
50
50
  timeout;
51
51
  constructor(e) {
@@ -54,79 +54,79 @@ class p {
54
54
  /**
55
55
  * Make an HTTP request
56
56
  */
57
- async request(e, t = {}) {
58
- const { method: s = "GET", headers: n = {}, body: i, params: c } = t;
59
- let a = `${this.baseUrl}${e}`;
60
- if (c) {
61
- const o = new URLSearchParams(c);
62
- a += `?${o.toString()}`;
63
- }
64
- const y = new AbortController(), S = setTimeout(() => y.abort(), this.timeout);
57
+ async request(e, r = {}) {
58
+ const { method: n = "GET", headers: s = {}, body: a, params: i } = r;
59
+ let c = `${this.baseUrl}${e}`;
60
+ if (i) {
61
+ const o = new URLSearchParams(i);
62
+ c += `?${o.toString()}`;
63
+ }
64
+ const u = new AbortController(), h = setTimeout(() => u.abort(), this.timeout);
65
65
  try {
66
- const o = await fetch(a, {
67
- method: s,
66
+ const o = await fetch(c, {
67
+ method: n,
68
68
  headers: {
69
69
  "Content-Type": "application/json",
70
- ...n
70
+ ...s
71
71
  },
72
- body: i ? JSON.stringify(i) : void 0,
73
- signal: y.signal
72
+ body: a ? JSON.stringify(a) : void 0,
73
+ signal: u.signal
74
74
  });
75
- if (clearTimeout(S), !o.ok)
76
- throw h.fromResponse(o);
75
+ if (clearTimeout(h), !o.ok)
76
+ throw S.fromResponse(o);
77
77
  return await o.json();
78
78
  } catch (o) {
79
- throw clearTimeout(S), o instanceof h ? o : o instanceof Error && o.name === "AbortError" ? new h("Request timeout", void 0, o) : new h("Network request failed", void 0, o);
79
+ throw clearTimeout(h), o instanceof S ? o : o instanceof Error && o.name === "AbortError" ? new S("Request timeout", void 0, o) : new S("Network request failed", void 0, o);
80
80
  }
81
81
  }
82
82
  /**
83
83
  * POST request with form data (for OAuth token exchange)
84
84
  */
85
- async postForm(e, t, s = {}) {
86
- const n = `${this.baseUrl}${e}`, i = new AbortController(), c = setTimeout(() => i.abort(), this.timeout);
85
+ async postForm(e, r, n = {}) {
86
+ const s = `${this.baseUrl}${e}`, a = new AbortController(), i = setTimeout(() => a.abort(), this.timeout);
87
87
  try {
88
- const a = await fetch(n, {
88
+ const c = await fetch(s, {
89
89
  method: "POST",
90
90
  headers: {
91
91
  "Content-Type": "application/x-www-form-urlencoded",
92
- ...s
92
+ ...n
93
93
  },
94
- body: new URLSearchParams(t).toString(),
95
- signal: i.signal
94
+ body: new URLSearchParams(r).toString(),
95
+ signal: a.signal
96
96
  });
97
- if (clearTimeout(c), !a.ok)
98
- throw h.fromResponse(a);
99
- return await a.json();
100
- } catch (a) {
101
- throw clearTimeout(c), a instanceof h ? a : new h("Network request failed", void 0, a);
97
+ if (clearTimeout(i), !c.ok)
98
+ throw S.fromResponse(c);
99
+ return await c.json();
100
+ } catch (c) {
101
+ throw clearTimeout(i), c instanceof S ? c : new S("Network request failed", void 0, c);
102
102
  }
103
103
  }
104
104
  }
105
- function k(r) {
106
- return btoa(String.fromCharCode(...r)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
105
+ function $(t) {
106
+ return btoa(String.fromCharCode(...t)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
107
107
  }
108
- function _() {
109
- const r = new Uint8Array(32);
110
- return crypto.getRandomValues(r), k(r);
108
+ function he() {
109
+ const t = new Uint8Array(32);
110
+ return crypto.getRandomValues(t), $(t);
111
111
  }
112
- async function b(r) {
113
- const t = new TextEncoder().encode(r), s = await crypto.subtle.digest("SHA-256", t);
114
- return k(new Uint8Array(s));
112
+ async function ue(t) {
113
+ const r = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", r);
114
+ return $(new Uint8Array(n));
115
115
  }
116
- async function v() {
117
- const r = _(), e = await b(r);
116
+ async function fe() {
117
+ const t = he(), e = await ue(t);
118
118
  return {
119
- codeVerifier: r,
119
+ codeVerifier: t,
120
120
  codeChallenge: e,
121
121
  codeChallengeMethod: "S256"
122
122
  };
123
123
  }
124
- function C() {
125
- const r = new Uint8Array(16);
126
- return crypto.getRandomValues(r), k(r);
124
+ function de() {
125
+ const t = new Uint8Array(16);
126
+ return crypto.getRandomValues(t), $(t);
127
127
  }
128
- const d = "tokens", g = "pkce", f = "state";
129
- class I {
128
+ const W = "tokens", k = "pkce", I = "state";
129
+ class le {
130
130
  storage;
131
131
  constructor(e) {
132
132
  this.storage = e;
@@ -135,13 +135,13 @@ class I {
135
135
  * Store token set
136
136
  */
137
137
  async setTokens(e) {
138
- await this.storage.set(d, JSON.stringify(e));
138
+ await this.storage.set(W, JSON.stringify(e));
139
139
  }
140
140
  /**
141
141
  * Get stored tokens
142
142
  */
143
143
  async getTokens() {
144
- const e = await this.storage.get(d);
144
+ const e = await this.storage.get(W);
145
145
  if (!e) return null;
146
146
  try {
147
147
  return JSON.parse(e);
@@ -153,7 +153,7 @@ class I {
153
153
  * Clear stored tokens
154
154
  */
155
155
  async clearTokens() {
156
- await this.storage.remove(d);
156
+ await this.storage.remove(W);
157
157
  }
158
158
  /**
159
159
  * Check if access token is expired
@@ -161,34 +161,34 @@ class I {
161
161
  async isTokenExpired() {
162
162
  const e = await this.getTokens();
163
163
  if (!e) return !0;
164
- const t = e.issuedAt + e.expiresIn * 1e3;
165
- return Date.now() > t - 6e4;
164
+ const r = e.issuedAt + e.expiresIn * 1e3;
165
+ return Date.now() > r - 6e4;
166
166
  }
167
167
  /**
168
168
  * Store PKCE verifier for later validation
169
169
  */
170
170
  async setPKCE(e) {
171
- await this.storage.set(g, e);
171
+ await this.storage.set(k, e);
172
172
  }
173
173
  /**
174
174
  * Get and clear stored PKCE verifier
175
175
  */
176
176
  async consumePKCE() {
177
- const e = await this.storage.get(g);
178
- return e && await this.storage.remove(g), e;
177
+ const e = await this.storage.get(k);
178
+ return e && await this.storage.remove(k), e;
179
179
  }
180
180
  /**
181
181
  * Store state for CSRF validation
182
182
  */
183
183
  async setState(e) {
184
- await this.storage.set(f, e);
184
+ await this.storage.set(I, e);
185
185
  }
186
186
  /**
187
187
  * Get and clear stored state
188
188
  */
189
189
  async consumeState() {
190
- const e = await this.storage.get(f);
191
- return e && await this.storage.remove(f), e;
190
+ const e = await this.storage.get(I);
191
+ return e && await this.storage.remove(I), e;
192
192
  }
193
193
  /**
194
194
  * Clear all auth-related data
@@ -197,48 +197,48 @@ class I {
197
197
  await this.storage.clear();
198
198
  }
199
199
  }
200
- const U = "https://mnnoheowoowbtpuoguul.supabase.co/auth/v1";
201
- class x {
200
+ const pe = "https://mnnoheowoowbtpuoguul.supabase.co/auth/v1";
201
+ class ye {
202
202
  config;
203
203
  http;
204
204
  tokenManager;
205
- constructor(e, t) {
205
+ constructor(e, r) {
206
206
  this.config = {
207
207
  clientId: e.clientId,
208
208
  clientSecret: e.clientSecret,
209
209
  redirectUri: e.redirectUri,
210
210
  scopes: e.scopes,
211
- authUrl: e.authUrl ?? U
212
- }, this.http = new p({ baseUrl: this.config.authUrl }), this.tokenManager = t;
211
+ authUrl: e.authUrl ?? pe
212
+ }, this.http = new D({ baseUrl: this.config.authUrl }), this.tokenManager = r;
213
213
  }
214
214
  /**
215
215
  * Generate authorization URL for OAuth flow
216
216
  * Stores PKCE verifier and state for later validation
217
217
  */
218
218
  async getAuthorizationUrl() {
219
- const e = await v(), t = C();
220
- await this.tokenManager.setPKCE(e.codeVerifier), await this.tokenManager.setState(t);
221
- const s = new URLSearchParams({
219
+ const e = await fe(), r = de();
220
+ await this.tokenManager.setPKCE(e.codeVerifier), await this.tokenManager.setState(r);
221
+ const n = new URLSearchParams({
222
222
  response_type: "code",
223
223
  client_id: this.config.clientId,
224
224
  redirect_uri: this.config.redirectUri,
225
- state: t,
225
+ state: r,
226
226
  code_challenge: e.codeChallenge,
227
227
  code_challenge_method: e.codeChallengeMethod
228
228
  });
229
- return this.config.scopes && this.config.scopes.length > 0 && s.append("scope", this.config.scopes.join(" ")), `${this.config.authUrl}/oauth/authorize?${s.toString()}`;
229
+ return this.config.scopes && this.config.scopes.length > 0 && n.append("scope", this.config.scopes.join(" ")), `${this.config.authUrl}/oauth/authorize?${n.toString()}`;
230
230
  }
231
231
  /**
232
232
  * Exchange authorization code for tokens
233
233
  */
234
- async exchangeCode(e, t) {
235
- const s = await this.tokenManager.consumeState();
236
- if (!s || s !== t)
237
- throw l.invalidState();
238
- const n = await this.tokenManager.consumePKCE();
239
- if (!n)
240
- throw l.pkceVerificationFailed("Missing code verifier");
241
- const i = await this.http.postForm(
234
+ async exchangeCode(e, r) {
235
+ const n = await this.tokenManager.consumeState();
236
+ if (!n || n !== r)
237
+ throw g.invalidState();
238
+ const s = await this.tokenManager.consumePKCE();
239
+ if (!s)
240
+ throw g.pkceVerificationFailed("Missing code verifier");
241
+ const a = await this.http.postForm(
242
242
  "/oauth/token",
243
243
  {
244
244
  grant_type: "authorization_code",
@@ -246,10 +246,10 @@ class x {
246
246
  redirect_uri: this.config.redirectUri,
247
247
  client_id: this.config.clientId,
248
248
  client_secret: this.config.clientSecret,
249
- code_verifier: n
249
+ code_verifier: s
250
250
  }
251
- ), c = this.mapTokenResponse(i);
252
- return await this.tokenManager.setTokens(c), c;
251
+ ), i = this.mapTokenResponse(a);
252
+ return await this.tokenManager.setTokens(i), i;
253
253
  }
254
254
  /**
255
255
  * Refresh access token using refresh token
@@ -257,8 +257,8 @@ class x {
257
257
  async refreshToken() {
258
258
  const e = await this.tokenManager.getTokens();
259
259
  if (!e?.refreshToken)
260
- throw l.invalidGrant("No refresh token available");
261
- const t = await this.http.postForm(
260
+ throw g.invalidGrant("No refresh token available");
261
+ const r = await this.http.postForm(
262
262
  "/oauth/token",
263
263
  {
264
264
  grant_type: "refresh_token",
@@ -266,8 +266,8 @@ class x {
266
266
  client_id: this.config.clientId,
267
267
  client_secret: this.config.clientSecret
268
268
  }
269
- ), s = this.mapTokenResponse(t);
270
- return await this.tokenManager.setTokens(s), s;
269
+ ), n = this.mapTokenResponse(r);
270
+ return await this.tokenManager.setTokens(n), n;
271
271
  }
272
272
  /**
273
273
  * Revoke current tokens
@@ -299,13 +299,1059 @@ class x {
299
299
  };
300
300
  }
301
301
  }
302
- class E {
302
+ const G = new TextEncoder(), _ = new TextDecoder();
303
+ function me(...t) {
304
+ const e = t.reduce((s, { length: a }) => s + a, 0), r = new Uint8Array(e);
305
+ let n = 0;
306
+ for (const s of t)
307
+ r.set(s, n), n += s.length;
308
+ return r;
309
+ }
310
+ function J(t) {
311
+ const e = new Uint8Array(t.length);
312
+ for (let r = 0; r < t.length; r++) {
313
+ const n = t.charCodeAt(r);
314
+ if (n > 127)
315
+ throw new TypeError("non-ASCII string encountered in encode()");
316
+ e[r] = n;
317
+ }
318
+ return e;
319
+ }
320
+ function we(t) {
321
+ if (Uint8Array.fromBase64)
322
+ return Uint8Array.fromBase64(t);
323
+ const e = atob(t), r = new Uint8Array(e.length);
324
+ for (let n = 0; n < e.length; n++)
325
+ r[n] = e.charCodeAt(n);
326
+ return r;
327
+ }
328
+ function C(t) {
329
+ if (Uint8Array.fromBase64)
330
+ return Uint8Array.fromBase64(typeof t == "string" ? t : _.decode(t), {
331
+ alphabet: "base64url"
332
+ });
333
+ let e = t;
334
+ e instanceof Uint8Array && (e = _.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/");
335
+ try {
336
+ return we(e);
337
+ } catch {
338
+ throw new TypeError("The input to be decoded is not correctly encoded.");
339
+ }
340
+ }
341
+ class l extends Error {
342
+ static code = "ERR_JOSE_GENERIC";
343
+ code = "ERR_JOSE_GENERIC";
344
+ constructor(e, r) {
345
+ super(e, r), this.name = this.constructor.name, Error.captureStackTrace?.(this, this.constructor);
346
+ }
347
+ }
348
+ class y extends l {
349
+ static code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
350
+ code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
351
+ claim;
352
+ reason;
353
+ payload;
354
+ constructor(e, r, n = "unspecified", s = "unspecified") {
355
+ super(e, { cause: { claim: n, reason: s, payload: r } }), this.claim = n, this.reason = s, this.payload = r;
356
+ }
357
+ }
358
+ class z extends l {
359
+ static code = "ERR_JWT_EXPIRED";
360
+ code = "ERR_JWT_EXPIRED";
361
+ claim;
362
+ reason;
363
+ payload;
364
+ constructor(e, r, n = "unspecified", s = "unspecified") {
365
+ super(e, { cause: { claim: n, reason: s, payload: r } }), this.claim = n, this.reason = s, this.payload = r;
366
+ }
367
+ }
368
+ class w extends l {
369
+ static code = "ERR_JOSE_NOT_SUPPORTED";
370
+ code = "ERR_JOSE_NOT_SUPPORTED";
371
+ }
372
+ class f extends l {
373
+ static code = "ERR_JWS_INVALID";
374
+ code = "ERR_JWS_INVALID";
375
+ }
376
+ class j extends l {
377
+ static code = "ERR_JWT_INVALID";
378
+ code = "ERR_JWT_INVALID";
379
+ }
380
+ class ee extends l {
381
+ static code = "ERR_JWKS_INVALID";
382
+ code = "ERR_JWKS_INVALID";
383
+ }
384
+ class te extends l {
385
+ static code = "ERR_JWKS_NO_MATCHING_KEY";
386
+ code = "ERR_JWKS_NO_MATCHING_KEY";
387
+ constructor(e = "no applicable key found in the JSON Web Key Set", r) {
388
+ super(e, r);
389
+ }
390
+ }
391
+ class Se extends l {
392
+ [Symbol.asyncIterator];
393
+ static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
394
+ code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
395
+ constructor(e = "multiple matching keys found in the JSON Web Key Set", r) {
396
+ super(e, r);
397
+ }
398
+ }
399
+ class ge extends l {
400
+ static code = "ERR_JWKS_TIMEOUT";
401
+ code = "ERR_JWKS_TIMEOUT";
402
+ constructor(e = "request timed out", r) {
403
+ super(e, r);
404
+ }
405
+ }
406
+ class be extends l {
407
+ static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
408
+ code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
409
+ constructor(e = "signature verification failed", r) {
410
+ super(e, r);
411
+ }
412
+ }
413
+ const m = (t, e = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`), A = (t, e) => t.name === e;
414
+ function U(t) {
415
+ return parseInt(t.name.slice(4), 10);
416
+ }
417
+ function Ee(t) {
418
+ switch (t) {
419
+ case "ES256":
420
+ return "P-256";
421
+ case "ES384":
422
+ return "P-384";
423
+ case "ES512":
424
+ return "P-521";
425
+ default:
426
+ throw new Error("unreachable");
427
+ }
428
+ }
429
+ function Ae(t, e) {
430
+ if (!t.usages.includes(e))
431
+ throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`);
432
+ }
433
+ function Ke(t, e, r) {
434
+ switch (e) {
435
+ case "HS256":
436
+ case "HS384":
437
+ case "HS512": {
438
+ if (!A(t.algorithm, "HMAC"))
439
+ throw m("HMAC");
440
+ const n = parseInt(e.slice(2), 10);
441
+ if (U(t.algorithm.hash) !== n)
442
+ throw m(`SHA-${n}`, "algorithm.hash");
443
+ break;
444
+ }
445
+ case "RS256":
446
+ case "RS384":
447
+ case "RS512": {
448
+ if (!A(t.algorithm, "RSASSA-PKCS1-v1_5"))
449
+ throw m("RSASSA-PKCS1-v1_5");
450
+ const n = parseInt(e.slice(2), 10);
451
+ if (U(t.algorithm.hash) !== n)
452
+ throw m(`SHA-${n}`, "algorithm.hash");
453
+ break;
454
+ }
455
+ case "PS256":
456
+ case "PS384":
457
+ case "PS512": {
458
+ if (!A(t.algorithm, "RSA-PSS"))
459
+ throw m("RSA-PSS");
460
+ const n = parseInt(e.slice(2), 10);
461
+ if (U(t.algorithm.hash) !== n)
462
+ throw m(`SHA-${n}`, "algorithm.hash");
463
+ break;
464
+ }
465
+ case "Ed25519":
466
+ case "EdDSA": {
467
+ if (!A(t.algorithm, "Ed25519"))
468
+ throw m("Ed25519");
469
+ break;
470
+ }
471
+ case "ML-DSA-44":
472
+ case "ML-DSA-65":
473
+ case "ML-DSA-87": {
474
+ if (!A(t.algorithm, e))
475
+ throw m(e);
476
+ break;
477
+ }
478
+ case "ES256":
479
+ case "ES384":
480
+ case "ES512": {
481
+ if (!A(t.algorithm, "ECDSA"))
482
+ throw m("ECDSA");
483
+ const n = Ee(e);
484
+ if (t.algorithm.namedCurve !== n)
485
+ throw m(n, "algorithm.namedCurve");
486
+ break;
487
+ }
488
+ default:
489
+ throw new TypeError("CryptoKey does not support this operation");
490
+ }
491
+ Ae(t, r);
492
+ }
493
+ function re(t, e, ...r) {
494
+ if (r = r.filter(Boolean), r.length > 2) {
495
+ const n = r.pop();
496
+ t += `one of type ${r.join(", ")}, or ${n}.`;
497
+ } else r.length === 2 ? t += `one of type ${r[0]} or ${r[1]}.` : t += `of type ${r[0]}.`;
498
+ return e == null ? t += ` Received ${e}` : typeof e == "function" && e.name ? t += ` Received function ${e.name}` : typeof e == "object" && e != null && e.constructor?.name && (t += ` Received an instance of ${e.constructor.name}`), t;
499
+ }
500
+ const Te = (t, ...e) => re("Key must be ", t, ...e), ne = (t, e, ...r) => re(`Key for the ${t} algorithm must be `, e, ...r), se = (t) => {
501
+ if (t?.[Symbol.toStringTag] === "CryptoKey")
502
+ return !0;
503
+ try {
504
+ return t instanceof CryptoKey;
505
+ } catch {
506
+ return !1;
507
+ }
508
+ }, ae = (t) => t?.[Symbol.toStringTag] === "KeyObject", ie = (t) => se(t) || ae(t);
509
+ function ve(...t) {
510
+ const e = t.filter(Boolean);
511
+ if (e.length === 0 || e.length === 1)
512
+ return !0;
513
+ let r;
514
+ for (const n of e) {
515
+ const s = Object.keys(n);
516
+ if (!r || r.size === 0) {
517
+ r = new Set(s);
518
+ continue;
519
+ }
520
+ for (const a of s) {
521
+ if (r.has(a))
522
+ return !1;
523
+ r.add(a);
524
+ }
525
+ }
526
+ return !0;
527
+ }
528
+ const Ce = (t) => typeof t == "object" && t !== null;
529
+ function E(t) {
530
+ if (!Ce(t) || Object.prototype.toString.call(t) !== "[object Object]")
531
+ return !1;
532
+ if (Object.getPrototypeOf(t) === null)
533
+ return !0;
534
+ let e = t;
535
+ for (; Object.getPrototypeOf(e) !== null; )
536
+ e = Object.getPrototypeOf(e);
537
+ return Object.getPrototypeOf(t) === e;
538
+ }
539
+ function _e(t, e) {
540
+ if (t.startsWith("RS") || t.startsWith("PS")) {
541
+ const { modulusLength: r } = e.algorithm;
542
+ if (typeof r != "number" || r < 2048)
543
+ throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`);
544
+ }
545
+ }
546
+ function Re(t) {
547
+ let e, r;
548
+ switch (t.kty) {
549
+ case "AKP": {
550
+ switch (t.alg) {
551
+ case "ML-DSA-44":
552
+ case "ML-DSA-65":
553
+ case "ML-DSA-87":
554
+ e = { name: t.alg }, r = t.priv ? ["sign"] : ["verify"];
555
+ break;
556
+ default:
557
+ throw new w('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
558
+ }
559
+ break;
560
+ }
561
+ case "RSA": {
562
+ switch (t.alg) {
563
+ case "PS256":
564
+ case "PS384":
565
+ case "PS512":
566
+ e = { name: "RSA-PSS", hash: `SHA-${t.alg.slice(-3)}` }, r = t.d ? ["sign"] : ["verify"];
567
+ break;
568
+ case "RS256":
569
+ case "RS384":
570
+ case "RS512":
571
+ e = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${t.alg.slice(-3)}` }, r = t.d ? ["sign"] : ["verify"];
572
+ break;
573
+ case "RSA-OAEP":
574
+ case "RSA-OAEP-256":
575
+ case "RSA-OAEP-384":
576
+ case "RSA-OAEP-512":
577
+ e = {
578
+ name: "RSA-OAEP",
579
+ hash: `SHA-${parseInt(t.alg.slice(-3), 10) || 1}`
580
+ }, r = t.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
581
+ break;
582
+ default:
583
+ throw new w('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
584
+ }
585
+ break;
586
+ }
587
+ case "EC": {
588
+ switch (t.alg) {
589
+ case "ES256":
590
+ e = { name: "ECDSA", namedCurve: "P-256" }, r = t.d ? ["sign"] : ["verify"];
591
+ break;
592
+ case "ES384":
593
+ e = { name: "ECDSA", namedCurve: "P-384" }, r = t.d ? ["sign"] : ["verify"];
594
+ break;
595
+ case "ES512":
596
+ e = { name: "ECDSA", namedCurve: "P-521" }, r = t.d ? ["sign"] : ["verify"];
597
+ break;
598
+ case "ECDH-ES":
599
+ case "ECDH-ES+A128KW":
600
+ case "ECDH-ES+A192KW":
601
+ case "ECDH-ES+A256KW":
602
+ e = { name: "ECDH", namedCurve: t.crv }, r = t.d ? ["deriveBits"] : [];
603
+ break;
604
+ default:
605
+ throw new w('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
606
+ }
607
+ break;
608
+ }
609
+ case "OKP": {
610
+ switch (t.alg) {
611
+ case "Ed25519":
612
+ case "EdDSA":
613
+ e = { name: "Ed25519" }, r = t.d ? ["sign"] : ["verify"];
614
+ break;
615
+ case "ECDH-ES":
616
+ case "ECDH-ES+A128KW":
617
+ case "ECDH-ES+A192KW":
618
+ case "ECDH-ES+A256KW":
619
+ e = { name: t.crv }, r = t.d ? ["deriveBits"] : [];
620
+ break;
621
+ default:
622
+ throw new w('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
623
+ }
624
+ break;
625
+ }
626
+ default:
627
+ throw new w('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
628
+ }
629
+ return { algorithm: e, keyUsages: r };
630
+ }
631
+ async function R(t) {
632
+ if (!t.alg)
633
+ throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
634
+ const { algorithm: e, keyUsages: r } = Re(t), n = { ...t };
635
+ return n.kty !== "AKP" && delete n.alg, delete n.use, crypto.subtle.importKey("jwk", n, e, t.ext ?? !(t.d || t.priv), t.key_ops ?? r);
636
+ }
637
+ async function Pe(t, e, r) {
638
+ if (!E(t))
639
+ throw new TypeError("JWK must be an object");
640
+ let n;
641
+ switch (e ??= t.alg, n ??= t.ext, t.kty) {
642
+ case "oct":
643
+ if (typeof t.k != "string" || !t.k)
644
+ throw new TypeError('missing "k" (Key Value) Parameter value');
645
+ return C(t.k);
646
+ case "RSA":
647
+ if ("oth" in t && t.oth !== void 0)
648
+ throw new w('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
649
+ return R({ ...t, alg: e, ext: n });
650
+ case "AKP": {
651
+ if (typeof t.alg != "string" || !t.alg)
652
+ throw new TypeError('missing "alg" (Algorithm) Parameter value');
653
+ if (e !== void 0 && e !== t.alg)
654
+ throw new TypeError("JWK alg and alg option value mismatch");
655
+ return R({ ...t, ext: n });
656
+ }
657
+ case "EC":
658
+ case "OKP":
659
+ return R({ ...t, alg: e, ext: n });
660
+ default:
661
+ throw new w('Unsupported "kty" (Key Type) Parameter value');
662
+ }
663
+ }
664
+ function We(t, e, r, n, s) {
665
+ if (s.crit !== void 0 && n?.crit === void 0)
666
+ throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');
667
+ if (!n || n.crit === void 0)
668
+ return /* @__PURE__ */ new Set();
669
+ if (!Array.isArray(n.crit) || n.crit.length === 0 || n.crit.some((i) => typeof i != "string" || i.length === 0))
670
+ throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
671
+ let a;
672
+ a = e;
673
+ for (const i of n.crit) {
674
+ if (!a.has(i))
675
+ throw new w(`Extension Header Parameter "${i}" is not recognized`);
676
+ if (s[i] === void 0)
677
+ throw new t(`Extension Header Parameter "${i}" is missing`);
678
+ if (a.get(i) && n[i] === void 0)
679
+ throw new t(`Extension Header Parameter "${i}" MUST be integrity protected`);
680
+ }
681
+ return new Set(n.crit);
682
+ }
683
+ const L = (t) => E(t) && typeof t.kty == "string", ke = (t) => t.kty !== "oct" && (t.kty === "AKP" && typeof t.priv == "string" || typeof t.d == "string"), Ie = (t) => t.kty !== "oct" && t.d === void 0 && t.priv === void 0, Je = (t) => t.kty === "oct" && typeof t.k == "string";
684
+ let T;
685
+ const B = async (t, e, r, n = !1) => {
686
+ T ||= /* @__PURE__ */ new WeakMap();
687
+ let s = T.get(t);
688
+ if (s?.[r])
689
+ return s[r];
690
+ const a = await R({ ...e, alg: r });
691
+ return n && Object.freeze(t), s ? s[r] = a : T.set(t, { [r]: a }), a;
692
+ }, Ue = (t, e) => {
693
+ T ||= /* @__PURE__ */ new WeakMap();
694
+ let r = T.get(t);
695
+ if (r?.[e])
696
+ return r[e];
697
+ const n = t.type === "public", s = !!n;
698
+ let a;
699
+ if (t.asymmetricKeyType === "x25519") {
700
+ switch (e) {
701
+ case "ECDH-ES":
702
+ case "ECDH-ES+A128KW":
703
+ case "ECDH-ES+A192KW":
704
+ case "ECDH-ES+A256KW":
705
+ break;
706
+ default:
707
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
708
+ }
709
+ a = t.toCryptoKey(t.asymmetricKeyType, s, n ? [] : ["deriveBits"]);
710
+ }
711
+ if (t.asymmetricKeyType === "ed25519") {
712
+ if (e !== "EdDSA" && e !== "Ed25519")
713
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
714
+ a = t.toCryptoKey(t.asymmetricKeyType, s, [
715
+ n ? "verify" : "sign"
716
+ ]);
717
+ }
718
+ switch (t.asymmetricKeyType) {
719
+ case "ml-dsa-44":
720
+ case "ml-dsa-65":
721
+ case "ml-dsa-87": {
722
+ if (e !== t.asymmetricKeyType.toUpperCase())
723
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
724
+ a = t.toCryptoKey(t.asymmetricKeyType, s, [
725
+ n ? "verify" : "sign"
726
+ ]);
727
+ }
728
+ }
729
+ if (t.asymmetricKeyType === "rsa") {
730
+ let i;
731
+ switch (e) {
732
+ case "RSA-OAEP":
733
+ i = "SHA-1";
734
+ break;
735
+ case "RS256":
736
+ case "PS256":
737
+ case "RSA-OAEP-256":
738
+ i = "SHA-256";
739
+ break;
740
+ case "RS384":
741
+ case "PS384":
742
+ case "RSA-OAEP-384":
743
+ i = "SHA-384";
744
+ break;
745
+ case "RS512":
746
+ case "PS512":
747
+ case "RSA-OAEP-512":
748
+ i = "SHA-512";
749
+ break;
750
+ default:
751
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
752
+ }
753
+ if (e.startsWith("RSA-OAEP"))
754
+ return t.toCryptoKey({
755
+ name: "RSA-OAEP",
756
+ hash: i
757
+ }, s, n ? ["encrypt"] : ["decrypt"]);
758
+ a = t.toCryptoKey({
759
+ name: e.startsWith("PS") ? "RSA-PSS" : "RSASSA-PKCS1-v1_5",
760
+ hash: i
761
+ }, s, [n ? "verify" : "sign"]);
762
+ }
763
+ if (t.asymmetricKeyType === "ec") {
764
+ const c = (/* @__PURE__ */ new Map([
765
+ ["prime256v1", "P-256"],
766
+ ["secp384r1", "P-384"],
767
+ ["secp521r1", "P-521"]
768
+ ])).get(t.asymmetricKeyDetails?.namedCurve);
769
+ if (!c)
770
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
771
+ e === "ES256" && c === "P-256" && (a = t.toCryptoKey({
772
+ name: "ECDSA",
773
+ namedCurve: c
774
+ }, s, [n ? "verify" : "sign"])), e === "ES384" && c === "P-384" && (a = t.toCryptoKey({
775
+ name: "ECDSA",
776
+ namedCurve: c
777
+ }, s, [n ? "verify" : "sign"])), e === "ES512" && c === "P-521" && (a = t.toCryptoKey({
778
+ name: "ECDSA",
779
+ namedCurve: c
780
+ }, s, [n ? "verify" : "sign"])), e.startsWith("ECDH-ES") && (a = t.toCryptoKey({
781
+ name: "ECDH",
782
+ namedCurve: c
783
+ }, s, n ? [] : ["deriveBits"]));
784
+ }
785
+ if (!a)
786
+ throw new TypeError("given KeyObject instance cannot be used for this algorithm");
787
+ return r ? r[e] = a : T.set(t, { [e]: a }), a;
788
+ };
789
+ async function xe(t, e) {
790
+ if (t instanceof Uint8Array || se(t))
791
+ return t;
792
+ if (ae(t)) {
793
+ if (t.type === "secret")
794
+ return t.export();
795
+ if ("toCryptoKey" in t && typeof t.toCryptoKey == "function")
796
+ try {
797
+ return Ue(t, e);
798
+ } catch (n) {
799
+ if (n instanceof TypeError)
800
+ throw n;
801
+ }
802
+ let r = t.export({ format: "jwk" });
803
+ return B(t, r, e);
804
+ }
805
+ if (L(t))
806
+ return t.k ? C(t.k) : B(t, t, e, !0);
807
+ throw new Error("unreachable");
808
+ }
809
+ const K = (t) => t?.[Symbol.toStringTag], O = (t, e, r) => {
810
+ if (e.use !== void 0) {
811
+ let n;
812
+ switch (r) {
813
+ case "sign":
814
+ case "verify":
815
+ n = "sig";
816
+ break;
817
+ case "encrypt":
818
+ case "decrypt":
819
+ n = "enc";
820
+ break;
821
+ }
822
+ if (e.use !== n)
823
+ throw new TypeError(`Invalid key for this operation, its "use" must be "${n}" when present`);
824
+ }
825
+ if (e.alg !== void 0 && e.alg !== t)
826
+ throw new TypeError(`Invalid key for this operation, its "alg" must be "${t}" when present`);
827
+ if (Array.isArray(e.key_ops)) {
828
+ let n;
829
+ switch (!0) {
830
+ case r === "verify":
831
+ case t === "dir":
832
+ case t.includes("CBC-HS"):
833
+ n = r;
834
+ break;
835
+ case t.startsWith("PBES2"):
836
+ n = "deriveBits";
837
+ break;
838
+ case /^A\d{3}(?:GCM)?(?:KW)?$/.test(t):
839
+ !t.includes("GCM") && t.endsWith("KW") ? n = "unwrapKey" : n = r;
840
+ break;
841
+ case r === "encrypt":
842
+ n = "wrapKey";
843
+ break;
844
+ case r === "decrypt":
845
+ n = t.startsWith("RSA") ? "unwrapKey" : "deriveBits";
846
+ break;
847
+ }
848
+ if (n && e.key_ops?.includes?.(n) === !1)
849
+ throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${n}" when present`);
850
+ }
851
+ return !0;
852
+ }, De = (t, e, r) => {
853
+ if (!(e instanceof Uint8Array)) {
854
+ if (L(e)) {
855
+ if (Je(e) && O(t, e, r))
856
+ return;
857
+ throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present');
858
+ }
859
+ if (!ie(e))
860
+ throw new TypeError(ne(t, e, "CryptoKey", "KeyObject", "JSON Web Key", "Uint8Array"));
861
+ if (e.type !== "secret")
862
+ throw new TypeError(`${K(e)} instances for symmetric algorithms must be of type "secret"`);
863
+ }
864
+ }, Oe = (t, e, r) => {
865
+ if (L(e))
866
+ switch (r) {
867
+ case "decrypt":
868
+ case "sign":
869
+ if (ke(e) && O(t, e, r))
870
+ return;
871
+ throw new TypeError("JSON Web Key for this operation must be a private JWK");
872
+ case "encrypt":
873
+ case "verify":
874
+ if (Ie(e) && O(t, e, r))
875
+ return;
876
+ throw new TypeError("JSON Web Key for this operation must be a public JWK");
877
+ }
878
+ if (!ie(e))
879
+ throw new TypeError(ne(t, e, "CryptoKey", "KeyObject", "JSON Web Key"));
880
+ if (e.type === "secret")
881
+ throw new TypeError(`${K(e)} instances for asymmetric algorithms must not be of type "secret"`);
882
+ if (e.type === "public")
883
+ switch (r) {
884
+ case "sign":
885
+ throw new TypeError(`${K(e)} instances for asymmetric algorithm signing must be of type "private"`);
886
+ case "decrypt":
887
+ throw new TypeError(`${K(e)} instances for asymmetric algorithm decryption must be of type "private"`);
888
+ }
889
+ if (e.type === "private")
890
+ switch (r) {
891
+ case "verify":
892
+ throw new TypeError(`${K(e)} instances for asymmetric algorithm verifying must be of type "public"`);
893
+ case "encrypt":
894
+ throw new TypeError(`${K(e)} instances for asymmetric algorithm encryption must be of type "public"`);
895
+ }
896
+ };
897
+ function Me(t, e, r) {
898
+ switch (t.substring(0, 2)) {
899
+ case "A1":
900
+ case "A2":
901
+ case "di":
902
+ case "HS":
903
+ case "PB":
904
+ De(t, e, r);
905
+ break;
906
+ default:
907
+ Oe(t, e, r);
908
+ }
909
+ }
910
+ function He(t, e) {
911
+ const r = `SHA-${t.slice(-3)}`;
912
+ switch (t) {
913
+ case "HS256":
914
+ case "HS384":
915
+ case "HS512":
916
+ return { hash: r, name: "HMAC" };
917
+ case "PS256":
918
+ case "PS384":
919
+ case "PS512":
920
+ return { hash: r, name: "RSA-PSS", saltLength: parseInt(t.slice(-3), 10) >> 3 };
921
+ case "RS256":
922
+ case "RS384":
923
+ case "RS512":
924
+ return { hash: r, name: "RSASSA-PKCS1-v1_5" };
925
+ case "ES256":
926
+ case "ES384":
927
+ case "ES512":
928
+ return { hash: r, name: "ECDSA", namedCurve: e.namedCurve };
929
+ case "Ed25519":
930
+ case "EdDSA":
931
+ return { name: "Ed25519" };
932
+ case "ML-DSA-44":
933
+ case "ML-DSA-65":
934
+ case "ML-DSA-87":
935
+ return { name: t };
936
+ default:
937
+ throw new w(`alg ${t} is not supported either by JOSE or your javascript runtime`);
938
+ }
939
+ }
940
+ async function Ne(t, e, r) {
941
+ if (e instanceof Uint8Array) {
942
+ if (!t.startsWith("HS"))
943
+ throw new TypeError(Te(e, "CryptoKey", "KeyObject", "JSON Web Key"));
944
+ return crypto.subtle.importKey("raw", e, { hash: `SHA-${t.slice(-3)}`, name: "HMAC" }, !1, [r]);
945
+ }
946
+ return Ke(e, t, r), e;
947
+ }
948
+ async function $e(t, e, r, n) {
949
+ const s = await Ne(t, e, "verify");
950
+ _e(t, s);
951
+ const a = He(t, s.algorithm);
952
+ try {
953
+ return await crypto.subtle.verify(a, s, r, n);
954
+ } catch {
955
+ return !1;
956
+ }
957
+ }
958
+ async function Le(t, e, r) {
959
+ if (!E(t))
960
+ throw new f("Flattened JWS must be an object");
961
+ if (t.protected === void 0 && t.header === void 0)
962
+ throw new f('Flattened JWS must have either of the "protected" or "header" members');
963
+ if (t.protected !== void 0 && typeof t.protected != "string")
964
+ throw new f("JWS Protected Header incorrect type");
965
+ if (t.payload === void 0)
966
+ throw new f("JWS Payload missing");
967
+ if (typeof t.signature != "string")
968
+ throw new f("JWS Signature missing or incorrect type");
969
+ if (t.header !== void 0 && !E(t.header))
970
+ throw new f("JWS Unprotected Header incorrect type");
971
+ let n = {};
972
+ if (t.protected)
973
+ try {
974
+ const P = C(t.protected);
975
+ n = JSON.parse(_.decode(P));
976
+ } catch {
977
+ throw new f("JWS Protected Header is invalid");
978
+ }
979
+ if (!ve(n, t.header))
980
+ throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
981
+ const s = {
982
+ ...n,
983
+ ...t.header
984
+ }, a = We(f, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, n, s);
985
+ let i = !0;
986
+ if (a.has("b64") && (i = n.b64, typeof i != "boolean"))
987
+ throw new f('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
988
+ const { alg: c } = s;
989
+ if (typeof c != "string" || !c)
990
+ throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');
991
+ if (i) {
992
+ if (typeof t.payload != "string")
993
+ throw new f("JWS Payload must be a string");
994
+ } else if (typeof t.payload != "string" && !(t.payload instanceof Uint8Array))
995
+ throw new f("JWS Payload must be a string or an Uint8Array instance");
996
+ let u = !1;
997
+ typeof e == "function" && (e = await e(n, t), u = !0), Me(c, e, "verify");
998
+ const h = me(t.protected !== void 0 ? J(t.protected) : new Uint8Array(), J("."), typeof t.payload == "string" ? i ? J(t.payload) : G.encode(t.payload) : t.payload);
999
+ let o;
1000
+ try {
1001
+ o = C(t.signature);
1002
+ } catch {
1003
+ throw new f("Failed to base64url decode the signature");
1004
+ }
1005
+ const d = await xe(e, c);
1006
+ if (!await $e(c, d, o, h))
1007
+ throw new be();
1008
+ let b;
1009
+ if (i)
1010
+ try {
1011
+ b = C(t.payload);
1012
+ } catch {
1013
+ throw new f("Failed to base64url decode the payload");
1014
+ }
1015
+ else typeof t.payload == "string" ? b = G.encode(t.payload) : b = t.payload;
1016
+ const p = { payload: b };
1017
+ return t.protected !== void 0 && (p.protectedHeader = n), t.header !== void 0 && (p.unprotectedHeader = t.header), u ? { ...p, key: d } : p;
1018
+ }
1019
+ async function Fe(t, e, r) {
1020
+ if (t instanceof Uint8Array && (t = _.decode(t)), typeof t != "string")
1021
+ throw new f("Compact JWS must be a string or Uint8Array");
1022
+ const { 0: n, 1: s, 2: a, length: i } = t.split(".");
1023
+ if (i !== 3)
1024
+ throw new f("Invalid Compact JWS");
1025
+ const c = await Le({ payload: s, protected: n, signature: a }, e, r), u = { payload: c.payload, protectedHeader: c.protectedHeader };
1026
+ return typeof e == "function" ? { ...u, key: c.key } : u;
1027
+ }
1028
+ const Ve = (t) => Math.floor(t.getTime() / 1e3), oe = 60, ce = oe * 60, F = ce * 24, Ge = F * 7, ze = F * 365.25, Be = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
1029
+ function q(t) {
1030
+ const e = Be.exec(t);
1031
+ if (!e || e[4] && e[1])
1032
+ throw new TypeError("Invalid time period format");
1033
+ const r = parseFloat(e[2]), n = e[3].toLowerCase();
1034
+ let s;
1035
+ switch (n) {
1036
+ case "sec":
1037
+ case "secs":
1038
+ case "second":
1039
+ case "seconds":
1040
+ case "s":
1041
+ s = Math.round(r);
1042
+ break;
1043
+ case "minute":
1044
+ case "minutes":
1045
+ case "min":
1046
+ case "mins":
1047
+ case "m":
1048
+ s = Math.round(r * oe);
1049
+ break;
1050
+ case "hour":
1051
+ case "hours":
1052
+ case "hr":
1053
+ case "hrs":
1054
+ case "h":
1055
+ s = Math.round(r * ce);
1056
+ break;
1057
+ case "day":
1058
+ case "days":
1059
+ case "d":
1060
+ s = Math.round(r * F);
1061
+ break;
1062
+ case "week":
1063
+ case "weeks":
1064
+ case "w":
1065
+ s = Math.round(r * Ge);
1066
+ break;
1067
+ default:
1068
+ s = Math.round(r * ze);
1069
+ break;
1070
+ }
1071
+ return e[1] === "-" || e[4] === "ago" ? -s : s;
1072
+ }
1073
+ const Y = (t) => t.includes("/") ? t.toLowerCase() : `application/${t.toLowerCase()}`, qe = (t, e) => typeof t == "string" ? e.includes(t) : Array.isArray(t) ? e.some(Set.prototype.has.bind(new Set(t))) : !1;
1074
+ function Ye(t, e, r = {}) {
1075
+ let n;
1076
+ try {
1077
+ n = JSON.parse(_.decode(e));
1078
+ } catch {
1079
+ }
1080
+ if (!E(n))
1081
+ throw new j("JWT Claims Set must be a top-level JSON object");
1082
+ const { typ: s } = r;
1083
+ if (s && (typeof t.typ != "string" || Y(t.typ) !== Y(s)))
1084
+ throw new y('unexpected "typ" JWT header value', n, "typ", "check_failed");
1085
+ const { requiredClaims: a = [], issuer: i, subject: c, audience: u, maxTokenAge: h } = r, o = [...a];
1086
+ h !== void 0 && o.push("iat"), u !== void 0 && o.push("aud"), c !== void 0 && o.push("sub"), i !== void 0 && o.push("iss");
1087
+ for (const p of new Set(o.reverse()))
1088
+ if (!(p in n))
1089
+ throw new y(`missing required "${p}" claim`, n, p, "missing");
1090
+ if (i && !(Array.isArray(i) ? i : [i]).includes(n.iss))
1091
+ throw new y('unexpected "iss" claim value', n, "iss", "check_failed");
1092
+ if (c && n.sub !== c)
1093
+ throw new y('unexpected "sub" claim value', n, "sub", "check_failed");
1094
+ if (u && !qe(n.aud, typeof u == "string" ? [u] : u))
1095
+ throw new y('unexpected "aud" claim value', n, "aud", "check_failed");
1096
+ let d;
1097
+ switch (typeof r.clockTolerance) {
1098
+ case "string":
1099
+ d = q(r.clockTolerance);
1100
+ break;
1101
+ case "number":
1102
+ d = r.clockTolerance;
1103
+ break;
1104
+ case "undefined":
1105
+ d = 0;
1106
+ break;
1107
+ default:
1108
+ throw new TypeError("Invalid clockTolerance option type");
1109
+ }
1110
+ const { currentDate: V } = r, b = Ve(V || /* @__PURE__ */ new Date());
1111
+ if ((n.iat !== void 0 || h) && typeof n.iat != "number")
1112
+ throw new y('"iat" claim must be a number', n, "iat", "invalid");
1113
+ if (n.nbf !== void 0) {
1114
+ if (typeof n.nbf != "number")
1115
+ throw new y('"nbf" claim must be a number', n, "nbf", "invalid");
1116
+ if (n.nbf > b + d)
1117
+ throw new y('"nbf" claim timestamp check failed', n, "nbf", "check_failed");
1118
+ }
1119
+ if (n.exp !== void 0) {
1120
+ if (typeof n.exp != "number")
1121
+ throw new y('"exp" claim must be a number', n, "exp", "invalid");
1122
+ if (n.exp <= b - d)
1123
+ throw new z('"exp" claim timestamp check failed', n, "exp", "check_failed");
1124
+ }
1125
+ if (h) {
1126
+ const p = b - n.iat, P = typeof h == "number" ? h : q(h);
1127
+ if (p - d > P)
1128
+ throw new z('"iat" claim timestamp check failed (too far in the past)', n, "iat", "check_failed");
1129
+ if (p < 0 - d)
1130
+ throw new y('"iat" claim timestamp check failed (it should be in the past)', n, "iat", "check_failed");
1131
+ }
1132
+ return n;
1133
+ }
1134
+ async function Xe(t, e, r) {
1135
+ const n = await Fe(t, e, r);
1136
+ if (n.protectedHeader.crit?.includes("b64") && n.protectedHeader.b64 === !1)
1137
+ throw new j("JWTs MUST NOT use unencoded payload");
1138
+ const a = { payload: Ye(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
1139
+ return typeof e == "function" ? { ...a, key: n.key } : a;
1140
+ }
1141
+ function Qe(t) {
1142
+ switch (typeof t == "string" && t.slice(0, 2)) {
1143
+ case "RS":
1144
+ case "PS":
1145
+ return "RSA";
1146
+ case "ES":
1147
+ return "EC";
1148
+ case "Ed":
1149
+ return "OKP";
1150
+ case "ML":
1151
+ return "AKP";
1152
+ default:
1153
+ throw new w('Unsupported "alg" value for a JSON Web Key Set');
1154
+ }
1155
+ }
1156
+ function Ze(t) {
1157
+ return t && typeof t == "object" && Array.isArray(t.keys) && t.keys.every(je);
1158
+ }
1159
+ function je(t) {
1160
+ return E(t);
1161
+ }
1162
+ class et {
1163
+ #r;
1164
+ #i = /* @__PURE__ */ new WeakMap();
1165
+ constructor(e) {
1166
+ if (!Ze(e))
1167
+ throw new ee("JSON Web Key Set malformed");
1168
+ this.#r = structuredClone(e);
1169
+ }
1170
+ jwks() {
1171
+ return this.#r;
1172
+ }
1173
+ async getKey(e, r) {
1174
+ const { alg: n, kid: s } = { ...e, ...r?.header }, a = Qe(n), i = this.#r.keys.filter((h) => {
1175
+ let o = a === h.kty;
1176
+ if (o && typeof s == "string" && (o = s === h.kid), o && (typeof h.alg == "string" || a === "AKP") && (o = n === h.alg), o && typeof h.use == "string" && (o = h.use === "sig"), o && Array.isArray(h.key_ops) && (o = h.key_ops.includes("verify")), o)
1177
+ switch (n) {
1178
+ case "ES256":
1179
+ o = h.crv === "P-256";
1180
+ break;
1181
+ case "ES384":
1182
+ o = h.crv === "P-384";
1183
+ break;
1184
+ case "ES512":
1185
+ o = h.crv === "P-521";
1186
+ break;
1187
+ case "Ed25519":
1188
+ case "EdDSA":
1189
+ o = h.crv === "Ed25519";
1190
+ break;
1191
+ }
1192
+ return o;
1193
+ }), { 0: c, length: u } = i;
1194
+ if (u === 0)
1195
+ throw new te();
1196
+ if (u !== 1) {
1197
+ const h = new Se(), o = this.#i;
1198
+ throw h[Symbol.asyncIterator] = async function* () {
1199
+ for (const d of i)
1200
+ try {
1201
+ yield await X(o, d, n);
1202
+ } catch {
1203
+ }
1204
+ }, h;
1205
+ }
1206
+ return X(this.#i, c, n);
1207
+ }
1208
+ }
1209
+ async function X(t, e, r) {
1210
+ const n = t.get(e) || t.set(e, {}).get(e);
1211
+ if (n[r] === void 0) {
1212
+ const s = await Pe({ ...e, ext: !0 }, r);
1213
+ if (s instanceof Uint8Array || s.type !== "public")
1214
+ throw new ee("JSON Web Key Set members must be public keys");
1215
+ n[r] = s;
1216
+ }
1217
+ return n[r];
1218
+ }
1219
+ function Q(t) {
1220
+ const e = new et(t), r = async (n, s) => e.getKey(n, s);
1221
+ return Object.defineProperties(r, {
1222
+ jwks: {
1223
+ value: () => structuredClone(e.jwks()),
1224
+ enumerable: !1,
1225
+ configurable: !1,
1226
+ writable: !1
1227
+ }
1228
+ }), r;
1229
+ }
1230
+ function tt() {
1231
+ return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
1232
+ }
1233
+ let M;
1234
+ (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (M = "jose/v6.1.3");
1235
+ const rt = /* @__PURE__ */ Symbol();
1236
+ async function nt(t, e, r, n = fetch) {
1237
+ const s = await n(t, {
1238
+ method: "GET",
1239
+ signal: r,
1240
+ redirect: "manual",
1241
+ headers: e
1242
+ }).catch((a) => {
1243
+ throw a.name === "TimeoutError" ? new ge() : a;
1244
+ });
1245
+ if (s.status !== 200)
1246
+ throw new l("Expected 200 OK from the JSON Web Key Set HTTP response");
1247
+ try {
1248
+ return await s.json();
1249
+ } catch {
1250
+ throw new l("Failed to parse the JSON Web Key Set HTTP response as JSON");
1251
+ }
1252
+ }
1253
+ const x = /* @__PURE__ */ Symbol();
1254
+ function st(t, e) {
1255
+ return !(typeof t != "object" || t === null || !("uat" in t) || typeof t.uat != "number" || Date.now() - t.uat >= e || !("jwks" in t) || !E(t.jwks) || !Array.isArray(t.jwks.keys) || !Array.prototype.every.call(t.jwks.keys, E));
1256
+ }
1257
+ class at {
1258
+ #r;
1259
+ #i;
1260
+ #c;
1261
+ #o;
1262
+ #n;
1263
+ #e;
1264
+ #t;
1265
+ #h;
1266
+ #s;
1267
+ #a;
1268
+ constructor(e, r) {
1269
+ if (!(e instanceof URL))
1270
+ throw new TypeError("url must be an instance of URL");
1271
+ this.#r = new URL(e.href), this.#i = typeof r?.timeoutDuration == "number" ? r?.timeoutDuration : 5e3, this.#c = typeof r?.cooldownDuration == "number" ? r?.cooldownDuration : 3e4, this.#o = typeof r?.cacheMaxAge == "number" ? r?.cacheMaxAge : 6e5, this.#t = new Headers(r?.headers), M && !this.#t.has("User-Agent") && this.#t.set("User-Agent", M), this.#t.has("accept") || (this.#t.set("accept", "application/json"), this.#t.append("accept", "application/jwk-set+json")), this.#h = r?.[rt], r?.[x] !== void 0 && (this.#a = r?.[x], st(r?.[x], this.#o) && (this.#n = this.#a.uat, this.#s = Q(this.#a.jwks)));
1272
+ }
1273
+ pendingFetch() {
1274
+ return !!this.#e;
1275
+ }
1276
+ coolingDown() {
1277
+ return typeof this.#n == "number" ? Date.now() < this.#n + this.#c : !1;
1278
+ }
1279
+ fresh() {
1280
+ return typeof this.#n == "number" ? Date.now() < this.#n + this.#o : !1;
1281
+ }
1282
+ jwks() {
1283
+ return this.#s?.jwks();
1284
+ }
1285
+ async getKey(e, r) {
1286
+ (!this.#s || !this.fresh()) && await this.reload();
1287
+ try {
1288
+ return await this.#s(e, r);
1289
+ } catch (n) {
1290
+ if (n instanceof te && this.coolingDown() === !1)
1291
+ return await this.reload(), this.#s(e, r);
1292
+ throw n;
1293
+ }
1294
+ }
1295
+ async reload() {
1296
+ this.#e && tt() && (this.#e = void 0), this.#e ||= nt(this.#r.href, this.#t, AbortSignal.timeout(this.#i), this.#h).then((e) => {
1297
+ this.#s = Q(e), this.#a && (this.#a.uat = Date.now(), this.#a.jwks = e), this.#n = Date.now(), this.#e = void 0;
1298
+ }).catch((e) => {
1299
+ throw this.#e = void 0, e;
1300
+ }), await this.#e;
1301
+ }
1302
+ }
1303
+ function it(t, e) {
1304
+ const r = new at(t, e), n = async (s, a) => r.getKey(s, a);
1305
+ return Object.defineProperties(n, {
1306
+ coolingDown: {
1307
+ get: () => r.coolingDown(),
1308
+ enumerable: !0,
1309
+ configurable: !1
1310
+ },
1311
+ fresh: {
1312
+ get: () => r.fresh(),
1313
+ enumerable: !0,
1314
+ configurable: !1
1315
+ },
1316
+ reload: {
1317
+ value: () => r.reload(),
1318
+ enumerable: !0,
1319
+ configurable: !1,
1320
+ writable: !1
1321
+ },
1322
+ reloading: {
1323
+ get: () => r.pendingFetch(),
1324
+ enumerable: !0,
1325
+ configurable: !1
1326
+ },
1327
+ jwks: {
1328
+ value: () => r.jwks(),
1329
+ enumerable: !0,
1330
+ configurable: !1,
1331
+ writable: !1
1332
+ }
1333
+ }), n;
1334
+ }
1335
+ class ot {
1336
+ jwksUrl;
1337
+ JWKS;
1338
+ constructor(e) {
1339
+ this.jwksUrl = e, this.JWKS = it(new URL(this.jwksUrl));
1340
+ }
1341
+ /**
1342
+ * Verify a JWT against the JWKS
1343
+ */
1344
+ async verify(e) {
1345
+ return Xe(e, this.JWKS);
1346
+ }
1347
+ }
1348
+ class ct {
303
1349
  store = /* @__PURE__ */ new Map();
304
1350
  async get(e) {
305
1351
  return this.store.get(e) ?? null;
306
1352
  }
307
- async set(e, t) {
308
- this.store.set(e, t);
1353
+ async set(e, r) {
1354
+ this.store.set(e, r);
309
1355
  }
310
1356
  async remove(e) {
311
1357
  this.store.delete(e);
@@ -314,7 +1360,7 @@ class E {
314
1360
  this.store.clear();
315
1361
  }
316
1362
  }
317
- class T {
1363
+ class Z {
318
1364
  prefix;
319
1365
  constructor(e = "genation") {
320
1366
  this.prefix = e;
@@ -325,8 +1371,8 @@ class T {
325
1371
  async get(e) {
326
1372
  return typeof window > "u" ? null : localStorage.getItem(this.getKey(e));
327
1373
  }
328
- async set(e, t) {
329
- typeof window > "u" || localStorage.setItem(this.getKey(e), t);
1374
+ async set(e, r) {
1375
+ typeof window > "u" || localStorage.setItem(this.getKey(e), r);
330
1376
  }
331
1377
  async remove(e) {
332
1378
  typeof window > "u" || localStorage.removeItem(this.getKey(e));
@@ -334,11 +1380,11 @@ class T {
334
1380
  async clear() {
335
1381
  if (typeof window > "u") return;
336
1382
  Object.keys(localStorage).filter(
337
- (t) => t.startsWith(`${this.prefix}:`)
338
- ).forEach((t) => localStorage.removeItem(t));
1383
+ (r) => r.startsWith(`${this.prefix}:`)
1384
+ ).forEach((r) => localStorage.removeItem(r));
339
1385
  }
340
1386
  }
341
- class A {
1387
+ class ht {
342
1388
  prefix;
343
1389
  constructor(e = "genation") {
344
1390
  this.prefix = e;
@@ -349,8 +1395,8 @@ class A {
349
1395
  async get(e) {
350
1396
  return typeof window > "u" ? null : sessionStorage.getItem(this.getKey(e));
351
1397
  }
352
- async set(e, t) {
353
- typeof window > "u" || sessionStorage.setItem(this.getKey(e), t);
1398
+ async set(e, r) {
1399
+ typeof window > "u" || sessionStorage.setItem(this.getKey(e), r);
354
1400
  }
355
1401
  async remove(e) {
356
1402
  typeof window > "u" || sessionStorage.removeItem(this.getKey(e));
@@ -358,62 +1404,65 @@ class A {
358
1404
  async clear() {
359
1405
  if (typeof window > "u") return;
360
1406
  Object.keys(sessionStorage).filter(
361
- (t) => t.startsWith(`${this.prefix}:`)
362
- ).forEach((t) => sessionStorage.removeItem(t));
1407
+ (r) => r.startsWith(`${this.prefix}:`)
1408
+ ).forEach((r) => sessionStorage.removeItem(r));
363
1409
  }
364
1410
  }
365
- function M(r = "localStorage") {
366
- switch (r) {
1411
+ function ut(t = "localStorage") {
1412
+ switch (t) {
367
1413
  case "memory":
368
- return new E();
1414
+ return new ct();
369
1415
  case "localStorage":
370
- return new T();
1416
+ return new Z();
371
1417
  case "sessionStorage":
372
- return new A();
1418
+ return new ht();
373
1419
  default:
374
- return new T();
1420
+ return new Z();
375
1421
  }
376
1422
  }
377
- function w(r) {
378
- return Array.isArray(r) ? r.map(w) : typeof r == "object" && r !== null ? Object.fromEntries(
379
- Object.entries(r).map(([e, t]) => [
380
- e.replace(/_([a-z])/g, (s, n) => n.toUpperCase()),
381
- w(t)
1423
+ function H(t) {
1424
+ return Array.isArray(t) ? t.map(H) : typeof t == "object" && t !== null ? Object.fromEntries(
1425
+ Object.entries(t).map(([e, r]) => [
1426
+ e.replace(/_([a-z])/g, (n, s) => s.toUpperCase()),
1427
+ H(r)
382
1428
  ])
383
- ) : r;
1429
+ ) : t;
384
1430
  }
385
- class K {
1431
+ class ft {
386
1432
  oauth;
387
1433
  tokenManager;
1434
+ tokenVerifier;
388
1435
  http;
389
1436
  httpServer;
390
1437
  listeners = /* @__PURE__ */ new Set();
391
1438
  initialized = !1;
392
1439
  constructor(e) {
393
1440
  this.validateConfig(e);
394
- const t = typeof e.storage == "object" ? e.storage : M(e.storage);
395
- this.tokenManager = new I(t), this.oauth = new x(e, this.tokenManager), this.http = new p({
396
- baseUrl: e.authUrl ?? "https://mnnoheowoowbtpuoguul.supabase.co/auth/v1"
397
- }), this.httpServer = new p({
1441
+ const r = typeof e.storage == "object" ? e.storage : ut(e.storage), n = e.authUrl ?? "https://mnnoheowoowbtpuoguul.supabase.co/auth/v1";
1442
+ this.tokenManager = new le(r), this.oauth = new ye(e, this.tokenManager), this.tokenVerifier = new ot(
1443
+ `${n}/.well-known/jwks.json`
1444
+ ), this.http = new D({
1445
+ baseUrl: n
1446
+ }), this.httpServer = new D({
398
1447
  baseUrl: "https://ff-api.genation.ai/api/v2/client"
399
1448
  });
400
1449
  }
401
1450
  validateConfig(e) {
402
- if (!e.clientId) throw u.missingField("clientId");
1451
+ if (!e.clientId) throw v.missingField("clientId");
403
1452
  if (!e.clientSecret)
404
- throw u.missingField("clientSecret");
405
- if (!e.redirectUri) throw u.missingField("redirectUri");
1453
+ throw v.missingField("clientSecret");
1454
+ if (!e.redirectUri) throw v.missingField("redirectUri");
406
1455
  }
407
1456
  /**
408
1457
  * Emit auth state change event to all listeners
409
1458
  */
410
1459
  async emitAuthStateChange(e) {
411
- const t = await this.getSession();
412
- this.listeners.forEach((s) => {
1460
+ const r = await this.getSession();
1461
+ this.listeners.forEach((n) => {
413
1462
  try {
414
- s(e, t);
415
- } catch (n) {
416
- console.error("Error in auth state change callback:", n);
1463
+ n(e, r);
1464
+ } catch (s) {
1465
+ console.error("Error in auth state change callback:", s);
417
1466
  }
418
1467
  });
419
1468
  }
@@ -507,30 +1556,29 @@ class K {
507
1556
  * ```
508
1557
  */
509
1558
  async handleCallback(e) {
510
- const t = new URL(e), s = t.searchParams.get("code"), n = t.searchParams.get("state");
511
- if (!s || !n)
1559
+ const r = new URL(e), n = r.searchParams.get("code"), s = r.searchParams.get("state");
1560
+ if (!n || !s)
512
1561
  throw new Error("Missing code or state");
513
- const i = await this.oauth.exchangeCode(s, n);
514
- return await this.emitAuthStateChange("SIGNED_IN"), i;
515
- }
516
- // /**
517
- // * Sign out and revoke tokens
518
- // *
519
- // * Clears local session and revokes tokens on server.
520
- // * Triggers `SIGNED_OUT` event for all listeners.
521
- // *
522
- // * @example
523
- // * ```typescript
524
- // * async function handleLogout() {
525
- // * await client.signOut();
526
- // * // onAuthStateChange will fire with SIGNED_OUT event
527
- // * }
528
- // * ```
529
- // */
530
- // async signOut(): Promise<void> {
531
- // await this.oauth.revokeToken();
532
- // await this.emitAuthStateChange("SIGNED_OUT");
533
- // }
1562
+ const a = await this.oauth.exchangeCode(n, s);
1563
+ return await this.emitAuthStateChange("SIGNED_IN"), a;
1564
+ }
1565
+ /**
1566
+ * Sign out and revoke tokens
1567
+ *
1568
+ * Clears local session.
1569
+ * Triggers `SIGNED_OUT` event for all listeners.
1570
+ *
1571
+ * @example
1572
+ * ```typescript
1573
+ * async function handleLogout() {
1574
+ * await client.signOut();
1575
+ * // onAuthStateChange will fire with SIGNED_OUT event
1576
+ * }
1577
+ * ```
1578
+ */
1579
+ async signOut() {
1580
+ await this.tokenManager.clearTokens(), await this.emitAuthStateChange("SIGNED_OUT");
1581
+ }
534
1582
  /**
535
1583
  * Get current session
536
1584
  *
@@ -559,17 +1607,30 @@ class K {
559
1607
  } catch {
560
1608
  return null;
561
1609
  }
562
- const t = await this.tokenManager.getTokens();
563
- if (!t) return null;
564
- const s = await this.fetchUser(t.accessToken);
1610
+ const r = await this.tokenManager.getTokens();
1611
+ if (!r) return null;
1612
+ const n = await this.fetchUser(r.accessToken);
565
1613
  return {
566
- accessToken: t.accessToken,
567
- refreshToken: t.refreshToken,
568
- expiresIn: t.expiresIn,
569
- expiresAt: t.issuedAt + t.expiresIn * 1e3,
570
- user: s
1614
+ accessToken: r.accessToken,
1615
+ refreshToken: r.refreshToken,
1616
+ expiresIn: r.expiresIn,
1617
+ expiresAt: r.issuedAt + r.expiresIn * 1e3,
1618
+ user: n
571
1619
  };
572
1620
  }
1621
+ /**
1622
+ * Verify a JWT token
1623
+ *
1624
+ * Validates the token signature using the public JWKS.
1625
+ *
1626
+ * @param token - JWT token to verify
1627
+ * @returns Decoded token payload if valid
1628
+ * @throws Error if token is invalid
1629
+ */
1630
+ async verifyToken(e) {
1631
+ const { payload: r } = await this.tokenVerifier.verify(e);
1632
+ return r;
1633
+ }
573
1634
  /**
574
1635
  * Get licenses
575
1636
  * @param accessToken - The access token to use for the request
@@ -578,50 +1639,50 @@ class K {
578
1639
  * @returns The licenses
579
1640
  */
580
1641
  async getLicenses(e = {}) {
581
- const t = await this.getSession();
582
- if (!t)
1642
+ const r = await this.getSession();
1643
+ if (!r)
583
1644
  return null;
584
- const s = t.accessToken, { expiresAfter: n = /* @__PURE__ */ new Date() } = e, i = await this.httpServer.request("/licenses", {
585
- headers: { Authorization: `Bearer ${s}` },
586
- params: { expiresAfter: n.toISOString() }
1645
+ const n = r.accessToken, { expiresAfter: s = /* @__PURE__ */ new Date() } = e, a = await this.httpServer.request("/licenses", {
1646
+ headers: { Authorization: `Bearer ${n}` },
1647
+ params: { expiresAfter: s.toISOString() }
587
1648
  });
588
- return i.ok ? w(i.data) : (console.error("GenationClient: Error fetching licenses:", i.error), null);
1649
+ return a.ok ? H(a.data) : (console.error("GenationClient: Error fetching licenses:", a.error), null);
589
1650
  }
590
1651
  /**
591
1652
  * Fetch user info from auth server
592
1653
  */
593
1654
  async fetchUser(e) {
594
1655
  try {
595
- const t = await this.http.request("/oauth/userinfo", {
1656
+ const r = await this.http.request("/oauth/userinfo", {
596
1657
  headers: { Authorization: `Bearer ${e}` }
597
1658
  });
598
1659
  return {
599
- sub: t.sub,
600
- name: t.name,
601
- picture: t.picture,
602
- email: t.email,
603
- email_verified: t.email_verified,
604
- phone_number: t.phone_number,
605
- phone_number_verified: t.phone_number_verified
1660
+ sub: r.sub,
1661
+ name: r.name,
1662
+ picture: r.picture,
1663
+ email: r.email,
1664
+ email_verified: r.email_verified,
1665
+ phone_number: r.phone_number,
1666
+ phone_number_verified: r.phone_number_verified
606
1667
  };
607
- } catch (t) {
608
- return console.error("GenationClient: Error fetching user:", t), null;
1668
+ } catch (r) {
1669
+ return console.error("GenationClient: Error fetching user:", r), null;
609
1670
  }
610
1671
  }
611
1672
  }
612
- function $(r) {
613
- return new K(r);
1673
+ function dt(t) {
1674
+ return new ft(t);
614
1675
  }
615
1676
  export {
616
- l as AuthError,
617
- u as ConfigError,
618
- K as GenationClient,
619
- m as GenationError,
620
- T as LocalStorage,
621
- E as MemoryStorage,
622
- h as NetworkError,
623
- A as SessionStorage,
624
- $ as createClient,
625
- M as createStorage
1677
+ g as AuthError,
1678
+ v as ConfigError,
1679
+ ft as GenationClient,
1680
+ N as GenationError,
1681
+ Z as LocalStorage,
1682
+ ct as MemoryStorage,
1683
+ S as NetworkError,
1684
+ ht as SessionStorage,
1685
+ dt as createClient,
1686
+ ut as createStorage
626
1687
  };
627
1688
  //# sourceMappingURL=genation.es.js.map