@grow-codes/oidc 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -2
- package/lib/chunk-2PTQBDJ6.cjs +890 -0
- package/lib/chunk-2PTQBDJ6.cjs.map +1 -0
- package/lib/chunk-HB2FEHOY.js +843 -0
- package/lib/chunk-HB2FEHOY.js.map +1 -0
- package/lib/index.cjs +169 -690
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +3 -3
- package/lib/index.d.ts +3 -3
- package/lib/index.js +6 -602
- package/lib/index.js.map +1 -1
- package/lib/testing/index.cjs +8 -5
- package/lib/testing/index.cjs.map +1 -1
- package/lib/testing/index.d.cts +4 -1
- package/lib/testing/index.d.ts +4 -1
- package/lib/testing/index.js +6 -3
- package/lib/testing/index.js.map +1 -1
- package/lib/{verifier-ERmLmytF.d.ts → verifier-AJ2o8XWA.d.cts} +13 -5
- package/lib/{verifier-ERmLmytF.d.cts → verifier-AJ2o8XWA.d.ts} +13 -5
- package/package.json +1 -1
- package/lib/chunk-4JJJPKI5.js +0 -233
- package/lib/chunk-4JJJPKI5.js.map +0 -1
- package/lib/chunk-WO2QXDBJ.cjs +0 -255
- package/lib/chunk-WO2QXDBJ.cjs.map +0 -1
|
@@ -0,0 +1,843 @@
|
|
|
1
|
+
import { decodeProtectedHeader, errors, jwtVerify, createLocalJWKSet } from 'jose';
|
|
2
|
+
|
|
3
|
+
// src/core/errors.ts
|
|
4
|
+
var ErrorCode = {
|
|
5
|
+
Config: "CONFIG",
|
|
6
|
+
Authentication: "AUTHENTICATION",
|
|
7
|
+
PermissionDenied: "PERMISSION_DENIED",
|
|
8
|
+
NotFound: "NOT_FOUND",
|
|
9
|
+
Conflict: "CONFLICT",
|
|
10
|
+
RateLimited: "RATE_LIMITED",
|
|
11
|
+
Validation: "VALIDATION",
|
|
12
|
+
Unavailable: "UNAVAILABLE",
|
|
13
|
+
Timeout: "TIMEOUT",
|
|
14
|
+
Unsupported: "UNSUPPORTED",
|
|
15
|
+
Cancelled: "CANCELLED"
|
|
16
|
+
};
|
|
17
|
+
var RETRYABLE_BY_DEFAULT = /* @__PURE__ */ new Set([
|
|
18
|
+
ErrorCode.RateLimited,
|
|
19
|
+
ErrorCode.Unavailable,
|
|
20
|
+
ErrorCode.Timeout
|
|
21
|
+
]);
|
|
22
|
+
var OidcError = class extends Error {
|
|
23
|
+
/** Canonical error code. */
|
|
24
|
+
code;
|
|
25
|
+
/** HTTP status when the error came from a response. */
|
|
26
|
+
httpStatus;
|
|
27
|
+
/** Vendor request id when the response carried one. */
|
|
28
|
+
requestId;
|
|
29
|
+
/** Whether retrying the same call may succeed. */
|
|
30
|
+
retryable;
|
|
31
|
+
/** Server-requested wait in milliseconds (rate limits, `Retry-After`). */
|
|
32
|
+
retryAfterMs;
|
|
33
|
+
constructor(code, message, details = {}) {
|
|
34
|
+
super(message, details.cause === void 0 ? void 0 : { cause: details.cause });
|
|
35
|
+
this.name = new.target.name;
|
|
36
|
+
this.code = code;
|
|
37
|
+
this.retryable = details.retryable ?? RETRYABLE_BY_DEFAULT.has(code);
|
|
38
|
+
if (details.httpStatus !== void 0) this.httpStatus = details.httpStatus;
|
|
39
|
+
if (details.requestId !== void 0) this.requestId = details.requestId;
|
|
40
|
+
if (details.retryAfterMs !== void 0) this.retryAfterMs = details.retryAfterMs;
|
|
41
|
+
}
|
|
42
|
+
/** JSON form (no stack, no cause). */
|
|
43
|
+
toJSON() {
|
|
44
|
+
const out = {
|
|
45
|
+
name: this.name,
|
|
46
|
+
code: this.code,
|
|
47
|
+
message: this.message,
|
|
48
|
+
retryable: this.retryable
|
|
49
|
+
};
|
|
50
|
+
if (this.httpStatus !== void 0) out.httpStatus = this.httpStatus;
|
|
51
|
+
if (this.requestId !== void 0) out.requestId = this.requestId;
|
|
52
|
+
if (this.retryAfterMs !== void 0) out.retryAfterMs = this.retryAfterMs;
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var ConfigError = class extends OidcError {
|
|
57
|
+
constructor(message, details) {
|
|
58
|
+
super(ErrorCode.Config, message, details);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var AuthenticationError = class extends OidcError {
|
|
62
|
+
constructor(message, details) {
|
|
63
|
+
super(ErrorCode.Authentication, message, details);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var PermissionDeniedError = class extends OidcError {
|
|
67
|
+
constructor(message, details) {
|
|
68
|
+
super(ErrorCode.PermissionDenied, message, details);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var NotFoundError = class extends OidcError {
|
|
72
|
+
constructor(message, details) {
|
|
73
|
+
super(ErrorCode.NotFound, message, details);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var ConflictError = class extends OidcError {
|
|
77
|
+
constructor(message, details) {
|
|
78
|
+
super(ErrorCode.Conflict, message, details);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var RateLimitError = class extends OidcError {
|
|
82
|
+
constructor(message, details) {
|
|
83
|
+
super(ErrorCode.RateLimited, message, details);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var ValidationError = class extends OidcError {
|
|
87
|
+
constructor(message, details) {
|
|
88
|
+
super(ErrorCode.Validation, message, details);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var UnavailableError = class extends OidcError {
|
|
92
|
+
constructor(message, details) {
|
|
93
|
+
super(ErrorCode.Unavailable, message, details);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var TimeoutError = class extends OidcError {
|
|
97
|
+
constructor(message, details) {
|
|
98
|
+
super(ErrorCode.Timeout, message, details);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var UnsupportedError = class extends OidcError {
|
|
102
|
+
constructor(message, details) {
|
|
103
|
+
super(ErrorCode.Unsupported, message, details);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var CancelledError = class extends OidcError {
|
|
107
|
+
constructor(message, details) {
|
|
108
|
+
super(ErrorCode.Cancelled, message, details);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var CLASS_BY_CODE = {
|
|
112
|
+
CONFIG: ConfigError,
|
|
113
|
+
AUTHENTICATION: AuthenticationError,
|
|
114
|
+
PERMISSION_DENIED: PermissionDeniedError,
|
|
115
|
+
NOT_FOUND: NotFoundError,
|
|
116
|
+
CONFLICT: ConflictError,
|
|
117
|
+
RATE_LIMITED: RateLimitError,
|
|
118
|
+
VALIDATION: ValidationError,
|
|
119
|
+
UNAVAILABLE: UnavailableError,
|
|
120
|
+
TIMEOUT: TimeoutError,
|
|
121
|
+
UNSUPPORTED: UnsupportedError,
|
|
122
|
+
CANCELLED: CancelledError
|
|
123
|
+
};
|
|
124
|
+
var REASON_BY_CODE = {
|
|
125
|
+
CONFIG: "invalid configuration",
|
|
126
|
+
AUTHENTICATION: "authentication failed",
|
|
127
|
+
PERMISSION_DENIED: "permission denied",
|
|
128
|
+
NOT_FOUND: "not found",
|
|
129
|
+
CONFLICT: "conflict",
|
|
130
|
+
RATE_LIMITED: "rate limited",
|
|
131
|
+
VALIDATION: "invalid request",
|
|
132
|
+
UNAVAILABLE: "service unavailable",
|
|
133
|
+
TIMEOUT: "timed out",
|
|
134
|
+
UNSUPPORTED: "not supported",
|
|
135
|
+
CANCELLED: "cancelled"
|
|
136
|
+
};
|
|
137
|
+
function errorForCode(code, message, details) {
|
|
138
|
+
return new CLASS_BY_CODE[code](message, details);
|
|
139
|
+
}
|
|
140
|
+
function reasonForCode(code) {
|
|
141
|
+
return REASON_BY_CODE[code];
|
|
142
|
+
}
|
|
143
|
+
function codeForStatus(status) {
|
|
144
|
+
switch (status) {
|
|
145
|
+
case 401:
|
|
146
|
+
return ErrorCode.Authentication;
|
|
147
|
+
case 403:
|
|
148
|
+
return ErrorCode.PermissionDenied;
|
|
149
|
+
case 404:
|
|
150
|
+
return ErrorCode.NotFound;
|
|
151
|
+
case 409:
|
|
152
|
+
case 412:
|
|
153
|
+
return ErrorCode.Conflict;
|
|
154
|
+
case 429:
|
|
155
|
+
return ErrorCode.RateLimited;
|
|
156
|
+
case 408:
|
|
157
|
+
case 504:
|
|
158
|
+
return ErrorCode.Timeout;
|
|
159
|
+
case 501:
|
|
160
|
+
return ErrorCode.Unsupported;
|
|
161
|
+
default:
|
|
162
|
+
return status >= 500 ? ErrorCode.Unavailable : ErrorCode.Validation;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function errorForStatus(operation, status, details = {}) {
|
|
166
|
+
const code = codeForStatus(status);
|
|
167
|
+
const { reason, ...rest } = details;
|
|
168
|
+
const text = reason !== void 0 && reason !== "" ? reason : reasonForCode(code);
|
|
169
|
+
return errorForCode(code, `${operation}: ${text} (HTTP ${status})`, {
|
|
170
|
+
...rest,
|
|
171
|
+
httpStatus: status
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function isOidcError(err, code) {
|
|
175
|
+
return err instanceof OidcError && (code === void 0 || err.code === code);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// src/core/abort.ts
|
|
179
|
+
function throwIfAborted(signal, operation) {
|
|
180
|
+
if (signal?.aborted === true) throw new CancelledError(`${operation}: cancelled`);
|
|
181
|
+
}
|
|
182
|
+
function sleep(ms, signal, operation = "sleep") {
|
|
183
|
+
return new Promise((resolve, reject) => {
|
|
184
|
+
if (signal?.aborted === true) {
|
|
185
|
+
reject(new CancelledError(`${operation}: cancelled`));
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const onAbort = () => {
|
|
189
|
+
clearTimeout(timer);
|
|
190
|
+
reject(new CancelledError(`${operation}: cancelled`));
|
|
191
|
+
};
|
|
192
|
+
const timer = setTimeout(
|
|
193
|
+
() => {
|
|
194
|
+
signal?.removeEventListener("abort", onAbort);
|
|
195
|
+
resolve();
|
|
196
|
+
},
|
|
197
|
+
Math.max(0, ms)
|
|
198
|
+
);
|
|
199
|
+
timer.unref();
|
|
200
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// src/core/redaction.ts
|
|
205
|
+
var REDACTED = "[REDACTED]";
|
|
206
|
+
var INSPECT = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
207
|
+
var SENSITIVE_HEADERS = /* @__PURE__ */ new Set([
|
|
208
|
+
"authorization",
|
|
209
|
+
"proxy-authorization",
|
|
210
|
+
"cookie",
|
|
211
|
+
"set-cookie"
|
|
212
|
+
]);
|
|
213
|
+
var SENSITIVE_HEADER_PARTS = [
|
|
214
|
+
"token",
|
|
215
|
+
"secret",
|
|
216
|
+
"password",
|
|
217
|
+
"api-key",
|
|
218
|
+
"apikey",
|
|
219
|
+
"key",
|
|
220
|
+
"auth",
|
|
221
|
+
"session",
|
|
222
|
+
"signature",
|
|
223
|
+
"credential"
|
|
224
|
+
];
|
|
225
|
+
var SENSITIVE_FIELD_PARTS = [
|
|
226
|
+
"password",
|
|
227
|
+
"passwd",
|
|
228
|
+
"secret",
|
|
229
|
+
"token",
|
|
230
|
+
"authorization",
|
|
231
|
+
"cookie",
|
|
232
|
+
"api_key",
|
|
233
|
+
"apikey",
|
|
234
|
+
"api-key",
|
|
235
|
+
"access_key",
|
|
236
|
+
"private_key",
|
|
237
|
+
"client_secret",
|
|
238
|
+
"credential",
|
|
239
|
+
"session",
|
|
240
|
+
"signature"
|
|
241
|
+
];
|
|
242
|
+
var MIN_SECRET_LENGTH = 4;
|
|
243
|
+
function isSensitiveHeader(name) {
|
|
244
|
+
const n = name.toLowerCase();
|
|
245
|
+
return SENSITIVE_HEADERS.has(n) || SENSITIVE_HEADER_PARTS.some((p) => n.includes(p));
|
|
246
|
+
}
|
|
247
|
+
var PATH_NAME = /path$/;
|
|
248
|
+
function isSensitiveField(name, extraKeys = []) {
|
|
249
|
+
const n = name.toLowerCase();
|
|
250
|
+
return !PATH_NAME.test(n) && SENSITIVE_FIELD_PARTS.some((p) => n.includes(p)) || extraKeys.some((k) => k !== "" && n.includes(k.toLowerCase()));
|
|
251
|
+
}
|
|
252
|
+
function headerEntries(headers) {
|
|
253
|
+
if (Symbol.iterator in headers) {
|
|
254
|
+
return Array.from(headers, ([k, v]) => [k, v]);
|
|
255
|
+
}
|
|
256
|
+
const out = [];
|
|
257
|
+
for (const [k, v] of Object.entries(headers)) {
|
|
258
|
+
if (v === void 0) continue;
|
|
259
|
+
out.push([k, typeof v === "string" ? v : v.join(", ")]);
|
|
260
|
+
}
|
|
261
|
+
return out;
|
|
262
|
+
}
|
|
263
|
+
function redactHeaders(headers) {
|
|
264
|
+
const out = {};
|
|
265
|
+
for (const [k, v] of headerEntries(headers)) {
|
|
266
|
+
out[k] = isSensitiveHeader(k) ? REDACTED : v;
|
|
267
|
+
}
|
|
268
|
+
return out;
|
|
269
|
+
}
|
|
270
|
+
function redactUrl(url) {
|
|
271
|
+
let parsed;
|
|
272
|
+
try {
|
|
273
|
+
parsed = new URL(url.toString());
|
|
274
|
+
} catch {
|
|
275
|
+
return redactQueryString(url.toString());
|
|
276
|
+
}
|
|
277
|
+
if (parsed.password !== "") parsed.password = REDACTED;
|
|
278
|
+
if (parsed.password === "" && parsed.username !== "" && parsed.username !== REDACTED) {
|
|
279
|
+
parsed.username = REDACTED;
|
|
280
|
+
}
|
|
281
|
+
const params = parsed.searchParams;
|
|
282
|
+
let changed = false;
|
|
283
|
+
const next = new URLSearchParams();
|
|
284
|
+
for (const [k, v] of params) {
|
|
285
|
+
if (isSensitiveField(k)) {
|
|
286
|
+
next.append(k, REDACTED);
|
|
287
|
+
changed = true;
|
|
288
|
+
} else {
|
|
289
|
+
next.append(k, v);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (changed) parsed.search = next.toString();
|
|
293
|
+
return parsed.toString().replaceAll(encodeURIComponent(REDACTED), REDACTED);
|
|
294
|
+
}
|
|
295
|
+
function redactQueryString(text) {
|
|
296
|
+
return text.replace(
|
|
297
|
+
/([?&])([^=&#?\s]+)=([^&#\s]*)/g,
|
|
298
|
+
(m, sep, k) => isSensitiveField(k) ? `${sep}${k}=${REDACTED}` : m
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
function redactFields(value, extraKeys = []) {
|
|
302
|
+
return redactValue(value, extraKeys, /* @__PURE__ */ new WeakMap());
|
|
303
|
+
}
|
|
304
|
+
function redactValue(value, extraKeys, seen) {
|
|
305
|
+
if (value === null || typeof value !== "object") return value;
|
|
306
|
+
if (value instanceof Date || value instanceof Uint8Array) return value;
|
|
307
|
+
const cached = seen.get(value);
|
|
308
|
+
if (cached !== void 0) return cached;
|
|
309
|
+
if (Array.isArray(value)) {
|
|
310
|
+
const arr = [];
|
|
311
|
+
seen.set(value, arr);
|
|
312
|
+
for (const item of value) arr.push(redactValue(item, extraKeys, seen));
|
|
313
|
+
return arr;
|
|
314
|
+
}
|
|
315
|
+
if (value instanceof Map) {
|
|
316
|
+
const map = /* @__PURE__ */ new Map();
|
|
317
|
+
seen.set(value, map);
|
|
318
|
+
for (const [k, v] of value) {
|
|
319
|
+
map.set(
|
|
320
|
+
k,
|
|
321
|
+
typeof k === "string" && isSensitiveField(k, extraKeys) ? REDACTED : redactValue(v, extraKeys, seen)
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
return map;
|
|
325
|
+
}
|
|
326
|
+
const out = {};
|
|
327
|
+
seen.set(value, out);
|
|
328
|
+
for (const [k, v] of Object.entries(value)) {
|
|
329
|
+
out[k] = isSensitiveField(k, extraKeys) ? REDACTED : redactValue(v, extraKeys, seen);
|
|
330
|
+
}
|
|
331
|
+
return out;
|
|
332
|
+
}
|
|
333
|
+
function redactText(text, knownSecrets = []) {
|
|
334
|
+
const values = /* @__PURE__ */ new Set();
|
|
335
|
+
for (const s of knownSecrets) {
|
|
336
|
+
const v = s instanceof Secret ? s.reveal() : s;
|
|
337
|
+
if (typeof v === "string" && v.length >= MIN_SECRET_LENGTH) values.add(v);
|
|
338
|
+
}
|
|
339
|
+
let out = text;
|
|
340
|
+
for (const v of [...values].sort((a, b) => b.length - a.length)) {
|
|
341
|
+
out = out.split(v).join(REDACTED);
|
|
342
|
+
}
|
|
343
|
+
return out;
|
|
344
|
+
}
|
|
345
|
+
var Secret = class _Secret {
|
|
346
|
+
#value;
|
|
347
|
+
constructor(value) {
|
|
348
|
+
this.#value = value;
|
|
349
|
+
}
|
|
350
|
+
/** Wraps a string (returns `undefined` for `undefined`/empty, keeps an existing Secret). */
|
|
351
|
+
static from(value) {
|
|
352
|
+
if (value === void 0 || value === null) return void 0;
|
|
353
|
+
if (value instanceof _Secret) return value;
|
|
354
|
+
return value === "" ? void 0 : new _Secret(value);
|
|
355
|
+
}
|
|
356
|
+
/** The wrapped value. */
|
|
357
|
+
reveal() {
|
|
358
|
+
return this.#value;
|
|
359
|
+
}
|
|
360
|
+
/** Constant-time-ish comparison with another value. */
|
|
361
|
+
equals(other) {
|
|
362
|
+
const a = this.#value;
|
|
363
|
+
const b = other instanceof _Secret ? other.reveal() : other;
|
|
364
|
+
if (a.length !== b.length) return false;
|
|
365
|
+
let diff = 0;
|
|
366
|
+
for (let i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
367
|
+
return diff === 0;
|
|
368
|
+
}
|
|
369
|
+
toString() {
|
|
370
|
+
return REDACTED;
|
|
371
|
+
}
|
|
372
|
+
toJSON() {
|
|
373
|
+
return REDACTED;
|
|
374
|
+
}
|
|
375
|
+
[INSPECT]() {
|
|
376
|
+
return REDACTED;
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
function redactError(err, knownSecrets = []) {
|
|
380
|
+
const secrets = [...knownSecrets];
|
|
381
|
+
if (err instanceof Error) {
|
|
382
|
+
const copy = new Error(redactText(redactQueryString(err.message), secrets));
|
|
383
|
+
copy.name = err.name;
|
|
384
|
+
const code = err.code;
|
|
385
|
+
if (typeof code === "string") copy.code = code;
|
|
386
|
+
if (err.cause !== void 0) copy.cause = redactError(err.cause, secrets);
|
|
387
|
+
return copy;
|
|
388
|
+
}
|
|
389
|
+
return new Error(redactText(String(err), secrets));
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// src/core/env.ts
|
|
393
|
+
var UNIT_MS = {
|
|
394
|
+
ns: 1e-6,
|
|
395
|
+
us: 1e-3,
|
|
396
|
+
\u00B5s: 1e-3,
|
|
397
|
+
ms: 1,
|
|
398
|
+
s: 1e3,
|
|
399
|
+
m: 6e4,
|
|
400
|
+
h: 36e5
|
|
401
|
+
};
|
|
402
|
+
var DURATION_UNITS = ["ns", "us", "\xB5s", "ms", "s", "m", "h"];
|
|
403
|
+
function parseDuration(raw) {
|
|
404
|
+
const text = raw.trim();
|
|
405
|
+
if (/^\d+$/.test(text)) return Number(text);
|
|
406
|
+
if (text === "") return void 0;
|
|
407
|
+
let total = 0;
|
|
408
|
+
let i = 0;
|
|
409
|
+
const isDigit = (at) => at < text.length && text.charCodeAt(at) >= 48 && text.charCodeAt(at) <= 57;
|
|
410
|
+
while (i < text.length) {
|
|
411
|
+
const start = i;
|
|
412
|
+
while (isDigit(i)) i += 1;
|
|
413
|
+
const intDigits = i - start;
|
|
414
|
+
if (text[i] === ".") {
|
|
415
|
+
i += 1;
|
|
416
|
+
const fracStart = i;
|
|
417
|
+
while (isDigit(i)) i += 1;
|
|
418
|
+
if (i === fracStart) return void 0;
|
|
419
|
+
} else if (intDigits === 0) {
|
|
420
|
+
return void 0;
|
|
421
|
+
}
|
|
422
|
+
const value = Number(text.slice(start, i));
|
|
423
|
+
const unit = DURATION_UNITS.find((u) => text.startsWith(u, i));
|
|
424
|
+
if (unit === void 0) return void 0;
|
|
425
|
+
total += value * UNIT_MS[unit];
|
|
426
|
+
i += unit.length;
|
|
427
|
+
}
|
|
428
|
+
return Math.round(total);
|
|
429
|
+
}
|
|
430
|
+
var TRUE_WORDS = /* @__PURE__ */ new Set(["true", "1", "yes", "on"]);
|
|
431
|
+
var FALSE_WORDS = /* @__PURE__ */ new Set(["false", "0", "no", "off"]);
|
|
432
|
+
function parseBool(raw) {
|
|
433
|
+
const text = raw.trim().toLowerCase();
|
|
434
|
+
if (TRUE_WORDS.has(text)) return true;
|
|
435
|
+
if (FALSE_WORDS.has(text)) return false;
|
|
436
|
+
return void 0;
|
|
437
|
+
}
|
|
438
|
+
function parseInteger(raw) {
|
|
439
|
+
const text = raw.trim();
|
|
440
|
+
if (!/^[+-]?\d+$/.test(text)) return void 0;
|
|
441
|
+
const n = Number(text);
|
|
442
|
+
return Number.isSafeInteger(n) ? n : void 0;
|
|
443
|
+
}
|
|
444
|
+
var EnvReader = class {
|
|
445
|
+
prefix;
|
|
446
|
+
#env;
|
|
447
|
+
/**
|
|
448
|
+
* @param prefix e.g. `"GROW_OIDC_"`.
|
|
449
|
+
* @param env environment map, defaults to `process.env`.
|
|
450
|
+
*/
|
|
451
|
+
constructor(prefix, env = process.env) {
|
|
452
|
+
this.prefix = prefix;
|
|
453
|
+
this.#env = env;
|
|
454
|
+
}
|
|
455
|
+
/** Finds the first present variable: `<prefix><name>`, then each vendor name. */
|
|
456
|
+
lookup(name, vendorNames = []) {
|
|
457
|
+
for (const candidate of [this.prefix + name, ...vendorNames]) {
|
|
458
|
+
const value = this.#env[candidate];
|
|
459
|
+
if (value !== void 0 && value !== "") return { name: candidate, value };
|
|
460
|
+
}
|
|
461
|
+
return void 0;
|
|
462
|
+
}
|
|
463
|
+
/** String value. */
|
|
464
|
+
string(name, vendorNames = []) {
|
|
465
|
+
return this.lookup(name, vendorNames)?.value;
|
|
466
|
+
}
|
|
467
|
+
/** Credential value wrapped in a {@link Secret}. */
|
|
468
|
+
secret(name, vendorNames = []) {
|
|
469
|
+
return Secret.from(this.string(name, vendorNames));
|
|
470
|
+
}
|
|
471
|
+
/** Duration in milliseconds (see {@link parseDuration}). */
|
|
472
|
+
duration(name, vendorNames = []) {
|
|
473
|
+
return this.#parse(name, vendorNames, parseDuration, "a duration such as 1500, 500ms or 10s");
|
|
474
|
+
}
|
|
475
|
+
/** Boolean (see {@link parseBool}). */
|
|
476
|
+
bool(name, vendorNames = []) {
|
|
477
|
+
return this.#parse(name, vendorNames, parseBool, "a boolean (true/false/1/0/yes/no/on/off)");
|
|
478
|
+
}
|
|
479
|
+
/** Integer. */
|
|
480
|
+
int(name, vendorNames = []) {
|
|
481
|
+
return this.#parse(name, vendorNames, parseInteger, "an integer");
|
|
482
|
+
}
|
|
483
|
+
#parse(name, vendorNames, parse, expected) {
|
|
484
|
+
const hit = this.lookup(name, vendorNames);
|
|
485
|
+
if (hit === void 0) return void 0;
|
|
486
|
+
const value = parse(hit.value);
|
|
487
|
+
if (value === void 0) {
|
|
488
|
+
throw new ConfigError(
|
|
489
|
+
`invalid value in environment variable ${hit.name}: expected ${expected}`
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
return value;
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
// src/core/poll.ts
|
|
497
|
+
async function pollUntil(fn, predicate, options = {}) {
|
|
498
|
+
const timeoutMs = options.timeoutMs ?? 3e4;
|
|
499
|
+
const intervalMs = options.intervalMs ?? 1e3;
|
|
500
|
+
const operation = options.operation ?? "poll";
|
|
501
|
+
const sleep2 = options.sleep ?? sleep;
|
|
502
|
+
const now = options.now ?? Date.now;
|
|
503
|
+
const deadline = now() + timeoutMs;
|
|
504
|
+
let lastError;
|
|
505
|
+
for (let attempt = 1; ; attempt++) {
|
|
506
|
+
throwIfAborted(options.signal, operation);
|
|
507
|
+
try {
|
|
508
|
+
const value = await fn(attempt);
|
|
509
|
+
if (predicate(value)) return value;
|
|
510
|
+
} catch (err) {
|
|
511
|
+
if (options.ignoreError?.(err) !== true) throw err;
|
|
512
|
+
lastError = err;
|
|
513
|
+
}
|
|
514
|
+
const remaining = deadline - now();
|
|
515
|
+
if (remaining <= 0) {
|
|
516
|
+
throw new TimeoutError(
|
|
517
|
+
`${operation}: condition not met within ${timeoutMs} ms after ${attempt} attempts`,
|
|
518
|
+
lastError === void 0 ? {} : { cause: lastError }
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
await sleep2(Math.min(intervalMs, remaining), options.signal);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// src/oidc/roles.ts
|
|
526
|
+
var ROLE_OBJECT_KEYS = ["name", "code", "role", "value"];
|
|
527
|
+
function claimAt(claims, path) {
|
|
528
|
+
if (Object.hasOwn(claims, path)) return claims[path];
|
|
529
|
+
let current = claims;
|
|
530
|
+
for (const part of path.split(".")) {
|
|
531
|
+
if (current === null || typeof current !== "object" || Array.isArray(current)) return void 0;
|
|
532
|
+
const record = current;
|
|
533
|
+
if (!Object.hasOwn(record, part)) return void 0;
|
|
534
|
+
current = record[part];
|
|
535
|
+
}
|
|
536
|
+
return current;
|
|
537
|
+
}
|
|
538
|
+
function roleName(entry) {
|
|
539
|
+
if (typeof entry === "string") return entry.trim() === "" ? void 0 : entry.trim();
|
|
540
|
+
if (entry !== null && typeof entry === "object" && !Array.isArray(entry)) {
|
|
541
|
+
const record = entry;
|
|
542
|
+
for (const key of ROLE_OBJECT_KEYS) {
|
|
543
|
+
const value = record[key];
|
|
544
|
+
if (typeof value === "string" && value.trim() !== "") return value.trim();
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return void 0;
|
|
548
|
+
}
|
|
549
|
+
function extractRoles(claims, rolesClaim = "roles") {
|
|
550
|
+
const raw = claimAt(claims, rolesClaim);
|
|
551
|
+
let names = [];
|
|
552
|
+
if (typeof raw === "string") {
|
|
553
|
+
names = raw.split(/[\s,]+/u);
|
|
554
|
+
} else if (Array.isArray(raw)) {
|
|
555
|
+
names = raw.map(roleName);
|
|
556
|
+
}
|
|
557
|
+
const out = [];
|
|
558
|
+
for (const name of names) {
|
|
559
|
+
if (name !== void 0 && name !== "" && !out.includes(name)) out.push(name);
|
|
560
|
+
}
|
|
561
|
+
return out;
|
|
562
|
+
}
|
|
563
|
+
function hasAnyRole(userRoles, required) {
|
|
564
|
+
if (required.length === 0) return true;
|
|
565
|
+
const have = new Set(userRoles.map((role) => role.toLowerCase()));
|
|
566
|
+
return required.some((role) => have.has(role.toLowerCase()));
|
|
567
|
+
}
|
|
568
|
+
var DEFAULT_ALGORITHMS = [
|
|
569
|
+
"RS256",
|
|
570
|
+
"RS384",
|
|
571
|
+
"RS512",
|
|
572
|
+
"PS256",
|
|
573
|
+
"PS384",
|
|
574
|
+
"PS512",
|
|
575
|
+
"ES256",
|
|
576
|
+
"ES384",
|
|
577
|
+
"ES512",
|
|
578
|
+
"EdDSA"
|
|
579
|
+
];
|
|
580
|
+
var DEFAULT_CLOCK_SKEW_MS = 6e4;
|
|
581
|
+
var DEFAULT_JWKS_CACHE_TTL_MS = 6e5;
|
|
582
|
+
var DEFAULT_JWKS_REFRESH_COOLDOWN_MS = 3e4;
|
|
583
|
+
var DEFAULT_HTTP_TIMEOUT_MS = 1e4;
|
|
584
|
+
function bearerToken(req) {
|
|
585
|
+
if (req === null || req === void 0) return null;
|
|
586
|
+
let value;
|
|
587
|
+
if (req instanceof Headers) {
|
|
588
|
+
value = req.get("authorization");
|
|
589
|
+
} else if (req.headers instanceof Headers) {
|
|
590
|
+
value = req.headers.get("authorization");
|
|
591
|
+
} else {
|
|
592
|
+
const headers = req.headers;
|
|
593
|
+
const raw = headers.authorization ?? headers.Authorization;
|
|
594
|
+
value = Array.isArray(raw) ? raw[0] : raw;
|
|
595
|
+
}
|
|
596
|
+
if (typeof value !== "string") return null;
|
|
597
|
+
const match = /^\s*bearer\s+(\S+)\s*$/iu.exec(value);
|
|
598
|
+
return match?.[1] ?? null;
|
|
599
|
+
}
|
|
600
|
+
var Verifier = class _Verifier {
|
|
601
|
+
issuer;
|
|
602
|
+
audience;
|
|
603
|
+
rolesClaim;
|
|
604
|
+
algorithms;
|
|
605
|
+
clockSkewMs;
|
|
606
|
+
#jwksUrl;
|
|
607
|
+
#ttlMs;
|
|
608
|
+
#cooldownMs;
|
|
609
|
+
#timeoutMs;
|
|
610
|
+
#fetch;
|
|
611
|
+
#now;
|
|
612
|
+
#resolvedJwksUrl;
|
|
613
|
+
#keys;
|
|
614
|
+
#inflight;
|
|
615
|
+
constructor(options) {
|
|
616
|
+
if (typeof options.issuer !== "string" || options.issuer.trim() === "") {
|
|
617
|
+
throw new ConfigError("oidc: issuer is required");
|
|
618
|
+
}
|
|
619
|
+
if (typeof options.audience !== "string" || options.audience.trim() === "") {
|
|
620
|
+
throw new ConfigError("oidc: audience is required");
|
|
621
|
+
}
|
|
622
|
+
const algorithms = options.algorithms ?? DEFAULT_ALGORITHMS;
|
|
623
|
+
if (algorithms.length === 0 || algorithms.some((alg) => !DEFAULT_ALGORITHMS.includes(alg))) {
|
|
624
|
+
throw new ConfigError(
|
|
625
|
+
`oidc: algorithms must be a non-empty subset of ${DEFAULT_ALGORITHMS.join(", ")}`
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
for (const [name, value] of [
|
|
629
|
+
["clockSkewMs", options.clockSkewMs],
|
|
630
|
+
["jwksCacheTtlMs", options.jwksCacheTtlMs],
|
|
631
|
+
["jwksRefreshCooldownMs", options.jwksRefreshCooldownMs],
|
|
632
|
+
["httpTimeoutMs", options.httpTimeoutMs]
|
|
633
|
+
]) {
|
|
634
|
+
if (value !== void 0 && (!Number.isFinite(value) || value < 0)) {
|
|
635
|
+
throw new ConfigError(`oidc: ${name} must be a non-negative number`);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
this.issuer = options.issuer.trim();
|
|
639
|
+
this.audience = options.audience.trim();
|
|
640
|
+
this.rolesClaim = options.rolesClaim?.trim() || "roles";
|
|
641
|
+
this.algorithms = [...algorithms];
|
|
642
|
+
this.clockSkewMs = options.clockSkewMs ?? DEFAULT_CLOCK_SKEW_MS;
|
|
643
|
+
this.#jwksUrl = options.jwksUrl?.trim() || void 0;
|
|
644
|
+
if (this.#jwksUrl !== void 0) checkUrl("jwksUrl", this.#jwksUrl);
|
|
645
|
+
checkUrl("issuer", this.issuer);
|
|
646
|
+
this.#ttlMs = options.jwksCacheTtlMs ?? DEFAULT_JWKS_CACHE_TTL_MS;
|
|
647
|
+
this.#cooldownMs = options.jwksRefreshCooldownMs ?? DEFAULT_JWKS_REFRESH_COOLDOWN_MS;
|
|
648
|
+
this.#timeoutMs = options.httpTimeoutMs ?? DEFAULT_HTTP_TIMEOUT_MS;
|
|
649
|
+
this.#fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
650
|
+
this.#now = options.now ?? Date.now;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Builds a verifier from `GROW_AUTH_ISSUER` (required), `GROW_AUTH_AUDIENCE` (default
|
|
654
|
+
* `GROW_AUTH_CLIENT_ID`), `GROW_AUTH_JWKS_URL`, `GROW_AUTH_ROLES_CLAIM` (default `roles`) and
|
|
655
|
+
* `GROW_AUTH_CLOCK_SKEW` (duration, default 60s). Explicit `overrides` win.
|
|
656
|
+
*/
|
|
657
|
+
static fromEnv(overrides = {}, env = process.env) {
|
|
658
|
+
const read = (name) => {
|
|
659
|
+
const value = env[name]?.trim();
|
|
660
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
661
|
+
};
|
|
662
|
+
const issuer = overrides.issuer ?? read("GROW_AUTH_ISSUER");
|
|
663
|
+
if (issuer === void 0) throw new ConfigError("oidc: GROW_AUTH_ISSUER is required");
|
|
664
|
+
const audience = overrides.audience ?? read("GROW_AUTH_AUDIENCE") ?? read("GROW_AUTH_CLIENT_ID");
|
|
665
|
+
if (audience === void 0) {
|
|
666
|
+
throw new ConfigError("oidc: GROW_AUTH_AUDIENCE (or GROW_AUTH_CLIENT_ID) is required");
|
|
667
|
+
}
|
|
668
|
+
let clockSkewMs = overrides.clockSkewMs;
|
|
669
|
+
const skew = read("GROW_AUTH_CLOCK_SKEW");
|
|
670
|
+
if (clockSkewMs === void 0 && skew !== void 0) {
|
|
671
|
+
clockSkewMs = parseDuration(skew);
|
|
672
|
+
if (clockSkewMs === void 0)
|
|
673
|
+
throw new ConfigError("oidc: GROW_AUTH_CLOCK_SKEW is not a duration");
|
|
674
|
+
}
|
|
675
|
+
const options = { ...overrides, issuer, audience };
|
|
676
|
+
const jwksUrl = overrides.jwksUrl ?? read("GROW_AUTH_JWKS_URL");
|
|
677
|
+
if (jwksUrl !== void 0) options.jwksUrl = jwksUrl;
|
|
678
|
+
const rolesClaim = overrides.rolesClaim ?? read("GROW_AUTH_ROLES_CLAIM");
|
|
679
|
+
if (rolesClaim !== void 0) options.rolesClaim = rolesClaim;
|
|
680
|
+
if (clockSkewMs !== void 0) options.clockSkewMs = clockSkewMs;
|
|
681
|
+
return new _Verifier(options);
|
|
682
|
+
}
|
|
683
|
+
/** Verifies a raw JWT access token and returns its user. */
|
|
684
|
+
async verify(token) {
|
|
685
|
+
if (typeof token !== "string" || token.split(".").length !== 3) {
|
|
686
|
+
throw new AuthenticationError("verify: malformed token");
|
|
687
|
+
}
|
|
688
|
+
let alg;
|
|
689
|
+
let kid;
|
|
690
|
+
try {
|
|
691
|
+
({ alg, kid } = decodeProtectedHeader(token));
|
|
692
|
+
} catch {
|
|
693
|
+
throw new AuthenticationError("verify: malformed token header");
|
|
694
|
+
}
|
|
695
|
+
if (alg === void 0 || !this.algorithms.includes(alg)) {
|
|
696
|
+
throw new AuthenticationError(`verify: algorithm ${String(alg)} is not allowed`);
|
|
697
|
+
}
|
|
698
|
+
let entry = await this.#keySet(false);
|
|
699
|
+
try {
|
|
700
|
+
return await this.#verifyWith(token, entry);
|
|
701
|
+
} catch (err) {
|
|
702
|
+
if (!(err instanceof errors.JWKSNoMatchingKey) || !this.#mayRefresh(entry)) {
|
|
703
|
+
throw mapJoseError(err, kid);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
entry = await this.#keySet(true);
|
|
707
|
+
try {
|
|
708
|
+
return await this.#verifyWith(token, entry);
|
|
709
|
+
} catch (err) {
|
|
710
|
+
throw mapJoseError(err, kid);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
/** Verifies the bearer token of a request (`AuthenticationError` when there is none). */
|
|
714
|
+
async verifyRequest(req) {
|
|
715
|
+
const token = bearerToken(req);
|
|
716
|
+
if (token === null) throw new AuthenticationError("verify: missing bearer token");
|
|
717
|
+
return this.verify(token);
|
|
718
|
+
}
|
|
719
|
+
/** Drops the cached JWKS so the next verification refetches it. */
|
|
720
|
+
clearCache() {
|
|
721
|
+
this.#keys = void 0;
|
|
722
|
+
}
|
|
723
|
+
async #verifyWith(token, entry) {
|
|
724
|
+
const { payload } = await jwtVerify(token, entry.getKey, {
|
|
725
|
+
issuer: this.issuer,
|
|
726
|
+
audience: this.audience,
|
|
727
|
+
algorithms: [...this.algorithms],
|
|
728
|
+
clockTolerance: Math.floor(this.clockSkewMs / 1e3),
|
|
729
|
+
requiredClaims: ["exp", "sub"],
|
|
730
|
+
currentDate: new Date(this.#now())
|
|
731
|
+
});
|
|
732
|
+
return this.#toUser(payload);
|
|
733
|
+
}
|
|
734
|
+
#toUser(payload) {
|
|
735
|
+
const claims = { ...payload };
|
|
736
|
+
const user = {
|
|
737
|
+
sub: String(payload.sub),
|
|
738
|
+
roles: extractRoles(claims, this.rolesClaim),
|
|
739
|
+
claims
|
|
740
|
+
};
|
|
741
|
+
if (typeof claims.email === "string") user.email = claims.email;
|
|
742
|
+
const name = typeof claims.name === "string" ? claims.name : claims.preferred_username;
|
|
743
|
+
if (typeof name === "string") user.name = name;
|
|
744
|
+
return user;
|
|
745
|
+
}
|
|
746
|
+
#mayRefresh(entry) {
|
|
747
|
+
return this.#now() - entry.fetchedAt >= this.#cooldownMs;
|
|
748
|
+
}
|
|
749
|
+
async #keySet(force) {
|
|
750
|
+
const cached = this.#keys;
|
|
751
|
+
if (!force && cached !== void 0 && this.#now() - cached.fetchedAt < this.#ttlMs)
|
|
752
|
+
return cached;
|
|
753
|
+
if (this.#inflight !== void 0) return this.#inflight;
|
|
754
|
+
const pending = this.#loadKeySet().finally(() => {
|
|
755
|
+
this.#inflight = void 0;
|
|
756
|
+
});
|
|
757
|
+
this.#inflight = pending;
|
|
758
|
+
return pending;
|
|
759
|
+
}
|
|
760
|
+
async #loadKeySet() {
|
|
761
|
+
const url = await this.#jwksUri();
|
|
762
|
+
const body = await this.#getJson(url, "jwks");
|
|
763
|
+
if (body === null || typeof body !== "object" || !Array.isArray(body.keys)) {
|
|
764
|
+
throw new UnavailableError("jwks: response has no keys array");
|
|
765
|
+
}
|
|
766
|
+
const entry = {
|
|
767
|
+
getKey: createLocalJWKSet(body),
|
|
768
|
+
fetchedAt: this.#now()
|
|
769
|
+
};
|
|
770
|
+
this.#keys = entry;
|
|
771
|
+
return entry;
|
|
772
|
+
}
|
|
773
|
+
async #jwksUri() {
|
|
774
|
+
if (this.#jwksUrl !== void 0) return this.#jwksUrl;
|
|
775
|
+
if (this.#resolvedJwksUrl !== void 0) return this.#resolvedJwksUrl;
|
|
776
|
+
const url = `${trimTrailingSlashes(this.issuer)}/.well-known/openid-configuration`;
|
|
777
|
+
const doc = await this.#getJson(url, "discovery");
|
|
778
|
+
const jwksUri = doc?.jwks_uri;
|
|
779
|
+
if (typeof jwksUri !== "string" || jwksUri === "") {
|
|
780
|
+
throw new UnavailableError("discovery: document has no jwks_uri");
|
|
781
|
+
}
|
|
782
|
+
this.#resolvedJwksUrl = jwksUri;
|
|
783
|
+
return jwksUri;
|
|
784
|
+
}
|
|
785
|
+
async #getJson(url, operation) {
|
|
786
|
+
let res;
|
|
787
|
+
try {
|
|
788
|
+
res = await this.#fetch(url, {
|
|
789
|
+
headers: { accept: "application/json" },
|
|
790
|
+
signal: AbortSignal.timeout(this.#timeoutMs)
|
|
791
|
+
});
|
|
792
|
+
} catch (err) {
|
|
793
|
+
throw new UnavailableError(`${operation}: request failed`, { cause: err });
|
|
794
|
+
}
|
|
795
|
+
if (!res.ok) {
|
|
796
|
+
throw new UnavailableError(`${operation}: unexpected response (HTTP ${res.status})`, {
|
|
797
|
+
httpStatus: res.status
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
try {
|
|
801
|
+
return await res.json();
|
|
802
|
+
} catch (err) {
|
|
803
|
+
throw new UnavailableError(`${operation}: response is not JSON`, { cause: err });
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
function trimTrailingSlashes(value) {
|
|
808
|
+
let end = value.length;
|
|
809
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;
|
|
810
|
+
return value.slice(0, end);
|
|
811
|
+
}
|
|
812
|
+
function checkUrl(name, value) {
|
|
813
|
+
let parsed;
|
|
814
|
+
try {
|
|
815
|
+
parsed = new URL(value);
|
|
816
|
+
} catch {
|
|
817
|
+
throw new ConfigError(`oidc: ${name} is not a URL`);
|
|
818
|
+
}
|
|
819
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
820
|
+
throw new ConfigError(`oidc: ${name} must use http or https`);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
function mapJoseError(err, kid) {
|
|
824
|
+
if (err instanceof OidcError) return err;
|
|
825
|
+
if (err instanceof errors.JWTExpired) return new AuthenticationError("verify: token expired");
|
|
826
|
+
if (err instanceof errors.JWTClaimValidationFailed) {
|
|
827
|
+
return new AuthenticationError(`verify: claim ${err.claim} is invalid (${err.reason})`);
|
|
828
|
+
}
|
|
829
|
+
if (err instanceof errors.JWKSNoMatchingKey) {
|
|
830
|
+
return new AuthenticationError(`verify: no key matches kid ${kid ?? "(none)"}`);
|
|
831
|
+
}
|
|
832
|
+
if (err instanceof errors.JWKSMultipleMatchingKeys) {
|
|
833
|
+
return new AuthenticationError("verify: several keys match and none verified the signature");
|
|
834
|
+
}
|
|
835
|
+
if (err instanceof errors.JWSSignatureVerificationFailed) {
|
|
836
|
+
return new AuthenticationError("verify: signature is invalid");
|
|
837
|
+
}
|
|
838
|
+
return new AuthenticationError("verify: token is invalid", { cause: err });
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
export { AuthenticationError, CancelledError, ConfigError, ConflictError, DEFAULT_ALGORITHMS, DEFAULT_CLOCK_SKEW_MS, DEFAULT_HTTP_TIMEOUT_MS, DEFAULT_JWKS_CACHE_TTL_MS, DEFAULT_JWKS_REFRESH_COOLDOWN_MS, EnvReader, ErrorCode, MIN_SECRET_LENGTH, NotFoundError, OidcError, PermissionDeniedError, REDACTED, RateLimitError, SENSITIVE_FIELD_PARTS, Secret, TimeoutError, UnavailableError, UnsupportedError, ValidationError, Verifier, bearerToken, claimAt, codeForStatus, errorForCode, errorForStatus, extractRoles, hasAnyRole, isOidcError, isSensitiveField, isSensitiveHeader, parseBool, parseDuration, parseInteger, pollUntil, reasonForCode, redactError, redactFields, redactHeaders, redactText, redactUrl, sleep, throwIfAborted };
|
|
842
|
+
//# sourceMappingURL=chunk-HB2FEHOY.js.map
|
|
843
|
+
//# sourceMappingURL=chunk-HB2FEHOY.js.map
|