@absolutejs/auth 0.37.0 → 0.40.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -16,6 +16,141 @@ var __export = (target, all) => {
16
16
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
17
  var __require = import.meta.require;
18
18
 
19
+ // src/constants.ts
20
+ var SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_SECOND = 1000, MILLISECONDS_IN_A_MINUTE, MINUTES_IN_AN_HOUR = 60, HOURS_IN_A_DAY = 24, MILLISECONDS_IN_A_DAY, MILLISECONDS_IN_AN_HOUR, COOKIE_MINUTES = 30, COOKIE_DURATION, DEFAULT_MAX_SESSIONS = 1e4;
21
+ var init_constants = __esm(() => {
22
+ MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
23
+ MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_A_DAY;
24
+ MILLISECONDS_IN_AN_HOUR = MILLISECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR;
25
+ COOKIE_DURATION = SECONDS_IN_A_MINUTE * COOKIE_MINUTES;
26
+ });
27
+
28
+ // src/crypto.ts
29
+ var exports_crypto = {};
30
+ __export(exports_crypto, {
31
+ verifyTotp: () => verifyTotp,
32
+ verifyPassword: () => verifyPassword,
33
+ hashToken: () => hashToken,
34
+ hashPassword: () => hashPassword,
35
+ generateTotpSecret: () => generateTotpSecret,
36
+ generateTotp: () => generateTotp,
37
+ generateSecureToken: () => generateSecureToken,
38
+ generateEncryptionKey: () => generateEncryptionKey,
39
+ encryptSecret: () => encryptSecret,
40
+ decryptSecret: () => decryptSecret,
41
+ createTotpKeyUri: () => createTotpKeyUri,
42
+ constantTimeEqual: () => constantTimeEqual,
43
+ base32Encode: () => base32Encode,
44
+ base32Decode: () => base32Decode
45
+ });
46
+ var DEFAULT_TOKEN_BYTES = 32, AES_KEY_BYTES = 32, AES_IV_BYTES = 12, HOTP_COUNTER_BYTES = 8, TOTP_SECRET_BYTES = 20, TOTP_DIGITS = 6, TOTP_PERIOD_SECONDS = 30, DEFAULT_TOTP_WINDOW = 1, DECIMAL_RADIX = 10, LAST_NIBBLE_MASK = 15, SIGN_BIT_MASK = 2147483647, BASE32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", BASE32_GROUP_BITS = 5, BASE32_MASK = 31, BYTE_BITS = 8, textEncoder, textDecoder, base64UrlEncode = (bytes) => Buffer.from(bytes).toString("base64url"), base64UrlDecode = (encoded) => new Uint8Array(Buffer.from(encoded, "base64url")), sha256 = async (input) => {
47
+ const digest = await crypto.subtle.digest("SHA-256", textEncoder.encode(input));
48
+ return new Uint8Array(digest);
49
+ }, hmacSha1 = async (key, message) => {
50
+ const cryptoKey = await crypto.subtle.importKey("raw", key, { hash: "SHA-1", name: "HMAC" }, false, ["sign"]);
51
+ const signature = await crypto.subtle.sign("HMAC", cryptoKey, message);
52
+ return new Uint8Array(signature);
53
+ }, counterToBytes = (counter) => {
54
+ const bytes = new Uint8Array(HOTP_COUNTER_BYTES);
55
+ new DataView(bytes.buffer).setBigUint64(0, BigInt(counter), false);
56
+ return bytes;
57
+ }, generateHotp = async (secret, counter, digits = TOTP_DIGITS) => {
58
+ const hmac = await hmacSha1(secret, counterToBytes(counter));
59
+ const view = new DataView(hmac.buffer, hmac.byteOffset, hmac.byteLength);
60
+ const offset = view.getUint8(hmac.byteLength - 1) & LAST_NIBBLE_MASK;
61
+ const truncated = view.getUint32(offset, false) & SIGN_BIT_MASK;
62
+ const otp = truncated % DECIMAL_RADIX ** digits;
63
+ return otp.toString().padStart(digits, "0");
64
+ }, importAesKey = (keyMaterial) => crypto.subtle.importKey("raw", base64UrlDecode(keyMaterial), { name: "AES-GCM" }, false, ["decrypt", "encrypt"]), base32Decode = (encoded) => {
65
+ const normalized = encoded.toUpperCase().replace(/[^A-Z2-7]/gu, "");
66
+ const bits = [...normalized].map((char) => BASE32_ALPHABET.indexOf(char).toString(2).padStart(BASE32_GROUP_BITS, "0")).join("");
67
+ const byteChunks = bits.match(/.{8}/gu) ?? [];
68
+ return new Uint8Array(byteChunks.map((chunk) => parseInt(chunk, 2)));
69
+ }, base32Encode = (bytes) => {
70
+ const bits = Array.from(bytes, (byte) => byte.toString(2).padStart(BYTE_BITS, "0")).join("");
71
+ const groups = bits.match(/.{1,5}/gu) ?? [];
72
+ return groups.map((group) => BASE32_ALPHABET[parseInt(group.padEnd(BASE32_GROUP_BITS, "0"), 2) & BASE32_MASK] ?? "").join("");
73
+ }, constantTimeEqual = async (left, right) => {
74
+ const [leftDigest, rightDigest] = await Promise.all([
75
+ sha256(left),
76
+ sha256(right)
77
+ ]);
78
+ const leftView = new DataView(leftDigest.buffer, leftDigest.byteOffset, leftDigest.byteLength);
79
+ const rightView = new DataView(rightDigest.buffer, rightDigest.byteOffset, rightDigest.byteLength);
80
+ let mismatch = 0;
81
+ for (let index = 0;index < leftDigest.byteLength; index += 1) {
82
+ mismatch |= leftView.getUint8(index) ^ rightView.getUint8(index);
83
+ }
84
+ return mismatch === 0;
85
+ }, createTotpKeyUri = ({
86
+ accountName,
87
+ digits = TOTP_DIGITS,
88
+ issuer,
89
+ period = TOTP_PERIOD_SECONDS,
90
+ secret
91
+ }) => {
92
+ const params = new URLSearchParams({
93
+ algorithm: "SHA1",
94
+ digits: `${digits}`,
95
+ issuer,
96
+ period: `${period}`,
97
+ secret
98
+ });
99
+ const label = encodeURIComponent(`${issuer}:${accountName}`);
100
+ return `otpauth://totp/${label}?${params.toString()}`;
101
+ }, decryptSecret = async (ciphertext, keyMaterial) => {
102
+ const key = await importAesKey(keyMaterial);
103
+ const combined = base64UrlDecode(ciphertext);
104
+ const nonce = combined.subarray(0, AES_IV_BYTES);
105
+ const data = combined.subarray(AES_IV_BYTES);
106
+ const plaintext = await crypto.subtle.decrypt({ iv: nonce, name: "AES-GCM" }, key, data);
107
+ return textDecoder.decode(plaintext);
108
+ }, encryptSecret = async (plaintext, keyMaterial) => {
109
+ const key = await importAesKey(keyMaterial);
110
+ const nonce = new Uint8Array(AES_IV_BYTES);
111
+ crypto.getRandomValues(nonce);
112
+ const ciphertext = await crypto.subtle.encrypt({ iv: nonce, name: "AES-GCM" }, key, textEncoder.encode(plaintext));
113
+ const combined = new Uint8Array(nonce.byteLength + ciphertext.byteLength);
114
+ combined.set(nonce, 0);
115
+ combined.set(new Uint8Array(ciphertext), nonce.byteLength);
116
+ return base64UrlEncode(combined);
117
+ }, generateEncryptionKey = () => generateSecureToken(AES_KEY_BYTES), generateSecureToken = (byteLength = DEFAULT_TOKEN_BYTES) => {
118
+ const bytes = new Uint8Array(byteLength);
119
+ crypto.getRandomValues(bytes);
120
+ return base64UrlEncode(bytes);
121
+ }, generateTotp = async ({
122
+ digits = TOTP_DIGITS,
123
+ now = Date.now(),
124
+ period = TOTP_PERIOD_SECONDS,
125
+ secret
126
+ }) => {
127
+ const counter = Math.floor(now / MILLISECONDS_IN_A_SECOND / period);
128
+ return generateHotp(base32Decode(secret), counter, digits);
129
+ }, generateTotpSecret = (byteLength = TOTP_SECRET_BYTES) => {
130
+ const bytes = new Uint8Array(byteLength);
131
+ crypto.getRandomValues(bytes);
132
+ return base32Encode(bytes);
133
+ }, hashPassword = (password) => Bun.password.hash(password, { algorithm: "argon2id" }), hashToken = async (token) => base64UrlEncode(await sha256(token)), verifyPassword = (password, hash) => Bun.password.verify(password, hash), verifyTotp = async ({
134
+ digits = TOTP_DIGITS,
135
+ now = Date.now(),
136
+ period = TOTP_PERIOD_SECONDS,
137
+ secret,
138
+ token,
139
+ window = DEFAULT_TOTP_WINDOW
140
+ }) => {
141
+ const secretBytes = base32Decode(secret);
142
+ const counter = Math.floor(now / MILLISECONDS_IN_A_SECOND / period);
143
+ const drifts = Array.from({ length: window * 2 + 1 }, (_, offset) => counter - window + offset);
144
+ const candidates = await Promise.all(drifts.map((value) => generateHotp(secretBytes, value, digits)));
145
+ const matches = await Promise.all(candidates.map((candidate) => constantTimeEqual(candidate, token)));
146
+ return matches.includes(true);
147
+ };
148
+ var init_crypto = __esm(() => {
149
+ init_constants();
150
+ textEncoder = new TextEncoder;
151
+ textDecoder = new TextDecoder;
152
+ });
153
+
19
154
  // node_modules/citra/dist/index.js
20
155
  var BASE64_BLOCK_SIZE = 4;
21
156
  var NUM_GENERATOR_BYTES = 32;
@@ -2537,165 +2672,14 @@ var createOAuth2Client = async (providerName, config) => {
2537
2672
  };
2538
2673
 
2539
2674
  // src/index.ts
2540
- import { Elysia as Elysia36 } from "elysia";
2675
+ import { Elysia as Elysia37 } from "elysia";
2541
2676
 
2542
2677
  // src/apikeys/routes.ts
2543
2678
  import { Elysia, t } from "elysia";
2544
2679
 
2545
- // src/constants.ts
2546
- var SECONDS_IN_A_MINUTE = 60;
2547
- var MILLISECONDS_IN_A_SECOND = 1000;
2548
- var MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
2549
- var MINUTES_IN_AN_HOUR = 60;
2550
- var HOURS_IN_A_DAY = 24;
2551
- var MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_A_DAY;
2552
- var MILLISECONDS_IN_AN_HOUR = MILLISECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR;
2553
- var COOKIE_MINUTES = 30;
2554
- var COOKIE_DURATION = SECONDS_IN_A_MINUTE * COOKIE_MINUTES;
2555
- var DEFAULT_MAX_SESSIONS = 1e4;
2556
-
2557
- // src/crypto.ts
2558
- var DEFAULT_TOKEN_BYTES = 32;
2559
- var AES_KEY_BYTES = 32;
2560
- var AES_IV_BYTES = 12;
2561
- var HOTP_COUNTER_BYTES = 8;
2562
- var TOTP_SECRET_BYTES = 20;
2563
- var TOTP_DIGITS = 6;
2564
- var TOTP_PERIOD_SECONDS = 30;
2565
- var DEFAULT_TOTP_WINDOW = 1;
2566
- var DECIMAL_RADIX = 10;
2567
- var LAST_NIBBLE_MASK = 15;
2568
- var SIGN_BIT_MASK = 2147483647;
2569
- var BASE32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
2570
- var BASE32_GROUP_BITS = 5;
2571
- var BASE32_MASK = 31;
2572
- var BYTE_BITS = 8;
2573
- var textEncoder = new TextEncoder;
2574
- var textDecoder = new TextDecoder;
2575
- var base64UrlEncode = (bytes) => Buffer.from(bytes).toString("base64url");
2576
- var base64UrlDecode = (encoded) => new Uint8Array(Buffer.from(encoded, "base64url"));
2577
- var sha256 = async (input) => {
2578
- const digest = await crypto.subtle.digest("SHA-256", textEncoder.encode(input));
2579
- return new Uint8Array(digest);
2580
- };
2581
- var hmacSha1 = async (key, message) => {
2582
- const cryptoKey = await crypto.subtle.importKey("raw", key, { hash: "SHA-1", name: "HMAC" }, false, ["sign"]);
2583
- const signature = await crypto.subtle.sign("HMAC", cryptoKey, message);
2584
- return new Uint8Array(signature);
2585
- };
2586
- var counterToBytes = (counter) => {
2587
- const bytes = new Uint8Array(HOTP_COUNTER_BYTES);
2588
- new DataView(bytes.buffer).setBigUint64(0, BigInt(counter), false);
2589
- return bytes;
2590
- };
2591
- var generateHotp = async (secret, counter, digits = TOTP_DIGITS) => {
2592
- const hmac = await hmacSha1(secret, counterToBytes(counter));
2593
- const view = new DataView(hmac.buffer, hmac.byteOffset, hmac.byteLength);
2594
- const offset = view.getUint8(hmac.byteLength - 1) & LAST_NIBBLE_MASK;
2595
- const truncated = view.getUint32(offset, false) & SIGN_BIT_MASK;
2596
- const otp = truncated % DECIMAL_RADIX ** digits;
2597
- return otp.toString().padStart(digits, "0");
2598
- };
2599
- var importAesKey = (keyMaterial) => crypto.subtle.importKey("raw", base64UrlDecode(keyMaterial), { name: "AES-GCM" }, false, ["decrypt", "encrypt"]);
2600
- var base32Decode = (encoded) => {
2601
- const normalized = encoded.toUpperCase().replace(/[^A-Z2-7]/gu, "");
2602
- const bits = [...normalized].map((char) => BASE32_ALPHABET.indexOf(char).toString(2).padStart(BASE32_GROUP_BITS, "0")).join("");
2603
- const byteChunks = bits.match(/.{8}/gu) ?? [];
2604
- return new Uint8Array(byteChunks.map((chunk) => parseInt(chunk, 2)));
2605
- };
2606
- var base32Encode = (bytes) => {
2607
- const bits = Array.from(bytes, (byte) => byte.toString(2).padStart(BYTE_BITS, "0")).join("");
2608
- const groups = bits.match(/.{1,5}/gu) ?? [];
2609
- return groups.map((group) => BASE32_ALPHABET[parseInt(group.padEnd(BASE32_GROUP_BITS, "0"), 2) & BASE32_MASK] ?? "").join("");
2610
- };
2611
- var constantTimeEqual = async (left, right) => {
2612
- const [leftDigest, rightDigest] = await Promise.all([
2613
- sha256(left),
2614
- sha256(right)
2615
- ]);
2616
- const leftView = new DataView(leftDigest.buffer, leftDigest.byteOffset, leftDigest.byteLength);
2617
- const rightView = new DataView(rightDigest.buffer, rightDigest.byteOffset, rightDigest.byteLength);
2618
- let mismatch = 0;
2619
- for (let index = 0;index < leftDigest.byteLength; index += 1) {
2620
- mismatch |= leftView.getUint8(index) ^ rightView.getUint8(index);
2621
- }
2622
- return mismatch === 0;
2623
- };
2624
- var createTotpKeyUri = ({
2625
- accountName,
2626
- digits = TOTP_DIGITS,
2627
- issuer,
2628
- period = TOTP_PERIOD_SECONDS,
2629
- secret
2630
- }) => {
2631
- const params = new URLSearchParams({
2632
- algorithm: "SHA1",
2633
- digits: `${digits}`,
2634
- issuer,
2635
- period: `${period}`,
2636
- secret
2637
- });
2638
- const label = encodeURIComponent(`${issuer}:${accountName}`);
2639
- return `otpauth://totp/${label}?${params.toString()}`;
2640
- };
2641
- var decryptSecret = async (ciphertext, keyMaterial) => {
2642
- const key = await importAesKey(keyMaterial);
2643
- const combined = base64UrlDecode(ciphertext);
2644
- const nonce = combined.subarray(0, AES_IV_BYTES);
2645
- const data = combined.subarray(AES_IV_BYTES);
2646
- const plaintext = await crypto.subtle.decrypt({ iv: nonce, name: "AES-GCM" }, key, data);
2647
- return textDecoder.decode(plaintext);
2648
- };
2649
- var encryptSecret = async (plaintext, keyMaterial) => {
2650
- const key = await importAesKey(keyMaterial);
2651
- const nonce = new Uint8Array(AES_IV_BYTES);
2652
- crypto.getRandomValues(nonce);
2653
- const ciphertext = await crypto.subtle.encrypt({ iv: nonce, name: "AES-GCM" }, key, textEncoder.encode(plaintext));
2654
- const combined = new Uint8Array(nonce.byteLength + ciphertext.byteLength);
2655
- combined.set(nonce, 0);
2656
- combined.set(new Uint8Array(ciphertext), nonce.byteLength);
2657
- return base64UrlEncode(combined);
2658
- };
2659
- var generateEncryptionKey = () => generateSecureToken(AES_KEY_BYTES);
2660
- var generateSecureToken = (byteLength = DEFAULT_TOKEN_BYTES) => {
2661
- const bytes = new Uint8Array(byteLength);
2662
- crypto.getRandomValues(bytes);
2663
- return base64UrlEncode(bytes);
2664
- };
2665
- var generateTotp = async ({
2666
- digits = TOTP_DIGITS,
2667
- now = Date.now(),
2668
- period = TOTP_PERIOD_SECONDS,
2669
- secret
2670
- }) => {
2671
- const counter = Math.floor(now / MILLISECONDS_IN_A_SECOND / period);
2672
- return generateHotp(base32Decode(secret), counter, digits);
2673
- };
2674
- var generateTotpSecret = (byteLength = TOTP_SECRET_BYTES) => {
2675
- const bytes = new Uint8Array(byteLength);
2676
- crypto.getRandomValues(bytes);
2677
- return base32Encode(bytes);
2678
- };
2679
- var hashPassword = (password) => Bun.password.hash(password, { algorithm: "argon2id" });
2680
- var hashToken = async (token) => base64UrlEncode(await sha256(token));
2681
- var verifyPassword = (password, hash) => Bun.password.verify(password, hash);
2682
- var verifyTotp = async ({
2683
- digits = TOTP_DIGITS,
2684
- now = Date.now(),
2685
- period = TOTP_PERIOD_SECONDS,
2686
- secret,
2687
- token,
2688
- window = DEFAULT_TOTP_WINDOW
2689
- }) => {
2690
- const secretBytes = base32Decode(secret);
2691
- const counter = Math.floor(now / MILLISECONDS_IN_A_SECOND / period);
2692
- const drifts = Array.from({ length: window * 2 + 1 }, (_, offset) => counter - window + offset);
2693
- const candidates = await Promise.all(drifts.map((value) => generateHotp(secretBytes, value, digits)));
2694
- const matches = await Promise.all(candidates.map((candidate) => constantTimeEqual(candidate, token)));
2695
- return matches.includes(true);
2696
- };
2697
-
2698
2680
  // src/apikeys/config.ts
2681
+ init_constants();
2682
+ init_crypto();
2699
2683
  var DEFAULT_TOKEN_ROUTE = "/oauth2/token";
2700
2684
  var ACCESS_TOKEN_PREFIX = "at_";
2701
2685
  var API_KEY_PREFIX = "sk_";
@@ -3202,6 +3186,7 @@ var protectPermissionPlugin = ({
3202
3186
  import { Elysia as Elysia4, t as t4 } from "elysia";
3203
3187
 
3204
3188
  // src/utils.ts
3189
+ init_constants();
3205
3190
  var defineAuthConfig = (configuration) => configuration;
3206
3191
  var defineAuthHtmxConfig = (htmxConfig) => htmxConfig;
3207
3192
  var defineAuthSettings = (settings) => settings;
@@ -3542,9 +3527,11 @@ var complianceRoutes = ({
3542
3527
  import { Elysia as Elysia9 } from "elysia";
3543
3528
 
3544
3529
  // src/credentials/emailVerification.ts
3530
+ init_crypto();
3545
3531
  import { Elysia as Elysia5, t as t5 } from "elysia";
3546
3532
 
3547
3533
  // src/credentials/config.ts
3534
+ init_constants();
3548
3535
  var DEFAULT_CREDENTIAL_SESSION_TTL_MS = MILLISECONDS_IN_A_DAY;
3549
3536
  var DEFAULT_RESET_TOKEN_TTL_MS = MILLISECONDS_IN_AN_HOUR;
3550
3537
  var DEFAULT_VERIFICATION_TOKEN_TTL_MS = MILLISECONDS_IN_A_DAY;
@@ -3586,9 +3573,12 @@ var credentialsEmailVerification = ({
3586
3573
  }, { body: t5.Object({ email: t5.String() }) });
3587
3574
 
3588
3575
  // src/credentials/login.ts
3576
+ init_constants();
3577
+ init_crypto();
3589
3578
  import { Elysia as Elysia6, t as t6 } from "elysia";
3590
3579
 
3591
3580
  // src/credentials/import.ts
3581
+ init_crypto();
3592
3582
  var normalizeEmail = (email) => email.trim().toLowerCase();
3593
3583
  var buildCredential = (email, emailVerified, passwordHash, userId) => ({
3594
3584
  createdAt: Date.now(),
@@ -3866,6 +3856,7 @@ var credentialsLogin = ({
3866
3856
  });
3867
3857
 
3868
3858
  // src/credentials/passwordReset.ts
3859
+ init_crypto();
3869
3860
  import { Elysia as Elysia7, t as t7 } from "elysia";
3870
3861
  var credentialsPasswordReset = ({
3871
3862
  credentialStore,
@@ -3924,6 +3915,7 @@ var credentialsPasswordReset = ({
3924
3915
  });
3925
3916
 
3926
3917
  // src/credentials/register.ts
3918
+ init_crypto();
3927
3919
  import { Elysia as Elysia8, t as t8 } from "elysia";
3928
3920
  var credentialsRegister = ({
3929
3921
  authSessionStore,
@@ -4201,6 +4193,7 @@ var createAuthHtmxRoutes = (config) => {
4201
4193
  };
4202
4194
 
4203
4195
  // src/lockout/config.ts
4196
+ init_constants();
4204
4197
  var DEFAULT_MAX_ATTEMPTS = 5;
4205
4198
  var LOCKOUT_WINDOW_MINUTES = 15;
4206
4199
  var DEFAULT_WINDOW_MS = MILLISECONDS_IN_A_MINUTE * LOCKOUT_WINDOW_MINUTES;
@@ -4237,9 +4230,11 @@ var createMfaGate = ({ getUserId, mfaStore }) => async (user) => isMfaEnrolled(a
4237
4230
  import { Elysia as Elysia14 } from "elysia";
4238
4231
 
4239
4232
  // src/mfa/challenge.ts
4233
+ init_crypto();
4240
4234
  import { Elysia as Elysia12, t as t10 } from "elysia";
4241
4235
 
4242
4236
  // src/mfa/backupCodes.ts
4237
+ init_crypto();
4243
4238
  var BACKUP_CODE_BYTES = 8;
4244
4239
  var consumeBackupCode = async (code, hashes) => {
4245
4240
  const codeHash = await hashToken(code);
@@ -4255,11 +4250,13 @@ var generateBackupCodes = async (count) => {
4255
4250
  };
4256
4251
 
4257
4252
  // src/mfa/config.ts
4253
+ init_constants();
4258
4254
  var DEFAULT_BACKUP_CODE_COUNT = 10;
4259
4255
  var DEFAULT_MFA_ISSUER = "AbsoluteAuth";
4260
4256
  var DEFAULT_MFA_SESSION_TTL_MS = MILLISECONDS_IN_A_DAY;
4261
4257
 
4262
4258
  // src/mfa/secret.ts
4259
+ init_crypto();
4263
4260
  var decryptTotpSecret = (ciphertext, encryptionKey) => encryptionKey ? decryptSecret(ciphertext, encryptionKey) : Promise.resolve(ciphertext);
4264
4261
  var encryptTotpSecret = (secret, encryptionKey) => encryptionKey ? encryptSecret(secret, encryptionKey) : Promise.resolve(secret);
4265
4262
 
@@ -4337,6 +4334,7 @@ var mfaChallenge = ({
4337
4334
  });
4338
4335
 
4339
4336
  // src/mfa/totp.ts
4337
+ init_crypto();
4340
4338
  import { Elysia as Elysia13, t as t11 } from "elysia";
4341
4339
  var mfaTotpRoutes = ({
4342
4340
  authSessionStore,
@@ -4423,8 +4421,14 @@ var mfaTotpRoutes = ({
4423
4421
  var mfaRoutes = (config) => new Elysia14().use(mfaTotpRoutes(config)).use(mfaChallenge(config));
4424
4422
 
4425
4423
  // src/oidc/routes.ts
4424
+ init_constants();
4425
+ init_crypto();
4426
4426
  import { Elysia as Elysia15, t as t12 } from "elysia";
4427
4427
 
4428
+ // src/oidc/config.ts
4429
+ init_constants();
4430
+ init_crypto();
4431
+
4428
4432
  // src/oidc/keys.ts
4429
4433
  var ENCODER = new TextEncoder;
4430
4434
  var ES256 = { hash: "SHA-256", name: "ECDSA" };
@@ -4939,6 +4943,7 @@ var exchangeBackchannelAuth = async ({
4939
4943
  };
4940
4944
 
4941
4945
  // src/oidc/clientAuth.ts
4946
+ init_constants();
4942
4947
  var CLIENT_ASSERTION_TYPE = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer";
4943
4948
  var MAX_ASSERTION_LIFETIME_MINUTES = 5;
4944
4949
  var SECONDS_PER_MINUTE = 60;
@@ -5047,6 +5052,329 @@ var verifyJwtSignedByClient = ({
5047
5052
  client
5048
5053
  }) => verifyJwtSignedByClientImpl(client, jwt);
5049
5054
 
5055
+ // src/oidc/vci.ts
5056
+ init_crypto();
5057
+
5058
+ // src/vc/sdJwt.ts
5059
+ var SALT_BYTES = 16;
5060
+ var SD_ALG = "sha-256";
5061
+ var toBase64Url2 = (bytes) => Buffer.from(bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)).toString("base64url");
5062
+ var fromBase64Url2 = (value) => new Uint8Array(Buffer.from(value, "base64url"));
5063
+ var randomSalt = () => {
5064
+ const bytes = new Uint8Array(SALT_BYTES);
5065
+ crypto.getRandomValues(bytes);
5066
+ return toBase64Url2(bytes);
5067
+ };
5068
+ var sha2562 = async (input) => {
5069
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(input));
5070
+ return toBase64Url2(digest);
5071
+ };
5072
+ var encodeDisclosure = (claimName, claimValue) => {
5073
+ const salt = randomSalt();
5074
+ const tuple = JSON.stringify([salt, claimName, claimValue]);
5075
+ const encoded = Buffer.from(tuple).toString("base64url");
5076
+ return { claimName, claimValue, encoded, salt };
5077
+ };
5078
+ var issueSdJwtVc = async (input) => {
5079
+ const disclosures = Object.entries(input.selective).map(([name, value]) => encodeDisclosure(name, value));
5080
+ const sdDigests = await Promise.all(disclosures.map((disclosure) => sha2562(disclosure.encoded)));
5081
+ const payload = {
5082
+ ...input.base,
5083
+ _sd: sdDigests,
5084
+ _sd_alg: SD_ALG
5085
+ };
5086
+ if (input.holderJwk !== undefined)
5087
+ payload.cnf = { jwk: input.holderJwk };
5088
+ const jwt = await signJwt(payload, input.signingKey);
5089
+ const tail = disclosures.map((disclosure) => disclosure.encoded).join("~");
5090
+ return `${jwt}~${tail}~`;
5091
+ };
5092
+ var parseSdJwtVc = (token) => {
5093
+ const segments = token.split("~");
5094
+ const jwt = segments[0] ?? "";
5095
+ const tail = segments.slice(1);
5096
+ const last = tail[tail.length - 1];
5097
+ const hasKeyBinding = last !== undefined && last !== "";
5098
+ const keyBindingJwt = hasKeyBinding ? last : undefined;
5099
+ const disclosureCount = hasKeyBinding ? tail.length - 1 : tail.length - 1;
5100
+ const disclosures = tail.slice(0, disclosureCount).filter((entry) => entry !== "");
5101
+ return { disclosures, jwt, keyBindingJwt };
5102
+ };
5103
+ var presentSdJwtVc = (parsed, selectedClaims, keyBindingJwt) => {
5104
+ const selectedSet = new Set(selectedClaims);
5105
+ const kept = parsed.disclosures.filter((encoded) => {
5106
+ const tuple = decodeDisclosure(encoded);
5107
+ return tuple !== undefined && selectedSet.has(tuple.claimName);
5108
+ });
5109
+ const tail = kept.join("~");
5110
+ const suffix = keyBindingJwt === undefined ? "" : keyBindingJwt;
5111
+ return `${parsed.jwt}~${tail}~${suffix}`;
5112
+ };
5113
+ var DISCLOSURE_TUPLE_LENGTH = 3;
5114
+ var decodeDisclosure = (encoded) => {
5115
+ try {
5116
+ const raw = Buffer.from(encoded, "base64url").toString("utf8");
5117
+ const tuple = JSON.parse(raw);
5118
+ if (!Array.isArray(tuple) || tuple.length !== DISCLOSURE_TUPLE_LENGTH) {
5119
+ return;
5120
+ }
5121
+ const [salt, claimName, claimValue] = tuple;
5122
+ if (typeof salt !== "string" || typeof claimName !== "string") {
5123
+ return;
5124
+ }
5125
+ const decoded = { claimName, claimValue, encoded, salt };
5126
+ return decoded;
5127
+ } catch {
5128
+ return;
5129
+ }
5130
+ };
5131
+ var verifySdJwtVc = async (input) => {
5132
+ const parsed = parseSdJwtVc(input.token);
5133
+ const decoded = await verifyJwt(parsed.jwt, input.issuerPublicJwk);
5134
+ if (decoded === undefined)
5135
+ return;
5136
+ const rawPayload = decoded.payload;
5137
+ if (typeof rawPayload !== "object" || rawPayload === null)
5138
+ return;
5139
+ const payload = { ...rawPayload };
5140
+ const sdArray = payload._sd;
5141
+ const sdAlg = payload._sd_alg;
5142
+ if (!Array.isArray(sdArray) || sdAlg !== SD_ALG)
5143
+ return;
5144
+ const acceptedHashes = new Set(sdArray.filter((entry) => typeof entry === "string"));
5145
+ const disclosedClaims = {};
5146
+ for (const encoded of parsed.disclosures) {
5147
+ const hash = await sha2562(encoded);
5148
+ if (!acceptedHashes.has(hash))
5149
+ return;
5150
+ const tuple = decodeDisclosure(encoded);
5151
+ if (tuple === undefined)
5152
+ return;
5153
+ disclosedClaims[tuple.claimName] = tuple.claimValue;
5154
+ }
5155
+ const protectedClaims = {};
5156
+ for (const [key, value] of Object.entries(payload)) {
5157
+ if (key === "_sd" || key === "_sd_alg" || key === "cnf")
5158
+ continue;
5159
+ protectedClaims[key] = value;
5160
+ }
5161
+ const cnf = extractCnf(payload.cnf);
5162
+ const result = {
5163
+ cnf,
5164
+ disclosedClaims,
5165
+ keyBindingJwt: parsed.keyBindingJwt,
5166
+ protectedClaims
5167
+ };
5168
+ return result;
5169
+ };
5170
+ var extractCnf = (value) => {
5171
+ if (typeof value !== "object" || value === null)
5172
+ return;
5173
+ const jwk = Reflect.get(value, "jwk");
5174
+ if (typeof jwk !== "object" || jwk === null)
5175
+ return;
5176
+ const candidate = jwk;
5177
+ const narrowed = {
5178
+ crv: typeof candidate.crv === "string" ? candidate.crv : undefined,
5179
+ kty: typeof candidate.kty === "string" ? candidate.kty : undefined,
5180
+ x: typeof candidate.x === "string" ? candidate.x : undefined,
5181
+ y: typeof candidate.y === "string" ? candidate.y : undefined
5182
+ };
5183
+ return { jwk: narrowed };
5184
+ };
5185
+
5186
+ // src/oidc/vci.ts
5187
+ var PRE_AUTHORIZED_CODE_GRANT = "urn:ietf:params:oauth:grant-type:pre-authorized_code";
5188
+ var MS_PER_SECOND2 = 1000;
5189
+ var DEFAULT_OFFER_TTL_MS = 600000;
5190
+ var DEFAULT_ACCESS_TTL_MS = 600000;
5191
+ var DEFAULT_NONCE_TTL_MS = 300000;
5192
+ var PRE_AUTH_CODE_BYTES = 32;
5193
+ var C_NONCE_BYTES = 16;
5194
+ var DEFAULT_VCI_ROUTE = "/vci";
5195
+ var nowSeconds2 = (timeMs) => Math.floor(timeMs / MS_PER_SECOND2);
5196
+ var createCredentialOffer = async ({
5197
+ clientId,
5198
+ configurationId,
5199
+ now = Date.now(),
5200
+ store,
5201
+ ttlMs = DEFAULT_OFFER_TTL_MS,
5202
+ userId
5203
+ }) => {
5204
+ const preAuthorizedCode = generateSecureToken(PRE_AUTH_CODE_BYTES);
5205
+ const preAuthorizedCodeHash = await hashToken(preAuthorizedCode);
5206
+ const offer = {
5207
+ clientId,
5208
+ configurationId,
5209
+ createdAt: now,
5210
+ expiresAt: now + ttlMs,
5211
+ preAuthorizedCodeHash,
5212
+ redeemed: false,
5213
+ userId
5214
+ };
5215
+ await store.saveOffer(offer);
5216
+ return { offer, preAuthorizedCode };
5217
+ };
5218
+ var exchangePreAuthorizedCode = async ({
5219
+ config,
5220
+ issuer,
5221
+ now = Date.now(),
5222
+ preAuthorizedCode,
5223
+ signingKey
5224
+ }) => {
5225
+ const failFor = (error) => {
5226
+ const failure = { error, ok: false };
5227
+ return failure;
5228
+ };
5229
+ const hash = await hashToken(preAuthorizedCode);
5230
+ const offer = await config.credentialOfferStore.consumeOffer(hash);
5231
+ if (offer === undefined || offer.redeemed)
5232
+ return failFor("invalid_grant");
5233
+ if (offer.expiresAt < now)
5234
+ return failFor("expired_token");
5235
+ const ttlMs = config.accessTokenTtlMs ?? DEFAULT_ACCESS_TTL_MS;
5236
+ const accessToken = await signJwt({
5237
+ aud: issuer,
5238
+ exp: nowSeconds2(now + ttlMs),
5239
+ iat: nowSeconds2(now),
5240
+ iss: issuer,
5241
+ scope: `openid_credential:${offer.configurationId}`,
5242
+ sub: offer.userId,
5243
+ vci_configuration_id: offer.configurationId
5244
+ }, signingKey);
5245
+ const result = {
5246
+ access_token: accessToken,
5247
+ expires_in: Math.floor(ttlMs / MS_PER_SECOND2),
5248
+ ok: true,
5249
+ token_type: "Bearer"
5250
+ };
5251
+ if (config.credentialNonceStore !== undefined) {
5252
+ const nonce = generateSecureToken(C_NONCE_BYTES);
5253
+ const nonceTtlMs = config.nonceTtlMs ?? DEFAULT_NONCE_TTL_MS;
5254
+ await config.credentialNonceStore.saveNonce({
5255
+ expiresAt: now + nonceTtlMs,
5256
+ nonceHash: await hashToken(nonce)
5257
+ });
5258
+ result.c_nonce = nonce;
5259
+ result.c_nonce_expires_in = Math.floor(nonceTtlMs / MS_PER_SECOND2);
5260
+ }
5261
+ return result;
5262
+ };
5263
+ var decodeJwtHeader = (jwt) => {
5264
+ const [header] = jwt.split(".");
5265
+ if (header === undefined)
5266
+ return;
5267
+ try {
5268
+ const decoded = JSON.parse(Buffer.from(header, "base64url").toString("utf8"));
5269
+ if (typeof decoded !== "object" || decoded === null)
5270
+ return;
5271
+ return decoded;
5272
+ } catch {
5273
+ return;
5274
+ }
5275
+ };
5276
+ var extractHolderJwk = (proofJwt) => {
5277
+ const header = decodeJwtHeader(proofJwt);
5278
+ if (header === undefined)
5279
+ return;
5280
+ const jwk = Reflect.get(header, "jwk");
5281
+ if (typeof jwk !== "object" || jwk === null)
5282
+ return;
5283
+ const candidate = jwk;
5284
+ return {
5285
+ crv: typeof candidate.crv === "string" ? candidate.crv : undefined,
5286
+ kty: typeof candidate.kty === "string" ? candidate.kty : undefined,
5287
+ x: typeof candidate.x === "string" ? candidate.x : undefined,
5288
+ y: typeof candidate.y === "string" ? candidate.y : undefined
5289
+ };
5290
+ };
5291
+ var buildIssuerMetadata = ({
5292
+ config,
5293
+ issuer,
5294
+ vciRoute
5295
+ }) => ({
5296
+ credential_configurations_supported: Object.fromEntries(config.credentialConfigurations.map((configuration) => [
5297
+ configuration.id,
5298
+ {
5299
+ claims: configuration.claims,
5300
+ credential_signing_alg_values_supported: ["ES256"],
5301
+ cryptographic_binding_methods_supported: ["jwk"],
5302
+ display: configuration.display,
5303
+ format: configuration.format,
5304
+ order: configuration.order,
5305
+ proof_types_supported: { jwt: { proof_signing_alg_values_supported: ["ES256"] } },
5306
+ vct: configuration.vct
5307
+ }
5308
+ ])),
5309
+ credential_endpoint: `${issuer}${vciRoute}/credential`,
5310
+ credential_issuer: issuer,
5311
+ nonce_endpoint: config.credentialNonceStore === undefined ? undefined : `${issuer}${vciRoute}/nonce`,
5312
+ token_endpoint: `${issuer}/oauth2/token`
5313
+ });
5314
+ var issueOk = (credential) => {
5315
+ const success = {
5316
+ credential,
5317
+ format: "vc+sd-jwt",
5318
+ ok: true
5319
+ };
5320
+ return success;
5321
+ };
5322
+ var issueFail = (error) => {
5323
+ const failure = { error, ok: false };
5324
+ return failure;
5325
+ };
5326
+ var issueCredential = async ({
5327
+ config,
5328
+ input,
5329
+ issuer,
5330
+ now = Date.now(),
5331
+ signingKey
5332
+ }) => {
5333
+ const requested = input.requestedFormat ?? "vc+sd-jwt";
5334
+ if (requested !== "vc+sd-jwt")
5335
+ return issueFail("unsupported_credential_format");
5336
+ const decoded = await verifyJwt(input.accessToken, signingKey.publicJwk);
5337
+ if (decoded === undefined)
5338
+ return issueFail("invalid_token");
5339
+ const rawPayload = decoded.payload;
5340
+ if (typeof rawPayload !== "object" || rawPayload === null) {
5341
+ return issueFail("invalid_token");
5342
+ }
5343
+ const payload = { ...rawPayload };
5344
+ if (typeof payload.exp === "number" && payload.exp * MS_PER_SECOND2 < now) {
5345
+ return issueFail("invalid_token");
5346
+ }
5347
+ const userId = payload.sub;
5348
+ const configurationId = payload.vci_configuration_id;
5349
+ if (typeof userId !== "string" || typeof configurationId !== "string") {
5350
+ return issueFail("invalid_token");
5351
+ }
5352
+ const configuration = config.credentialConfigurations.find((entry) => entry.id === configurationId);
5353
+ if (configuration === undefined)
5354
+ return issueFail("invalid_credential_request");
5355
+ const holderJwk = input.proofJwt === undefined ? undefined : extractHolderJwk(input.proofJwt);
5356
+ if (input.proofJwt !== undefined && holderJwk === undefined) {
5357
+ return issueFail("invalid_proof");
5358
+ }
5359
+ const selective = await config.resolveCredentialClaims({
5360
+ configurationId,
5361
+ userId
5362
+ });
5363
+ const protectedClaims = config.resolveProtectedClaims ? await config.resolveProtectedClaims({ configurationId, userId }) : {};
5364
+ const credential = await issueSdJwtVc({
5365
+ base: {
5366
+ iat: nowSeconds2(now),
5367
+ iss: issuer,
5368
+ ...protectedClaims,
5369
+ vct: configuration.vct
5370
+ },
5371
+ holderJwk,
5372
+ selective,
5373
+ signingKey
5374
+ });
5375
+ return issueOk(credential);
5376
+ };
5377
+
5050
5378
  // src/oidc/mtls.ts
5051
5379
  var RFC9440_HEADER = "client-cert";
5052
5380
  var SF_BINARY_PREFIX = ":";
@@ -5097,6 +5425,7 @@ var verifyCertificateBoundToken = async ({
5097
5425
  };
5098
5426
 
5099
5427
  // src/oidc/dpop.ts
5428
+ init_constants();
5100
5429
  var DEFAULT_MAX_AGE_MS = 60000;
5101
5430
  var SECONDS_TO_MS = 1000;
5102
5431
  var NONCE_WINDOW_SECONDS = 120;
@@ -5180,6 +5509,7 @@ var verifyDpopProof = async ({
5180
5509
  };
5181
5510
 
5182
5511
  // src/oidc/logout.ts
5512
+ init_constants();
5183
5513
  var BACKCHANNEL_LOGOUT_EVENT = "http://schemas.openid.net/event/backchannel-logout";
5184
5514
  var buildLogoutClaims = ({
5185
5515
  clientId,
@@ -5312,7 +5642,7 @@ var fanOutBackchannelLogout = async ({
5312
5642
  };
5313
5643
 
5314
5644
  // src/oidc/jar.ts
5315
- var MS_PER_SECOND2 = 1000;
5645
+ var MS_PER_SECOND3 = 1000;
5316
5646
  var numberClaim = (value) => typeof value === "number" ? value : undefined;
5317
5647
  var stringClaim = (value) => typeof value === "string" ? value : undefined;
5318
5648
  var arrayClaim = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string") ? value : undefined;
@@ -5337,7 +5667,7 @@ var parseSignedRequestObject = async ({
5337
5667
  if (!audMatches) {
5338
5668
  return { error: "invalid_request_object", ok: false };
5339
5669
  }
5340
- if (exp !== undefined && exp * MS_PER_SECOND2 <= now) {
5670
+ if (exp !== undefined && exp * MS_PER_SECOND3 <= now) {
5341
5671
  return { error: "invalid_request_object", ok: false };
5342
5672
  }
5343
5673
  const envelope = new Set(["aud", "exp", "iat", "iss", "jti", "nbf"]);
@@ -5346,6 +5676,8 @@ var parseSignedRequestObject = async ({
5346
5676
  };
5347
5677
 
5348
5678
  // src/oidc/par.ts
5679
+ init_constants();
5680
+ init_crypto();
5349
5681
  var REQUEST_URI_BYTES = 32;
5350
5682
  var DEFAULT_PAR_TTL_SECONDS = 90;
5351
5683
  var DEFAULT_PAR_TTL_MS = DEFAULT_PAR_TTL_SECONDS * MILLISECONDS_IN_A_SECOND;
@@ -5455,6 +5787,7 @@ var fetchUserInfo = async ({
5455
5787
  var userInfoChallengeHeader = (error) => `Bearer realm="userinfo", error="${error}"`;
5456
5788
 
5457
5789
  // src/oidc/registration.ts
5790
+ init_crypto();
5458
5791
  var REG_TOKEN_BYTES = 32;
5459
5792
  var CLIENT_ID_BYTES = 16;
5460
5793
  var mintRegistrationToken = async (clientId) => {
@@ -5976,6 +6309,9 @@ var oidcProviderRoutes = (config) => {
5976
6309
  if (config.backchannelAuthStore) {
5977
6310
  grantTypes.push(CIBA_GRANT_TYPE);
5978
6311
  }
6312
+ if (config.vciConfig !== undefined) {
6313
+ grantTypes.push(PRE_AUTHORIZED_CODE_GRANT);
6314
+ }
5979
6315
  const discovery = {
5980
6316
  authorization_endpoint: `${issuer}${authorizeRoute}`,
5981
6317
  backchannel_logout_session_supported: false,
@@ -6209,6 +6545,27 @@ var oidcProviderRoutes = (config) => {
6209
6545
  state: t12.Optional(t12.String())
6210
6546
  })
6211
6547
  }).post(tokenRoute, async ({ body, headers, request }) => {
6548
+ if (body.grant_type === PRE_AUTHORIZED_CODE_GRANT && config.vciConfig !== undefined) {
6549
+ const preAuthorizedCode = body["pre-authorized_code"];
6550
+ if (typeof preAuthorizedCode !== "string") {
6551
+ return oauthError2(HTTP_BAD_REQUEST2, "invalid_request");
6552
+ }
6553
+ const result = await exchangePreAuthorizedCode({
6554
+ config: config.vciConfig,
6555
+ issuer: config.issuer,
6556
+ preAuthorizedCode,
6557
+ signingKey: config.vciConfig.signingKey ?? config.signingKey
6558
+ });
6559
+ if (!result.ok)
6560
+ return oauthError2(HTTP_BAD_REQUEST2, result.error);
6561
+ return jsonResponse({
6562
+ access_token: result.access_token,
6563
+ c_nonce: result.c_nonce,
6564
+ c_nonce_expires_in: result.c_nonce_expires_in,
6565
+ expires_in: result.expires_in,
6566
+ token_type: result.token_type
6567
+ }, HTTP_OK2);
6568
+ }
6212
6569
  const basic = readBasicAuth2(headers.authorization);
6213
6570
  const auth = await authenticateTokenClient({
6214
6571
  basicClientId: basic.clientId,
@@ -6254,6 +6611,7 @@ var oidcProviderRoutes = (config) => {
6254
6611
  code_verifier: t12.Optional(t12.String()),
6255
6612
  device_code: t12.Optional(t12.String()),
6256
6613
  grant_type: t12.Optional(t12.String()),
6614
+ "pre-authorized_code": t12.Optional(t12.String()),
6257
6615
  redirect_uri: t12.Optional(t12.String()),
6258
6616
  refresh_token: t12.Optional(t12.String()),
6259
6617
  resource: t12.Optional(t12.String()),
@@ -6638,12 +6996,14 @@ var oidcProviderRoutes = (config) => {
6638
6996
  import { Elysia as Elysia16, t as t13 } from "elysia";
6639
6997
 
6640
6998
  // src/organizations/config.ts
6999
+ init_constants();
6641
7000
  var INVITATION_TTL_DAYS = 7;
6642
7001
  var DEFAULT_INVITATION_TTL_MS = MILLISECONDS_IN_A_DAY * INVITATION_TTL_DAYS;
6643
7002
  var DEFAULT_ORGANIZATIONS_ROUTE = "/auth/organizations";
6644
7003
  var DEFAULT_OWNER_ROLES = ["owner"];
6645
7004
 
6646
7005
  // src/organizations/operations.ts
7006
+ init_crypto();
6647
7007
  var acceptInvitation = async ({
6648
7008
  organizationStore,
6649
7009
  token,
@@ -6996,9 +7356,11 @@ var organizationRoutes = ({
6996
7356
  };
6997
7357
 
6998
7358
  // src/passwordless/routes.ts
7359
+ init_crypto();
6999
7360
  import { Elysia as Elysia17, t as t14 } from "elysia";
7000
7361
 
7001
7362
  // src/passwordless/config.ts
7363
+ init_constants();
7002
7364
  var SECONDS_IN_TEN_MINUTES = 600;
7003
7365
  var DEFAULT_OTP_DIGITS = 6;
7004
7366
  var DEFAULT_MAGIC_LINK_TTL_MS = MILLISECONDS_IN_A_SECOND * SECONDS_IN_TEN_MINUTES;
@@ -7132,6 +7494,7 @@ var passwordlessRoutes = ({
7132
7494
  import { Elysia as Elysia18, t as t15 } from "elysia";
7133
7495
 
7134
7496
  // src/scim/config.ts
7497
+ init_crypto();
7135
7498
  var DEFAULT_SCIM_ROUTE = "/scim/v2";
7136
7499
  var SCIM_TOKEN_BYTES = 32;
7137
7500
  var BEARER_PREFIX3 = "Bearer ";
@@ -7158,15 +7521,18 @@ var resolveScimOrganization = async (scimTokenStore, authorization) => {
7158
7521
  };
7159
7522
 
7160
7523
  // src/sso/config.ts
7524
+ init_constants();
7161
7525
  var DEFAULT_SSO_ROUTE = "/sso";
7162
7526
  var DEFAULT_SSO_SESSION_TTL_MS = MILLISECONDS_IN_A_DAY;
7163
7527
 
7164
7528
  // src/portal/config.ts
7529
+ init_constants();
7165
7530
  var SETUP_TTL_DAYS = 3;
7166
7531
  var DEFAULT_PORTAL_ROUTE = "/auth/portal";
7167
7532
  var DEFAULT_SETUP_SESSION_TTL_MS = MILLISECONDS_IN_A_DAY * SETUP_TTL_DAYS;
7168
7533
 
7169
7534
  // src/portal/operations.ts
7535
+ init_crypto();
7170
7536
  var BEARER_PREFIX4 = "Bearer ";
7171
7537
  var createSetupSession = async ({
7172
7538
  capabilities,
@@ -7593,6 +7959,7 @@ var resolveProviderClientConfiguration = ({
7593
7959
  };
7594
7960
 
7595
7961
  // src/routes/authorize.ts
7962
+ init_constants();
7596
7963
  import { Elysia as Elysia20, t as t17 } from "elysia";
7597
7964
  var parseReferer = (headerReferer) => {
7598
7965
  if (!headerReferer)
@@ -7968,6 +8335,7 @@ var profile = ({
7968
8335
  });
7969
8336
 
7970
8337
  // src/routes/refresh.ts
8338
+ init_constants();
7971
8339
  import { Elysia as Elysia23, t as t20 } from "elysia";
7972
8340
  var refresh = ({
7973
8341
  authSessionStore,
@@ -8315,10 +8683,26 @@ var GROUP_SCHEMA = "urn:ietf:params:scim:schemas:core:2.0:Group";
8315
8683
  var LIST_SCHEMA = "urn:ietf:params:scim:api:messages:2.0:ListResponse";
8316
8684
  var ERROR_SCHEMA = "urn:ietf:params:scim:api:messages:2.0:Error";
8317
8685
  var SPC_SCHEMA = "urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig";
8686
+ var RESOURCE_TYPE_SCHEMA = "urn:ietf:params:scim:schemas:core:2.0:ResourceType";
8318
8687
  var SCIM_CONTENT_TYPE = "application/scim+json";
8319
8688
  var FILTER_MAX_RESULTS = 200;
8320
8689
  var FILTER_PATTERN = /^\s*(\w[\w.]*)\s+eq\s+"([^"]*)"\s*$/u;
8321
- var toUserResource = (user, location) => {
8690
+ var mergeCustomSchemas = (resource, custom, map) => {
8691
+ if (custom === undefined || map === undefined)
8692
+ return;
8693
+ const extra = map.toScim(custom);
8694
+ for (const [key, value] of Object.entries(extra)) {
8695
+ resource[key] = value;
8696
+ }
8697
+ const extraSchemas = (map.schemas ?? []).map((schema) => schema.id);
8698
+ if (extraSchemas.length === 0)
8699
+ return;
8700
+ const { schemas } = resource;
8701
+ if (Array.isArray(schemas)) {
8702
+ resource.schemas = [...schemas, ...extraSchemas];
8703
+ }
8704
+ };
8705
+ var toUserResource = (user, location, map) => {
8322
8706
  const resource = {
8323
8707
  active: user.active,
8324
8708
  id: user.id,
@@ -8339,6 +8723,7 @@ var toUserResource = (user, location) => {
8339
8723
  if (user.email !== undefined) {
8340
8724
  resource.emails = [{ primary: true, value: user.email }];
8341
8725
  }
8726
+ mergeCustomSchemas(resource, user.custom, map);
8342
8727
  return resource;
8343
8728
  };
8344
8729
  var stringField = (source, field) => {
@@ -8353,7 +8738,7 @@ var primaryEmail = (emails) => {
8353
8738
  const flagged = emails.find((entry) => typeof entry === "object" && entry !== null && Reflect.get(entry, "primary") === true);
8354
8739
  return stringField(flagged ?? emails[0], "value");
8355
8740
  };
8356
- var parseUserInput = (body) => {
8741
+ var parseUserInput = (body, map) => {
8357
8742
  if (typeof body !== "object" || body === null)
8358
8743
  return;
8359
8744
  const userName = stringField(body, "userName");
@@ -8361,8 +8746,14 @@ var parseUserInput = (body) => {
8361
8746
  return;
8362
8747
  const active = Reflect.get(body, "active");
8363
8748
  const name = Reflect.get(body, "name");
8749
+ const bodyRecord = {};
8750
+ for (const key of Object.keys(body)) {
8751
+ bodyRecord[key] = Reflect.get(body, key);
8752
+ }
8753
+ const custom = map === undefined ? undefined : map.fromScim(bodyRecord);
8364
8754
  return {
8365
8755
  active: typeof active === "boolean" ? active : true,
8756
+ custom,
8366
8757
  displayName: stringField(body, "displayName"),
8367
8758
  email: primaryEmail(Reflect.get(body, "emails")),
8368
8759
  externalId: stringField(body, "externalId"),
@@ -8423,6 +8814,7 @@ var applyOperation = (target, operation) => {
8423
8814
  var applyPatch = (user, body) => {
8424
8815
  const next = {
8425
8816
  active: user.active,
8817
+ custom: user.custom,
8426
8818
  displayName: user.displayName,
8427
8819
  email: user.email,
8428
8820
  externalId: user.externalId,
@@ -8468,6 +8860,15 @@ var scimJson = (resource, httpStatus) => new Response(JSON.stringify(resource),
8468
8860
  status: httpStatus
8469
8861
  });
8470
8862
  var serviceProviderConfig = (location) => ({
8863
+ authenticationSchemes: [
8864
+ {
8865
+ description: "Authentication scheme using the OAuth Bearer Token Standard",
8866
+ name: "OAuth Bearer Token",
8867
+ primary: true,
8868
+ specUri: "https://www.rfc-editor.org/info/rfc6750",
8869
+ type: "oauthbearertoken"
8870
+ }
8871
+ ],
8471
8872
  bulk: { maxOperations: 0, maxPayloadSize: 0, supported: false },
8472
8873
  changePassword: { supported: false },
8473
8874
  etag: { supported: false },
@@ -8477,6 +8878,111 @@ var serviceProviderConfig = (location) => ({
8477
8878
  schemas: [SPC_SCHEMA],
8478
8879
  sort: { supported: false }
8479
8880
  });
8881
+ var CORE_USER_ATTRIBUTES = [
8882
+ { multiValued: false, name: "userName", required: true, type: "string" },
8883
+ { multiValued: false, name: "active", required: false, type: "boolean" },
8884
+ { multiValued: false, name: "displayName", required: false, type: "string" },
8885
+ { multiValued: false, name: "externalId", required: false, type: "string" },
8886
+ {
8887
+ multiValued: false,
8888
+ name: "name",
8889
+ required: false,
8890
+ subAttributes: [
8891
+ { multiValued: false, name: "givenName", required: false, type: "string" },
8892
+ { multiValued: false, name: "familyName", required: false, type: "string" }
8893
+ ],
8894
+ type: "complex"
8895
+ },
8896
+ {
8897
+ multiValued: true,
8898
+ name: "emails",
8899
+ required: false,
8900
+ subAttributes: [
8901
+ { multiValued: false, name: "value", required: false, type: "string" },
8902
+ { multiValued: false, name: "primary", required: false, type: "boolean" }
8903
+ ],
8904
+ type: "complex"
8905
+ }
8906
+ ];
8907
+ var CORE_GROUP_ATTRIBUTES = [
8908
+ { multiValued: false, name: "displayName", required: true, type: "string" },
8909
+ { multiValued: false, name: "externalId", required: false, type: "string" },
8910
+ {
8911
+ multiValued: true,
8912
+ name: "members",
8913
+ required: false,
8914
+ subAttributes: [
8915
+ { multiValued: false, name: "value", required: false, type: "string" },
8916
+ { multiValued: false, name: "display", required: false, type: "string" }
8917
+ ],
8918
+ type: "complex"
8919
+ }
8920
+ ];
8921
+ var CORE_USER_SCHEMA = {
8922
+ attributes: CORE_USER_ATTRIBUTES,
8923
+ description: "User Account",
8924
+ id: USER_SCHEMA,
8925
+ name: "User"
8926
+ };
8927
+ var CORE_GROUP_SCHEMA = {
8928
+ attributes: CORE_GROUP_ATTRIBUTES,
8929
+ description: "Group",
8930
+ id: GROUP_SCHEMA,
8931
+ name: "Group"
8932
+ };
8933
+ var schemaResource = (schema, location) => ({
8934
+ attributes: schema.attributes,
8935
+ description: schema.description ?? schema.name,
8936
+ id: schema.id,
8937
+ meta: { location, resourceType: "Schema" },
8938
+ name: schema.name
8939
+ });
8940
+ var schemaList = (location, extras = []) => {
8941
+ const all = [CORE_USER_SCHEMA, CORE_GROUP_SCHEMA, ...extras];
8942
+ const resources = all.map((schema) => schemaResource(schema, `${location}/${schema.id}`));
8943
+ return listResponse(resources);
8944
+ };
8945
+ var schemaOne = (location, id, extras = []) => {
8946
+ const all = [CORE_USER_SCHEMA, CORE_GROUP_SCHEMA, ...extras];
8947
+ const found = all.find((schema) => schema.id === id);
8948
+ if (found === undefined)
8949
+ return;
8950
+ return schemaResource(found, location);
8951
+ };
8952
+ var resourceTypeUser = (location, usersEndpoint, extensionSchemaIds) => ({
8953
+ description: "User Account",
8954
+ endpoint: usersEndpoint,
8955
+ id: "User",
8956
+ meta: { location, resourceType: "ResourceType" },
8957
+ name: "User",
8958
+ schema: USER_SCHEMA,
8959
+ schemaExtensions: extensionSchemaIds.map((schema) => ({
8960
+ required: false,
8961
+ schema
8962
+ })),
8963
+ schemas: [RESOURCE_TYPE_SCHEMA]
8964
+ });
8965
+ var resourceTypeGroup = (location, groupsEndpoint) => ({
8966
+ description: "Group",
8967
+ endpoint: groupsEndpoint,
8968
+ id: "Group",
8969
+ meta: { location, resourceType: "ResourceType" },
8970
+ name: "Group",
8971
+ schema: GROUP_SCHEMA,
8972
+ schemas: [RESOURCE_TYPE_SCHEMA]
8973
+ });
8974
+ var resourceTypeList = (location, usersEndpoint, groupsEndpoint, extras = []) => listResponse([
8975
+ resourceTypeUser(`${location}/User`, usersEndpoint, extras.map((schema) => schema.id)),
8976
+ resourceTypeGroup(`${location}/Group`, groupsEndpoint)
8977
+ ]);
8978
+ var resourceTypeOne = (location, id, usersEndpoint, groupsEndpoint, extras = []) => {
8979
+ if (id === "User") {
8980
+ return resourceTypeUser(location, usersEndpoint, extras.map((schema) => schema.id));
8981
+ }
8982
+ if (id === "Group")
8983
+ return resourceTypeGroup(location, groupsEndpoint);
8984
+ return;
8985
+ };
8480
8986
  var REMOVE_MEMBER_PATTERN = /^members\[\s*value\s+eq\s+"([^"]*)"\s*\]$/iu;
8481
8987
  var parseMembers = (value) => {
8482
8988
  if (!Array.isArray(value))
@@ -8577,6 +9083,7 @@ var SCIM_CONTENT_TYPE2 = "application/scim+json";
8577
9083
  var unauthorized = () => scimError(SCIM_UNAUTHORIZED, "Invalid or missing SCIM bearer token");
8578
9084
  var notImplemented = () => scimError(SCIM_NOT_IMPLEMENTED, "Group provisioning is not configured");
8579
9085
  var scimRoutes = ({
9086
+ customAttributes,
8580
9087
  getScimGroup,
8581
9088
  getScimUser,
8582
9089
  listScimGroups,
@@ -8595,8 +9102,17 @@ var scimRoutes = ({
8595
9102
  const groupsRoute = `${scimRoute}/Groups`;
8596
9103
  const groupRoute = `${scimRoute}/Groups/:id`;
8597
9104
  const spcRoute = `${scimRoute}/ServiceProviderConfig`;
9105
+ const schemasRoute = `${scimRoute}/Schemas`;
9106
+ const schemaRoute = `${scimRoute}/Schemas/:id`;
9107
+ const resourceTypesRoute = `${scimRoute}/ResourceTypes`;
9108
+ const resourceTypeRoute = `${scimRoute}/ResourceTypes/:id`;
9109
+ const extensionSchemas = customAttributes?.schemas ?? [];
8598
9110
  const userLocation = (requestUrl, id) => `${new URL(requestUrl).origin}${scimRoute}/Users/${id}`;
8599
9111
  const groupLocation = (requestUrl, id) => `${new URL(requestUrl).origin}${scimRoute}/Groups/${id}`;
9112
+ const schemasLocation = (requestUrl) => `${new URL(requestUrl).origin}${scimRoute}/Schemas`;
9113
+ const resourceTypesLocation = (requestUrl) => `${new URL(requestUrl).origin}${scimRoute}/ResourceTypes`;
9114
+ const usersEndpoint = `${scimRoute}/Users`;
9115
+ const groupsEndpoint = `${scimRoute}/Groups`;
8600
9116
  return new Elysia29().onParse(({ request }, contentType) => contentType === SCIM_CONTENT_TYPE2 ? request.json() : undefined).get(spcRoute, async ({ headers, request }) => {
8601
9117
  const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
8602
9118
  if (organizationId === undefined)
@@ -8606,12 +9122,12 @@ var scimRoutes = ({
8606
9122
  const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
8607
9123
  if (organizationId === undefined)
8608
9124
  return unauthorized();
8609
- const input = parseUserInput(body);
9125
+ const input = parseUserInput(body, customAttributes);
8610
9126
  if (input === undefined) {
8611
9127
  return scimError(SCIM_BAD_REQUEST, "Request body is not a valid SCIM User", "invalidValue");
8612
9128
  }
8613
9129
  const user = await onScimUserCreate({ input, organizationId });
8614
- return scimJson(toUserResource(user, userLocation(request.url, user.id)), SCIM_CREATED);
9130
+ return scimJson(toUserResource(user, userLocation(request.url, user.id), customAttributes), SCIM_CREATED);
8615
9131
  }).get(usersRoute, async ({ headers, query, request }) => {
8616
9132
  const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
8617
9133
  if (organizationId === undefined)
@@ -8620,7 +9136,7 @@ var scimRoutes = ({
8620
9136
  filter: parseFilter(query.filter),
8621
9137
  organizationId
8622
9138
  });
8623
- const resources = users.map((user) => toUserResource(user, userLocation(request.url, user.id)));
9139
+ const resources = users.map((user) => toUserResource(user, userLocation(request.url, user.id), customAttributes));
8624
9140
  return scimJson(listResponse(resources), SCIM_OK);
8625
9141
  }, { query: t26.Object({ filter: t26.Optional(t26.String()) }) }).get(userRoute, async ({ headers, params: { id }, request }) => {
8626
9142
  const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
@@ -8630,12 +9146,12 @@ var scimRoutes = ({
8630
9146
  if (user === undefined) {
8631
9147
  return scimError(SCIM_NOT_FOUND, "User not found");
8632
9148
  }
8633
- return scimJson(toUserResource(user, userLocation(request.url, id)), SCIM_OK);
9149
+ return scimJson(toUserResource(user, userLocation(request.url, id), customAttributes), SCIM_OK);
8634
9150
  }, { params: t26.Object({ id: t26.String() }) }).put(userRoute, async ({ body, headers, params: { id }, request }) => {
8635
9151
  const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
8636
9152
  if (organizationId === undefined)
8637
9153
  return unauthorized();
8638
- const input = parseUserInput(body);
9154
+ const input = parseUserInput(body, customAttributes);
8639
9155
  if (input === undefined) {
8640
9156
  return scimError(SCIM_BAD_REQUEST, "Request body is not a valid SCIM User", "invalidValue");
8641
9157
  }
@@ -8647,7 +9163,7 @@ var scimRoutes = ({
8647
9163
  if (user === undefined) {
8648
9164
  return scimError(SCIM_NOT_FOUND, "User not found");
8649
9165
  }
8650
- return scimJson(toUserResource(user, userLocation(request.url, id)), SCIM_OK);
9166
+ return scimJson(toUserResource(user, userLocation(request.url, id), customAttributes), SCIM_OK);
8651
9167
  }, { params: t26.Object({ id: t26.String() }) }).patch(userRoute, async ({ body, headers, params: { id }, request }) => {
8652
9168
  const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
8653
9169
  if (organizationId === undefined)
@@ -8664,7 +9180,7 @@ var scimRoutes = ({
8664
9180
  if (user === undefined) {
8665
9181
  return scimError(SCIM_NOT_FOUND, "User not found");
8666
9182
  }
8667
- return scimJson(toUserResource(user, userLocation(request.url, id)), SCIM_OK);
9183
+ return scimJson(toUserResource(user, userLocation(request.url, id), customAttributes), SCIM_OK);
8668
9184
  }, { params: t26.Object({ id: t26.String() }) }).delete(userRoute, async ({ headers, params: { id } }) => {
8669
9185
  const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
8670
9186
  if (organizationId === undefined)
@@ -8756,10 +9272,39 @@ var scimRoutes = ({
8756
9272
  return notImplemented();
8757
9273
  await onScimGroupDelete({ id, organizationId });
8758
9274
  return new Response(null, { status: SCIM_NO_CONTENT });
9275
+ }, { params: t26.Object({ id: t26.String() }) }).get(schemasRoute, async ({ headers, request }) => {
9276
+ const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
9277
+ if (organizationId === undefined)
9278
+ return unauthorized();
9279
+ return scimJson(schemaList(schemasLocation(request.url), extensionSchemas), SCIM_OK);
9280
+ }).get(schemaRoute, async ({ headers, params: { id }, request }) => {
9281
+ const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
9282
+ if (organizationId === undefined)
9283
+ return unauthorized();
9284
+ const schema = schemaOne(`${schemasLocation(request.url)}/${id}`, id, extensionSchemas);
9285
+ if (schema === undefined) {
9286
+ return scimError(SCIM_NOT_FOUND, "Schema not found");
9287
+ }
9288
+ return scimJson(schema, SCIM_OK);
9289
+ }, { params: t26.Object({ id: t26.String() }) }).get(resourceTypesRoute, async ({ headers, request }) => {
9290
+ const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
9291
+ if (organizationId === undefined)
9292
+ return unauthorized();
9293
+ return scimJson(resourceTypeList(resourceTypesLocation(request.url), usersEndpoint, groupsEndpoint, extensionSchemas), SCIM_OK);
9294
+ }).get(resourceTypeRoute, async ({ headers, params: { id }, request }) => {
9295
+ const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
9296
+ if (organizationId === undefined)
9297
+ return unauthorized();
9298
+ const resourceType = resourceTypeOne(`${resourceTypesLocation(request.url)}/${id}`, id, usersEndpoint, groupsEndpoint, extensionSchemas);
9299
+ if (resourceType === undefined) {
9300
+ return scimError(SCIM_NOT_FOUND, "ResourceType not found");
9301
+ }
9302
+ return scimJson(resourceType, SCIM_OK);
8759
9303
  }, { params: t26.Object({ id: t26.String() }) });
8760
9304
  };
8761
9305
 
8762
9306
  // src/session/cleanup.ts
9307
+ init_constants();
8763
9308
  import { Elysia as Elysia30 } from "elysia";
8764
9309
  var sessionCleanup = ({
8765
9310
  authSessionStore,
@@ -9008,6 +9553,7 @@ var ssoDiscoveryRoute = ({
9008
9553
  };
9009
9554
 
9010
9555
  // src/sso/oidcRoutes.ts
9556
+ init_constants();
9011
9557
  import { Elysia as Elysia32, t as t28 } from "elysia";
9012
9558
  var makeSsoCookieOptions = (secure) => ({
9013
9559
  httpOnly: true,
@@ -9428,9 +9974,11 @@ var samlSsoRoutes = ({
9428
9974
  };
9429
9975
 
9430
9976
  // src/webauthn/routes.ts
9977
+ init_constants();
9431
9978
  import { Elysia as Elysia34, t as t30 } from "elysia";
9432
9979
 
9433
9980
  // src/webauthn/config.ts
9981
+ init_constants();
9434
9982
  var FIVE_MINUTES_MS = 300000;
9435
9983
  var DEFAULT_WEBAUTHN_CHALLENGE_TTL_MS = FIVE_MINUTES_MS;
9436
9984
  var DEFAULT_WEBAUTHN_ROUTE = "/auth/webauthn";
@@ -9616,7 +10164,11 @@ var webauthnRoutes = ({
9616
10164
  });
9617
10165
  };
9618
10166
 
10167
+ // src/webhooks/dispatcher.ts
10168
+ init_constants();
10169
+
9619
10170
  // src/webhooks/config.ts
10171
+ init_constants();
9620
10172
  var DEFAULT_TIMEOUT_SECONDS = 5;
9621
10173
  var DEFAULT_RETRY_ATTEMPTS = 3;
9622
10174
  var DEFAULT_RETRY_INITIAL_DELAY_MS = MILLISECONDS_IN_A_SECOND;
@@ -9629,6 +10181,7 @@ var DEFAULT_WEBHOOK_RETRY = {
9629
10181
  var DEFAULT_WEBHOOK_TIMEOUT_MS = MILLISECONDS_IN_A_SECOND * DEFAULT_TIMEOUT_SECONDS;
9630
10182
 
9631
10183
  // src/webhooks/sign.ts
10184
+ init_crypto();
9632
10185
  var textEncoder2 = new TextEncoder;
9633
10186
  var importHmacKey = (secret) => crypto.subtle.importKey("raw", textEncoder2.encode(secret), { hash: "SHA-256", name: "HMAC" }, false, ["sign"]);
9634
10187
  var signWebhook = async ({
@@ -9856,6 +10409,7 @@ var createActionPipeline = (actions) => ({
9856
10409
  }
9857
10410
  });
9858
10411
  // src/compliance/cipher.ts
10412
+ init_crypto();
9859
10413
  var createSecretCipher = (keyMaterial) => ({
9860
10414
  decrypt: (ciphertext) => decryptSecret(ciphertext, keyMaterial),
9861
10415
  encrypt: (plaintext) => encryptSecret(plaintext, keyMaterial)
@@ -20615,6 +21169,7 @@ var createInMemoryLinkedProviderStores = (input = {}) => {
20615
21169
  return { bindingStore, grantStore };
20616
21170
  };
20617
21171
  // src/session/impersonation.ts
21172
+ init_constants();
20618
21173
  var DEFAULT_IMPERSONATION_TTL_MS = MILLISECONDS_IN_AN_HOUR;
20619
21174
  var endImpersonation = async ({
20620
21175
  authSessionStore,
@@ -20697,6 +21252,7 @@ var startImpersonation = async ({
20697
21252
  return sessionId;
20698
21253
  };
20699
21254
  // src/session/anonymous.ts
21255
+ init_constants();
20700
21256
  var DEFAULT_GUEST_TTL_MS = MILLISECONDS_IN_A_DAY;
20701
21257
  var createAnonymousSession = async ({
20702
21258
  authSessionStore,
@@ -20784,6 +21340,10 @@ var switchActiveSession = ({
20784
21340
  });
20785
21341
  return true;
20786
21342
  };
21343
+
21344
+ // src/index.ts
21345
+ init_crypto();
21346
+
20787
21347
  // src/tenancy.ts
20788
21348
  var hasOrganizationScope = (value) => typeof value.organizationId === "string" && value.organizationId.length > 0;
20789
21349
  // src/credentials/backgroundOps.ts
@@ -20793,7 +21353,7 @@ var DEFAULT_PAUSE_MS = 1700;
20793
21353
  var HIBP_NOT_FOUND = 404;
20794
21354
  var HIBP_RATE_LIMITED = 429;
20795
21355
  var MS_PER_DAY = 86400000;
20796
- var MS_PER_SECOND3 = 1000;
21356
+ var MS_PER_SECOND4 = 1000;
20797
21357
  var sleep = (delayMs) => new Promise((resolve) => {
20798
21358
  setTimeout(resolve, delayMs);
20799
21359
  });
@@ -20819,7 +21379,7 @@ var checkEmailBreaches = async (email, apiKey, truncate) => {
20819
21379
  if (response.status === HIBP_RATE_LIMITED) {
20820
21380
  const retryAfter = Number(response.headers.get("retry-after") ?? "0");
20821
21381
  if (retryAfter > 0)
20822
- await sleep(retryAfter * MS_PER_SECOND3);
21382
+ await sleep(retryAfter * MS_PER_SECOND4);
20823
21383
  return [];
20824
21384
  }
20825
21385
  if (!response.ok)
@@ -21474,6 +22034,7 @@ var defaultBotClassifier = (context) => {
21474
22034
  return "human";
21475
22035
  };
21476
22036
  // src/compliance/redaction.ts
22037
+ init_crypto();
21477
22038
  var createAuditRedactor = ({
21478
22039
  dropFields = [],
21479
22040
  hashFields = [],
@@ -21715,6 +22276,114 @@ var createPostgresAuditSink = (db) => ({
21715
22276
  return deleted.length;
21716
22277
  }
21717
22278
  });
22279
+ // src/scim/extensions.ts
22280
+ var defineScimAttributeMap = (map) => map;
22281
+ var diffScimGroupMembers = (current, next) => {
22282
+ const currentValues = new Set(current.map((member) => member.value));
22283
+ const nextValues = new Set(next.map((member) => member.value));
22284
+ const added = next.filter((member) => !currentValues.has(member.value));
22285
+ const removed = current.filter((member) => !nextValues.has(member.value));
22286
+ return { added, removed };
22287
+ };
22288
+ // src/oidc/inMemoryVciStores.ts
22289
+ var createInMemoryCredentialNonceStore = () => {
22290
+ const nonces = new Map;
22291
+ return {
22292
+ consumeNonce: async (nonceHash) => {
22293
+ const record = nonces.get(nonceHash);
22294
+ if (record === undefined)
22295
+ return;
22296
+ nonces.delete(nonceHash);
22297
+ return record;
22298
+ },
22299
+ saveNonce: async (record) => {
22300
+ nonces.set(record.nonceHash, record);
22301
+ }
22302
+ };
22303
+ };
22304
+ var createInMemoryCredentialOfferStore = () => {
22305
+ const offers = new Map;
22306
+ return {
22307
+ consumeOffer: async (preAuthorizedCodeHash) => {
22308
+ const offer = offers.get(preAuthorizedCodeHash);
22309
+ if (offer === undefined)
22310
+ return;
22311
+ offers.set(preAuthorizedCodeHash, { ...offer, redeemed: true });
22312
+ return offer;
22313
+ },
22314
+ saveOffer: async (offer) => {
22315
+ offers.set(offer.preAuthorizedCodeHash, offer);
22316
+ }
22317
+ };
22318
+ };
22319
+ // src/oidc/vciRoutes.ts
22320
+ import { Elysia as Elysia35, t as t31 } from "elysia";
22321
+ var HTTP_OK3 = 200;
22322
+ var HTTP_BAD_REQUEST3 = 400;
22323
+ var HTTP_UNAUTHORIZED3 = 401;
22324
+ var BEARER_PREFIX5 = "Bearer ";
22325
+ var errorBody = (error, status) => new Response(JSON.stringify({ error }), {
22326
+ headers: { "content-type": "application/json" },
22327
+ status
22328
+ });
22329
+ var extractBearer = (authorization) => {
22330
+ if (authorization === undefined || !authorization.startsWith(BEARER_PREFIX5)) {
22331
+ return;
22332
+ }
22333
+ const value = authorization.slice(BEARER_PREFIX5.length).trim();
22334
+ return value.length === 0 ? undefined : value;
22335
+ };
22336
+ var vciRoutes = ({
22337
+ issuerUrl,
22338
+ signingKey,
22339
+ vciConfig
22340
+ }) => {
22341
+ const vciRoute = vciConfig.vciRoute ?? DEFAULT_VCI_ROUTE;
22342
+ const credentialRoute = `${vciRoute}/credential`;
22343
+ const nonceRoute = `${vciRoute}/nonce`;
22344
+ const vciSigningKey = vciConfig.signingKey ?? signingKey;
22345
+ return new Elysia35().get("/.well-known/openid-credential-issuer", () => Response.json(buildIssuerMetadata({ config: vciConfig, issuer: issuerUrl, vciRoute }))).post(credentialRoute, async ({ body, headers }) => {
22346
+ const accessToken = extractBearer(headers.authorization);
22347
+ if (accessToken === undefined) {
22348
+ return errorBody("invalid_token", HTTP_UNAUTHORIZED3);
22349
+ }
22350
+ const result = await issueCredential({
22351
+ config: vciConfig,
22352
+ input: {
22353
+ accessToken,
22354
+ proofJwt: body.proof?.jwt,
22355
+ requestedFormat: body.format
22356
+ },
22357
+ issuer: issuerUrl,
22358
+ signingKey: vciSigningKey
22359
+ });
22360
+ if (!result.ok)
22361
+ return errorBody(result.error, HTTP_BAD_REQUEST3);
22362
+ return Response.json({ credential: result.credential, format: result.format }, { status: HTTP_OK3 });
22363
+ }, {
22364
+ body: t31.Object({
22365
+ format: t31.Optional(t31.Union([t31.Literal("vc+sd-jwt")])),
22366
+ proof: t31.Optional(t31.Object({
22367
+ jwt: t31.String(),
22368
+ proof_type: t31.Literal("jwt")
22369
+ }))
22370
+ })
22371
+ }).post(nonceRoute, async () => {
22372
+ if (vciConfig.credentialNonceStore === undefined) {
22373
+ return errorBody("not_supported", HTTP_BAD_REQUEST3);
22374
+ }
22375
+ const { generateSecureToken: generateSecureToken2, hashToken: hashToken2 } = await Promise.resolve().then(() => (init_crypto(), exports_crypto));
22376
+ const nonceBytes = 16;
22377
+ const nonce = generateSecureToken2(nonceBytes);
22378
+ const ttlMs = vciConfig.nonceTtlMs ?? 300000;
22379
+ await vciConfig.credentialNonceStore.saveNonce({
22380
+ expiresAt: Date.now() + ttlMs,
22381
+ nonceHash: await hashToken2(nonce)
22382
+ });
22383
+ const msPerSecond = 1000;
22384
+ return Response.json({ c_nonce: nonce, c_nonce_expires_in: Math.floor(ttlMs / msPerSecond) }, { status: HTTP_OK3 });
22385
+ });
22386
+ };
21718
22387
  // src/scim/inMemoryScimTokenStore.ts
21719
22388
  var createInMemoryScimTokenStore = () => {
21720
22389
  const tokens = new Map;
@@ -22585,6 +23254,7 @@ var createPostgresBackchannelAuthStore = (db) => ({
22585
23254
  }
22586
23255
  });
22587
23256
  // src/adaptive/config.ts
23257
+ init_constants();
22588
23258
  var DEFAULT_HISTORY_LIMIT = 50;
22589
23259
  var DEFAULT_MAX_TRAVEL_KMH = 900;
22590
23260
  var DEFAULT_VELOCITY_MAX_ATTEMPTS = 5;
@@ -22759,6 +23429,7 @@ var trustDevice = async (config, userId, deviceId, label) => {
22759
23429
  });
22760
23430
  };
22761
23431
  // src/adaptive/fingerprint.ts
23432
+ init_crypto();
22762
23433
  var canonical = (signals) => JSON.stringify(signals, (_key, value) => value === null || typeof value !== "object" || Array.isArray(value) ? value : Object.fromEntries(Object.entries(value).sort((left, right) => left[0].localeCompare(right[0]))));
22763
23434
  var fingerprintDevice = (signals) => hashToken(canonical(signals));
22764
23435
  // src/adaptive/inMemoryStores.ts
@@ -23876,18 +24547,18 @@ var blockMigrations = {
23876
24547
  webhooks: initMigration("webhooks", [webhookDeliveriesTable])
23877
24548
  };
23878
24549
  // src/sso/samlIdpRoutes.ts
23879
- import { Elysia as Elysia35, t as t31 } from "elysia";
23880
- var HTTP_BAD_REQUEST3 = 400;
23881
- var HTTP_UNAUTHORIZED3 = 401;
24550
+ import { Elysia as Elysia36, t as t32 } from "elysia";
24551
+ var HTTP_BAD_REQUEST4 = 400;
24552
+ var HTTP_UNAUTHORIZED4 = 401;
23882
24553
  var HTTP_FOUND2 = 302;
23883
- var HTTP_OK3 = 200;
24554
+ var HTTP_OK4 = 200;
23884
24555
  var xmlResponse = (body) => new Response(body, {
23885
24556
  headers: { "content-type": "application/samlmetadata+xml" },
23886
- status: HTTP_OK3
24557
+ status: HTTP_OK4
23887
24558
  });
23888
24559
  var htmlResponse = (body) => new Response(body, {
23889
24560
  headers: { "content-type": "text/html; charset=utf-8" },
23890
- status: HTTP_OK3
24561
+ status: HTTP_OK4
23891
24562
  });
23892
24563
  var redirectTo2 = (url) => new Response(null, { headers: { location: url }, status: HTTP_FOUND2 });
23893
24564
  var errorJson = (status, error) => new Response(JSON.stringify({ error }), {
@@ -23939,7 +24610,7 @@ var samlIdpRoutes = ({
23939
24610
  userSessionIdValue
23940
24611
  }) => {
23941
24612
  if (body.SAMLRequest === undefined) {
23942
- return errorJson(HTTP_BAD_REQUEST3, "missing_saml_request");
24613
+ return errorJson(HTTP_BAD_REQUEST4, "missing_saml_request");
23943
24614
  }
23944
24615
  let firstPass;
23945
24616
  try {
@@ -23948,11 +24619,11 @@ var samlIdpRoutes = ({
23948
24619
  samlRequest: body.SAMLRequest
23949
24620
  });
23950
24621
  } catch {
23951
- return errorJson(HTTP_BAD_REQUEST3, "invalid_authn_request");
24622
+ return errorJson(HTTP_BAD_REQUEST4, "invalid_authn_request");
23952
24623
  }
23953
24624
  const serviceProvider = await samlServiceProviderStore.findServiceProvider(firstPass.issuer);
23954
24625
  if (serviceProvider === undefined) {
23955
- return errorJson(HTTP_BAD_REQUEST3, "unknown_service_provider");
24626
+ return errorJson(HTTP_BAD_REQUEST4, "unknown_service_provider");
23956
24627
  }
23957
24628
  let parsed;
23958
24629
  try {
@@ -23965,7 +24636,7 @@ var samlIdpRoutes = ({
23965
24636
  signedQueryString: binding === "Redirect" ? new URL(request.url).search.slice(1) : undefined
23966
24637
  });
23967
24638
  } catch {
23968
- return errorJson(HTTP_BAD_REQUEST3, "invalid_authn_request");
24639
+ return errorJson(HTTP_BAD_REQUEST4, "invalid_authn_request");
23969
24640
  }
23970
24641
  const userSession = await loadSessionFromSource({
23971
24642
  authSessionStore,
@@ -23974,7 +24645,7 @@ var samlIdpRoutes = ({
23974
24645
  });
23975
24646
  if (userSession === undefined || parsed.forceAuthn === true) {
23976
24647
  if (loginUrl === undefined) {
23977
- return errorJson(HTTP_UNAUTHORIZED3, "login_required");
24648
+ return errorJson(HTTP_UNAUTHORIZED4, "login_required");
23978
24649
  }
23979
24650
  return redirectTo2(`${loginUrl}?return_to=${encodeURIComponent(request.url)}`);
23980
24651
  }
@@ -23986,7 +24657,7 @@ var samlIdpRoutes = ({
23986
24657
  user: userSession.user
23987
24658
  });
23988
24659
  };
23989
- return new Elysia35().use(sessionStore()).post(ssoIdpRoute, async ({
24660
+ return new Elysia36().use(sessionStore()).post(ssoIdpRoute, async ({
23990
24661
  body,
23991
24662
  cookie: { user_session_id },
23992
24663
  request,
@@ -23998,12 +24669,12 @@ var samlIdpRoutes = ({
23998
24669
  request,
23999
24670
  userSessionIdValue: user_session_id.value
24000
24671
  }), {
24001
- body: t31.Object({
24002
- RelayState: t31.Optional(t31.String()),
24003
- SAMLRequest: t31.Optional(t31.String())
24672
+ body: t32.Object({
24673
+ RelayState: t32.Optional(t32.String()),
24674
+ SAMLRequest: t32.Optional(t32.String())
24004
24675
  }),
24005
- cookie: t31.Cookie({
24006
- user_session_id: t31.Optional(userSessionIdTypebox)
24676
+ cookie: t32.Cookie({
24677
+ user_session_id: t32.Optional(userSessionIdTypebox)
24007
24678
  })
24008
24679
  }).get(ssoIdpRoute, async ({
24009
24680
  cookie: { user_session_id },
@@ -24017,14 +24688,14 @@ var samlIdpRoutes = ({
24017
24688
  request,
24018
24689
  userSessionIdValue: user_session_id.value
24019
24690
  }), {
24020
- cookie: t31.Cookie({
24021
- user_session_id: t31.Optional(userSessionIdTypebox)
24691
+ cookie: t32.Cookie({
24692
+ user_session_id: t32.Optional(userSessionIdTypebox)
24022
24693
  }),
24023
- query: t31.Object({
24024
- RelayState: t31.Optional(t31.String()),
24025
- SAMLRequest: t31.Optional(t31.String()),
24026
- SigAlg: t31.Optional(t31.String()),
24027
- Signature: t31.Optional(t31.String())
24694
+ query: t32.Object({
24695
+ RelayState: t32.Optional(t32.String()),
24696
+ SAMLRequest: t32.Optional(t32.String()),
24697
+ SigAlg: t32.Optional(t32.String()),
24698
+ Signature: t32.Optional(t32.String())
24028
24699
  })
24029
24700
  }).get(idpInitiateRoute, async ({
24030
24701
  cookie: { user_session_id },
@@ -24033,11 +24704,11 @@ var samlIdpRoutes = ({
24033
24704
  store
24034
24705
  }) => {
24035
24706
  if (serviceProviderEntityId === undefined) {
24036
- return errorJson(HTTP_BAD_REQUEST3, "missing_sp");
24707
+ return errorJson(HTTP_BAD_REQUEST4, "missing_sp");
24037
24708
  }
24038
24709
  const serviceProvider = await samlServiceProviderStore.findServiceProvider(serviceProviderEntityId);
24039
24710
  if (serviceProvider === undefined) {
24040
- return errorJson(HTTP_BAD_REQUEST3, "unknown_service_provider");
24711
+ return errorJson(HTTP_BAD_REQUEST4, "unknown_service_provider");
24041
24712
  }
24042
24713
  const userSession = authSessionStore === undefined ? await loadSessionFromSource({
24043
24714
  session: store.session,
@@ -24049,7 +24720,7 @@ var samlIdpRoutes = ({
24049
24720
  });
24050
24721
  if (userSession === undefined) {
24051
24722
  if (loginUrl === undefined) {
24052
- return errorJson(HTTP_UNAUTHORIZED3, "login_required");
24723
+ return errorJson(HTTP_UNAUTHORIZED4, "login_required");
24053
24724
  }
24054
24725
  return redirectTo2(`${loginUrl}?return_to=${encodeURIComponent(request.url)}`);
24055
24726
  }
@@ -24060,12 +24731,12 @@ var samlIdpRoutes = ({
24060
24731
  user: userSession.user
24061
24732
  });
24062
24733
  }, {
24063
- cookie: t31.Cookie({
24064
- user_session_id: t31.Optional(userSessionIdTypebox)
24734
+ cookie: t32.Cookie({
24735
+ user_session_id: t32.Optional(userSessionIdTypebox)
24065
24736
  }),
24066
- query: t31.Object({
24067
- RelayState: t31.Optional(t31.String()),
24068
- sp: t31.Optional(t31.String())
24737
+ query: t32.Object({
24738
+ RelayState: t32.Optional(t32.String()),
24739
+ sp: t32.Optional(t32.String())
24069
24740
  })
24070
24741
  }).get(idpMetadataRoute, async ({ request }) => xmlResponse(await idpAdapter.getIdpMetadata({
24071
24742
  entityId: idpEntityId,
@@ -24363,7 +25034,7 @@ var auth = async ({
24363
25034
  const auditedOnCallbackSuccess = auditEmit ? composeCallbackAudit(onCallbackSuccess, auditEmit) : onCallbackSuccess;
24364
25035
  const auditedOnRevocationSuccess = auditEmit ? composeRevocationAudit(onRevocationSuccess, auditEmit) : onRevocationSuccess;
24365
25036
  const auditedOnSignOut = auditEmit ? composeSignOutAudit(onSignOut, auditEmit) : onSignOut;
24366
- return new Elysia36().use(sessionCleanup({
25037
+ return new Elysia37().use(sessionCleanup({
24367
25038
  authSessionStore,
24368
25039
  cleanupIntervalMs,
24369
25040
  maxSessions,
@@ -24411,53 +25082,53 @@ var auth = async ({
24411
25082
  authSessionStore,
24412
25083
  cookieSecure: resolvedCookieSecure,
24413
25084
  lockoutGuard
24414
- }) : new Elysia36).use(auditedMfa ? mfaRoutes({
25085
+ }) : new Elysia37).use(auditedMfa ? mfaRoutes({
24415
25086
  ...auditedMfa,
24416
25087
  authSessionStore,
24417
25088
  cookieSecure: resolvedCookieSecure
24418
- }) : new Elysia36).use(passwordless ? passwordlessRoutes({
25089
+ }) : new Elysia37).use(passwordless ? passwordlessRoutes({
24419
25090
  ...passwordless,
24420
25091
  authSessionStore,
24421
25092
  cookieSecure: resolvedCookieSecure,
24422
25093
  emit: auditEmit
24423
- }) : new Elysia36).use(sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia36).use(sso ? oidcSsoRoutes({
25094
+ }) : new Elysia37).use(sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia37).use(sso ? oidcSsoRoutes({
24424
25095
  ...sso,
24425
25096
  authSessionStore,
24426
25097
  cookieSecure: resolvedCookieSecure
24427
- }) : new Elysia36).use(sso && sso.samlAdapter ? samlSsoRoutes({
25098
+ }) : new Elysia37).use(sso && sso.samlAdapter ? samlSsoRoutes({
24428
25099
  ...sso,
24429
25100
  authSessionStore,
24430
25101
  cookieSecure: resolvedCookieSecure,
24431
25102
  samlAdapter: sso.samlAdapter
24432
- }) : new Elysia36).use(sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
25103
+ }) : new Elysia37).use(sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
24433
25104
  getOrganizationByEmailDomain: sso.getOrganizationByEmailDomain,
24434
25105
  ssoConnectionStore: sso.ssoConnectionStore,
24435
25106
  ssoRoute: sso.ssoRoute
24436
- }) : new Elysia36).use(scim ? scimRoutes(scim) : new Elysia36).use(apikeys ? apiKeysRoutes(apikeys) : new Elysia36).use(oidc ? oidcProviderRoutes({ ...oidc, authSessionStore }) : new Elysia36).use(organizations ? organizationRoutes({
25107
+ }) : new Elysia37).use(scim ? scimRoutes(scim) : new Elysia37).use(apikeys ? apiKeysRoutes(apikeys) : new Elysia37).use(oidc ? oidcProviderRoutes({ ...oidc, authSessionStore }) : new Elysia37).use(organizations ? organizationRoutes({
24437
25108
  ...organizations,
24438
25109
  authSessionStore,
24439
25110
  emit: auditEmit
24440
- }) : new Elysia36).use(roles ? roleRoutes({
25111
+ }) : new Elysia37).use(roles ? roleRoutes({
24441
25112
  ...roles,
24442
25113
  authSessionStore,
24443
25114
  emit: auditEmit
24444
- }) : new Elysia36).use(portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia36).use(webauthn ? webauthnRoutes({
25115
+ }) : new Elysia37).use(portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia37).use(webauthn ? webauthnRoutes({
24445
25116
  ...webauthn,
24446
25117
  authSessionStore,
24447
25118
  cookieSecure: resolvedCookieSecure,
24448
25119
  emit: auditEmit
24449
- }) : new Elysia36).use(compliance ? complianceRoutes({
25120
+ }) : new Elysia37).use(compliance ? complianceRoutes({
24450
25121
  ...compliance,
24451
25122
  authSessionStore,
24452
25123
  emit: auditEmit
24453
- }) : new Elysia36).use(protectRoutePlugin({ authSessionStore })).use(stepUpPlugin({ authSessionStore })).use(authorization ? protectPermissionPlugin({
25124
+ }) : new Elysia37).use(protectRoutePlugin({ authSessionStore })).use(stepUpPlugin({ authSessionStore })).use(authorization ? protectPermissionPlugin({
24454
25125
  ...authorization,
24455
25126
  authSessionStore,
24456
25127
  emit: auditEmit
24457
- }) : new Elysia36).use(htmx ? createAuthHtmxRoutes({
25128
+ }) : new Elysia37).use(htmx ? createAuthHtmxRoutes({
24458
25129
  ...htmx,
24459
25130
  authSessionStore
24460
- }) : new Elysia36);
25131
+ }) : new Elysia37);
24461
25132
  };
24462
25133
  export {
24463
25134
  writeWarrant,
@@ -24470,6 +25141,7 @@ export {
24470
25141
  verifyWebhookSignature,
24471
25142
  verifyTurnstile,
24472
25143
  verifyTotp,
25144
+ verifySdJwtVc,
24473
25145
  verifyRecaptcha,
24474
25146
  verifyPkce,
24475
25147
  verifyPassword,
@@ -24486,6 +25158,7 @@ export {
24486
25158
  verifyAuditChain,
24487
25159
  verifyApiKey,
24488
25160
  verifyAccessToken,
25161
+ vciRoutes,
24489
25162
  vaultEntriesTable,
24490
25163
  validateSession,
24491
25164
  validateEmailDeliverability,
@@ -24494,6 +25167,7 @@ export {
24494
25167
  updateRegisteredClient,
24495
25168
  trustDevice,
24496
25169
  toPublicJwk,
25170
+ toBase64Url2 as toBase64Url,
24497
25171
  switchActiveSession,
24498
25172
  stepUpPlugin,
24499
25173
  startImpersonation,
@@ -24547,11 +25221,13 @@ export {
24547
25221
  providerOptions,
24548
25222
  protectRoutePlugin,
24549
25223
  protectPermissionPlugin,
25224
+ presentSdJwtVc,
24550
25225
  portalRoutes,
24551
25226
  pkceProviderOptions,
24552
25227
  passwordlessTokensTable,
24553
25228
  passwordlessRoutes,
24554
25229
  parseSignedRequestObject,
25230
+ parseSdJwtVc,
24555
25231
  parseSchema,
24556
25232
  organizationsTable,
24557
25233
  organizationRoutes,
@@ -24587,7 +25263,9 @@ export {
24587
25263
  knownDevicesTable,
24588
25264
  jwkThumbprint,
24589
25265
  issueTokenSet,
25266
+ issueSdJwtVc,
24590
25267
  issueDeviceAuthorization,
25268
+ issueCredential,
24591
25269
  issueBackchannelAuth,
24592
25270
  isValidUser,
24593
25271
  isValidProviderOption,
@@ -24626,6 +25304,7 @@ export {
24626
25304
  generateSecureToken,
24627
25305
  generateEncryptionKey,
24628
25306
  generateBackupCodes,
25307
+ fromBase64Url2 as fromBase64Url,
24629
25308
  fingerprintDevice,
24630
25309
  fetchUserInfo,
24631
25310
  fanOutBackchannelLogout,
@@ -24634,6 +25313,7 @@ export {
24634
25313
  extractDpopNonceClaim,
24635
25314
  exportAuditCsv,
24636
25315
  exchangeToken,
25316
+ exchangePreAuthorizedCode,
24637
25317
  exchangeDeviceCode,
24638
25318
  exchangeClientCredentials,
24639
25319
  exchangeBackchannelAuth,
@@ -24641,10 +25321,12 @@ export {
24641
25321
  endImpersonation,
24642
25322
  encryptTotpSecret,
24643
25323
  encryptSecret,
25324
+ diffScimGroupMembers,
24644
25325
  denyDeviceAuthorization,
24645
25326
  denyBackchannelAuth,
24646
25327
  deleteWarrant,
24647
25328
  deleteRegisteredClient,
25329
+ defineScimAttributeMap,
24648
25330
  defineProvidersConfiguration,
24649
25331
  defineAuthSettings,
24650
25332
  defineAuthHtmxConfig,
@@ -24766,6 +25448,8 @@ export {
24766
25448
  createInMemoryInitialAccessTokenStore,
24767
25449
  createInMemoryDeviceAuthorizationStore,
24768
25450
  createInMemoryCredentialStore,
25451
+ createInMemoryCredentialOfferStore,
25452
+ createInMemoryCredentialNonceStore,
24769
25453
  createInMemoryClientRegistrationTokenStore,
24770
25454
  createInMemoryClientAssertionJtiStore,
24771
25455
  createInMemoryCheckCache,
@@ -24778,6 +25462,7 @@ export {
24778
25462
  createInMemoryAccessTokenStore,
24779
25463
  createFgaEngine,
24780
25464
  createFederatedTokenStore,
25465
+ createCredentialOffer,
24781
25466
  createAuthHtmxRoutes,
24782
25467
  createAuditRedactor,
24783
25468
  createAuditEmitter,
@@ -24792,6 +25477,7 @@ export {
24792
25477
  computeCertThumbprint,
24793
25478
  complianceRoutes,
24794
25479
  check,
25480
+ buildIssuerMetadata,
24795
25481
  buildClientProviders,
24796
25482
  blockMigrations,
24797
25483
  base32Encode,
@@ -24813,12 +25499,14 @@ export {
24813
25499
  acceptInvitation,
24814
25500
  WEBAUTHN_CHALLENGE_COOKIE,
24815
25501
  REQUEST_URI_PREFIX,
25502
+ PRE_AUTHORIZED_CODE_GRANT,
24816
25503
  DEFAULT_WEBHOOK_TIMEOUT_MS,
24817
25504
  DEFAULT_WEBHOOK_RETRY,
24818
25505
  DEFAULT_WEBAUTHN_SESSION_TTL_MS,
24819
25506
  DEFAULT_WEBAUTHN_ROUTE,
24820
25507
  DEFAULT_WEBAUTHN_CHALLENGE_TTL_MS,
24821
25508
  DEFAULT_VERIFICATION_TOKEN_TTL_MS,
25509
+ DEFAULT_VCI_ROUTE,
24822
25510
  DEFAULT_TOKEN_ROUTE,
24823
25511
  DEFAULT_SSO_SESSION_TTL_MS,
24824
25512
  DEFAULT_SSO_ROUTE,
@@ -24846,5 +25534,5 @@ export {
24846
25534
  AuthIdentityConflictError
24847
25535
  };
24848
25536
 
24849
- //# debugId=26C38ACE51F8A69A64756E2164756E21
25537
+ //# debugId=72970D27E7C7DE2F64756E2164756E21
24850
25538
  //# sourceMappingURL=index.js.map