@absolutejs/auth 0.38.0 → 0.40.0-beta.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/dist/index.d.ts +12 -0
- package/dist/index.js +1146 -204
- package/dist/index.js.map +18 -9
- package/dist/oidc/config.d.ts +2 -0
- package/dist/oidc/inMemoryVciStores.d.ts +3 -0
- package/dist/oidc/routes.d.ts +1 -0
- package/dist/oidc/vci.d.ts +159 -0
- package/dist/oidc/vciRoutes.d.ts +92 -0
- package/dist/vc/inMemoryVpStores.d.ts +2 -0
- package/dist/vc/openid4vp.d.ts +82 -0
- package/dist/vc/sdJwt.d.ts +37 -0
- package/dist/vc/statusList.d.ts +29 -0
- package/dist/vc/statusListRoutes.d.ts +63 -0
- package/dist/vc/vpRoutes.d.ts +120 -0
- package/package.json +1 -1
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
|
|
2675
|
+
import { Elysia as Elysia39 } 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
|
|
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 *
|
|
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,
|
|
@@ -8936,6 +9304,7 @@ var scimRoutes = ({
|
|
|
8936
9304
|
};
|
|
8937
9305
|
|
|
8938
9306
|
// src/session/cleanup.ts
|
|
9307
|
+
init_constants();
|
|
8939
9308
|
import { Elysia as Elysia30 } from "elysia";
|
|
8940
9309
|
var sessionCleanup = ({
|
|
8941
9310
|
authSessionStore,
|
|
@@ -9184,6 +9553,7 @@ var ssoDiscoveryRoute = ({
|
|
|
9184
9553
|
};
|
|
9185
9554
|
|
|
9186
9555
|
// src/sso/oidcRoutes.ts
|
|
9556
|
+
init_constants();
|
|
9187
9557
|
import { Elysia as Elysia32, t as t28 } from "elysia";
|
|
9188
9558
|
var makeSsoCookieOptions = (secure) => ({
|
|
9189
9559
|
httpOnly: true,
|
|
@@ -9604,9 +9974,11 @@ var samlSsoRoutes = ({
|
|
|
9604
9974
|
};
|
|
9605
9975
|
|
|
9606
9976
|
// src/webauthn/routes.ts
|
|
9977
|
+
init_constants();
|
|
9607
9978
|
import { Elysia as Elysia34, t as t30 } from "elysia";
|
|
9608
9979
|
|
|
9609
9980
|
// src/webauthn/config.ts
|
|
9981
|
+
init_constants();
|
|
9610
9982
|
var FIVE_MINUTES_MS = 300000;
|
|
9611
9983
|
var DEFAULT_WEBAUTHN_CHALLENGE_TTL_MS = FIVE_MINUTES_MS;
|
|
9612
9984
|
var DEFAULT_WEBAUTHN_ROUTE = "/auth/webauthn";
|
|
@@ -9792,7 +10164,11 @@ var webauthnRoutes = ({
|
|
|
9792
10164
|
});
|
|
9793
10165
|
};
|
|
9794
10166
|
|
|
10167
|
+
// src/webhooks/dispatcher.ts
|
|
10168
|
+
init_constants();
|
|
10169
|
+
|
|
9795
10170
|
// src/webhooks/config.ts
|
|
10171
|
+
init_constants();
|
|
9796
10172
|
var DEFAULT_TIMEOUT_SECONDS = 5;
|
|
9797
10173
|
var DEFAULT_RETRY_ATTEMPTS = 3;
|
|
9798
10174
|
var DEFAULT_RETRY_INITIAL_DELAY_MS = MILLISECONDS_IN_A_SECOND;
|
|
@@ -9805,6 +10181,7 @@ var DEFAULT_WEBHOOK_RETRY = {
|
|
|
9805
10181
|
var DEFAULT_WEBHOOK_TIMEOUT_MS = MILLISECONDS_IN_A_SECOND * DEFAULT_TIMEOUT_SECONDS;
|
|
9806
10182
|
|
|
9807
10183
|
// src/webhooks/sign.ts
|
|
10184
|
+
init_crypto();
|
|
9808
10185
|
var textEncoder2 = new TextEncoder;
|
|
9809
10186
|
var importHmacKey = (secret) => crypto.subtle.importKey("raw", textEncoder2.encode(secret), { hash: "SHA-256", name: "HMAC" }, false, ["sign"]);
|
|
9810
10187
|
var signWebhook = async ({
|
|
@@ -10032,6 +10409,7 @@ var createActionPipeline = (actions) => ({
|
|
|
10032
10409
|
}
|
|
10033
10410
|
});
|
|
10034
10411
|
// src/compliance/cipher.ts
|
|
10412
|
+
init_crypto();
|
|
10035
10413
|
var createSecretCipher = (keyMaterial) => ({
|
|
10036
10414
|
decrypt: (ciphertext) => decryptSecret(ciphertext, keyMaterial),
|
|
10037
10415
|
encrypt: (plaintext) => encryptSecret(plaintext, keyMaterial)
|
|
@@ -20791,6 +21169,7 @@ var createInMemoryLinkedProviderStores = (input = {}) => {
|
|
|
20791
21169
|
return { bindingStore, grantStore };
|
|
20792
21170
|
};
|
|
20793
21171
|
// src/session/impersonation.ts
|
|
21172
|
+
init_constants();
|
|
20794
21173
|
var DEFAULT_IMPERSONATION_TTL_MS = MILLISECONDS_IN_AN_HOUR;
|
|
20795
21174
|
var endImpersonation = async ({
|
|
20796
21175
|
authSessionStore,
|
|
@@ -20873,6 +21252,7 @@ var startImpersonation = async ({
|
|
|
20873
21252
|
return sessionId;
|
|
20874
21253
|
};
|
|
20875
21254
|
// src/session/anonymous.ts
|
|
21255
|
+
init_constants();
|
|
20876
21256
|
var DEFAULT_GUEST_TTL_MS = MILLISECONDS_IN_A_DAY;
|
|
20877
21257
|
var createAnonymousSession = async ({
|
|
20878
21258
|
authSessionStore,
|
|
@@ -20960,6 +21340,10 @@ var switchActiveSession = ({
|
|
|
20960
21340
|
});
|
|
20961
21341
|
return true;
|
|
20962
21342
|
};
|
|
21343
|
+
|
|
21344
|
+
// src/index.ts
|
|
21345
|
+
init_crypto();
|
|
21346
|
+
|
|
20963
21347
|
// src/tenancy.ts
|
|
20964
21348
|
var hasOrganizationScope = (value) => typeof value.organizationId === "string" && value.organizationId.length > 0;
|
|
20965
21349
|
// src/credentials/backgroundOps.ts
|
|
@@ -20969,7 +21353,7 @@ var DEFAULT_PAUSE_MS = 1700;
|
|
|
20969
21353
|
var HIBP_NOT_FOUND = 404;
|
|
20970
21354
|
var HIBP_RATE_LIMITED = 429;
|
|
20971
21355
|
var MS_PER_DAY = 86400000;
|
|
20972
|
-
var
|
|
21356
|
+
var MS_PER_SECOND4 = 1000;
|
|
20973
21357
|
var sleep = (delayMs) => new Promise((resolve) => {
|
|
20974
21358
|
setTimeout(resolve, delayMs);
|
|
20975
21359
|
});
|
|
@@ -20995,7 +21379,7 @@ var checkEmailBreaches = async (email, apiKey, truncate) => {
|
|
|
20995
21379
|
if (response.status === HIBP_RATE_LIMITED) {
|
|
20996
21380
|
const retryAfter = Number(response.headers.get("retry-after") ?? "0");
|
|
20997
21381
|
if (retryAfter > 0)
|
|
20998
|
-
await sleep(retryAfter *
|
|
21382
|
+
await sleep(retryAfter * MS_PER_SECOND4);
|
|
20999
21383
|
return [];
|
|
21000
21384
|
}
|
|
21001
21385
|
if (!response.ok)
|
|
@@ -21650,6 +22034,7 @@ var defaultBotClassifier = (context) => {
|
|
|
21650
22034
|
return "human";
|
|
21651
22035
|
};
|
|
21652
22036
|
// src/compliance/redaction.ts
|
|
22037
|
+
init_crypto();
|
|
21653
22038
|
var createAuditRedactor = ({
|
|
21654
22039
|
dropFields = [],
|
|
21655
22040
|
hashFields = [],
|
|
@@ -21900,6 +22285,529 @@ var diffScimGroupMembers = (current, next) => {
|
|
|
21900
22285
|
const removed = current.filter((member) => !nextValues.has(member.value));
|
|
21901
22286
|
return { added, removed };
|
|
21902
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
|
+
};
|
|
22387
|
+
// src/vc/statusList.ts
|
|
22388
|
+
var STATUS_LIST_TYP = "statuslist+jwt";
|
|
22389
|
+
var STATUS_LIST_SUB_TYP = "application/statuslist+jwt";
|
|
22390
|
+
var DEFAULT_LIST_SIZE = 131072;
|
|
22391
|
+
var BITS_PER_BYTE = 8;
|
|
22392
|
+
var MS_PER_SECOND5 = 1000;
|
|
22393
|
+
var BYTE_MASK = 255;
|
|
22394
|
+
var createStatusList = (size = DEFAULT_LIST_SIZE) => {
|
|
22395
|
+
if (size % BITS_PER_BYTE !== 0) {
|
|
22396
|
+
throw new Error("Status list size must be a multiple of 8");
|
|
22397
|
+
}
|
|
22398
|
+
return new Uint8Array(size / BITS_PER_BYTE);
|
|
22399
|
+
};
|
|
22400
|
+
var getCredentialStatus = (bits, idx) => {
|
|
22401
|
+
const byteIndex = Math.floor(idx / BITS_PER_BYTE);
|
|
22402
|
+
const bitIndex = idx % BITS_PER_BYTE;
|
|
22403
|
+
if (byteIndex >= bits.length)
|
|
22404
|
+
return;
|
|
22405
|
+
const byte = bits[byteIndex] ?? 0;
|
|
22406
|
+
return (byte >> bitIndex & 1) === 1 ? 1 : 0;
|
|
22407
|
+
};
|
|
22408
|
+
var setCredentialStatus = (bits, idx, value) => {
|
|
22409
|
+
const byteIndex = Math.floor(idx / BITS_PER_BYTE);
|
|
22410
|
+
const bitIndex = idx % BITS_PER_BYTE;
|
|
22411
|
+
if (byteIndex >= bits.length) {
|
|
22412
|
+
throw new Error(`Status idx ${idx} out of range for this list`);
|
|
22413
|
+
}
|
|
22414
|
+
const current = bits[byteIndex] ?? 0;
|
|
22415
|
+
const mask = 1 << bitIndex;
|
|
22416
|
+
const next = value === 1 ? current | mask : current & (BYTE_MASK ^ mask);
|
|
22417
|
+
bits[byteIndex] = next;
|
|
22418
|
+
return bits;
|
|
22419
|
+
};
|
|
22420
|
+
var compress = async (bits) => {
|
|
22421
|
+
const blob = new Blob([new Uint8Array(bits)]);
|
|
22422
|
+
const stream = new Response(blob.stream().pipeThrough(new CompressionStream("deflate")));
|
|
22423
|
+
const compressed = new Uint8Array(await stream.arrayBuffer());
|
|
22424
|
+
return Buffer.from(compressed).toString("base64url");
|
|
22425
|
+
};
|
|
22426
|
+
var decompress = async (encoded) => {
|
|
22427
|
+
const compressed = Buffer.from(encoded, "base64url");
|
|
22428
|
+
const blob = new Blob([new Uint8Array(compressed)]);
|
|
22429
|
+
const stream = new Response(blob.stream().pipeThrough(new DecompressionStream("deflate")));
|
|
22430
|
+
return new Uint8Array(await stream.arrayBuffer());
|
|
22431
|
+
};
|
|
22432
|
+
var nowSeconds3 = (timeMs) => Math.floor(timeMs / MS_PER_SECOND5);
|
|
22433
|
+
var buildStatusClaim = (idx, uri) => ({
|
|
22434
|
+
status_list: { idx, uri }
|
|
22435
|
+
});
|
|
22436
|
+
var signStatusList = async ({
|
|
22437
|
+
bits,
|
|
22438
|
+
issuer,
|
|
22439
|
+
listUri,
|
|
22440
|
+
now = Date.now(),
|
|
22441
|
+
signingKey,
|
|
22442
|
+
ttlSeconds
|
|
22443
|
+
}) => {
|
|
22444
|
+
const payload = {
|
|
22445
|
+
iat: nowSeconds3(now),
|
|
22446
|
+
iss: issuer,
|
|
22447
|
+
status_list: {
|
|
22448
|
+
bits: 1,
|
|
22449
|
+
lst: await compress(bits)
|
|
22450
|
+
},
|
|
22451
|
+
sub: listUri,
|
|
22452
|
+
ttl: ttlSeconds
|
|
22453
|
+
};
|
|
22454
|
+
if (ttlSeconds !== undefined) {
|
|
22455
|
+
payload.exp = nowSeconds3(now) + ttlSeconds;
|
|
22456
|
+
}
|
|
22457
|
+
return signJwt(payload, signingKey);
|
|
22458
|
+
};
|
|
22459
|
+
var verifyStatusListJwt = async ({
|
|
22460
|
+
issuerPublicJwk,
|
|
22461
|
+
token
|
|
22462
|
+
}) => {
|
|
22463
|
+
const decoded = await verifyJwt(token, issuerPublicJwk);
|
|
22464
|
+
if (decoded === undefined)
|
|
22465
|
+
return;
|
|
22466
|
+
const rawPayload = decoded.payload;
|
|
22467
|
+
if (typeof rawPayload !== "object" || rawPayload === null)
|
|
22468
|
+
return;
|
|
22469
|
+
const payload = { ...rawPayload };
|
|
22470
|
+
const statusList = payload.status_list;
|
|
22471
|
+
if (typeof statusList !== "object" || statusList === null)
|
|
22472
|
+
return;
|
|
22473
|
+
const lst = Reflect.get(statusList, "lst");
|
|
22474
|
+
const bitsPerEntry = Reflect.get(statusList, "bits");
|
|
22475
|
+
if (typeof lst !== "string")
|
|
22476
|
+
return;
|
|
22477
|
+
if (bitsPerEntry !== undefined && bitsPerEntry !== 1) {
|
|
22478
|
+
return;
|
|
22479
|
+
}
|
|
22480
|
+
const bits = await decompress(lst);
|
|
22481
|
+
return { bits, sub: typeof payload.sub === "string" ? payload.sub : undefined };
|
|
22482
|
+
};
|
|
22483
|
+
// src/vc/statusListRoutes.ts
|
|
22484
|
+
import { Elysia as Elysia36, t as t32 } from "elysia";
|
|
22485
|
+
var HTTP_OK4 = 200;
|
|
22486
|
+
var HTTP_NOT_FOUND = 404;
|
|
22487
|
+
var DEFAULT_STATUS_ROUTE = "/vc/status";
|
|
22488
|
+
var statusListRoutes = ({
|
|
22489
|
+
getStatusList,
|
|
22490
|
+
issuerUrl,
|
|
22491
|
+
signingKey,
|
|
22492
|
+
statusRoute = DEFAULT_STATUS_ROUTE,
|
|
22493
|
+
ttlSeconds
|
|
22494
|
+
}) => {
|
|
22495
|
+
const listRoute = `${statusRoute}/:listId`;
|
|
22496
|
+
return new Elysia36().get(listRoute, async ({ params: { listId } }) => {
|
|
22497
|
+
const bits = await getStatusList(listId);
|
|
22498
|
+
if (bits === undefined) {
|
|
22499
|
+
return new Response("Not found", { status: HTTP_NOT_FOUND });
|
|
22500
|
+
}
|
|
22501
|
+
const jwt = await signStatusList({
|
|
22502
|
+
bits,
|
|
22503
|
+
issuer: issuerUrl,
|
|
22504
|
+
listUri: `${issuerUrl}${statusRoute}/${listId}`,
|
|
22505
|
+
signingKey,
|
|
22506
|
+
ttlSeconds
|
|
22507
|
+
});
|
|
22508
|
+
return new Response(jwt, {
|
|
22509
|
+
headers: { "content-type": STATUS_LIST_SUB_TYP },
|
|
22510
|
+
status: HTTP_OK4
|
|
22511
|
+
});
|
|
22512
|
+
}, { params: t32.Object({ listId: t32.String() }) });
|
|
22513
|
+
};
|
|
22514
|
+
// src/vc/openid4vp.ts
|
|
22515
|
+
init_crypto();
|
|
22516
|
+
var REQUEST_BYTES = 16;
|
|
22517
|
+
var DEFAULT_REQUEST_TTL_MS = 600000;
|
|
22518
|
+
var MS_PER_SECOND6 = 1000;
|
|
22519
|
+
var createPresentationRequest = async ({
|
|
22520
|
+
config,
|
|
22521
|
+
getRequestUri,
|
|
22522
|
+
input,
|
|
22523
|
+
issuer
|
|
22524
|
+
}) => {
|
|
22525
|
+
const requestId = generateSecureToken(REQUEST_BYTES);
|
|
22526
|
+
const nonce = generateSecureToken(REQUEST_BYTES);
|
|
22527
|
+
const now = input.now ?? Date.now();
|
|
22528
|
+
const ttlMs = config.requestTtlMs ?? DEFAULT_REQUEST_TTL_MS;
|
|
22529
|
+
const request = {
|
|
22530
|
+
clientId: input.clientId,
|
|
22531
|
+
createdAt: now,
|
|
22532
|
+
expectedIssuerPublicJwk: config.defaultExpectedIssuerPublicJwk,
|
|
22533
|
+
expiresAt: now + ttlMs,
|
|
22534
|
+
nonce,
|
|
22535
|
+
requestedClaims: input.requestedClaims,
|
|
22536
|
+
requestId,
|
|
22537
|
+
responseUri: config.getResponseUri(requestId),
|
|
22538
|
+
state: input.state
|
|
22539
|
+
};
|
|
22540
|
+
await config.requestStore.saveRequest(request);
|
|
22541
|
+
const requestObject = await signJwt({
|
|
22542
|
+
aud: "https://self-issued.me/v2",
|
|
22543
|
+
client_id: input.clientId,
|
|
22544
|
+
iat: Math.floor(now / MS_PER_SECOND6),
|
|
22545
|
+
iss: issuer,
|
|
22546
|
+
nonce,
|
|
22547
|
+
presentation_definition: buildSimplePresentationDefinition(requestId, input.requestedClaims),
|
|
22548
|
+
response_mode: "direct_post",
|
|
22549
|
+
response_type: "vp_token",
|
|
22550
|
+
response_uri: request.responseUri,
|
|
22551
|
+
state: input.state
|
|
22552
|
+
}, config.clientSigningKey);
|
|
22553
|
+
return {
|
|
22554
|
+
nonce,
|
|
22555
|
+
request,
|
|
22556
|
+
requestObject,
|
|
22557
|
+
requestUri: getRequestUri(requestId)
|
|
22558
|
+
};
|
|
22559
|
+
};
|
|
22560
|
+
var buildSimplePresentationDefinition = (requestId, requestedClaims) => ({
|
|
22561
|
+
id: requestId,
|
|
22562
|
+
input_descriptors: [
|
|
22563
|
+
{
|
|
22564
|
+
constraints: {
|
|
22565
|
+
fields: requestedClaims.map((claim) => ({
|
|
22566
|
+
path: [`$.${claim}`]
|
|
22567
|
+
})),
|
|
22568
|
+
limit_disclosure: "required"
|
|
22569
|
+
},
|
|
22570
|
+
format: { "vc+sd-jwt": { "sd-jwt_alg_values": ["ES256"] } },
|
|
22571
|
+
id: "sd-jwt-vc",
|
|
22572
|
+
name: "SD-JWT VC",
|
|
22573
|
+
purpose: "Verify holder claims"
|
|
22574
|
+
}
|
|
22575
|
+
]
|
|
22576
|
+
});
|
|
22577
|
+
var verifyPresentationResponse = async ({
|
|
22578
|
+
config,
|
|
22579
|
+
input,
|
|
22580
|
+
now = Date.now()
|
|
22581
|
+
}) => {
|
|
22582
|
+
const failFor = (error) => {
|
|
22583
|
+
const failure = { error, ok: false };
|
|
22584
|
+
return failure;
|
|
22585
|
+
};
|
|
22586
|
+
const request = await config.requestStore.consumeRequest(input.requestId);
|
|
22587
|
+
if (request === undefined)
|
|
22588
|
+
return failFor("unknown_request");
|
|
22589
|
+
if (request.expiresAt < now)
|
|
22590
|
+
return failFor("expired_request");
|
|
22591
|
+
const verified = await verifySdJwtVc({
|
|
22592
|
+
issuerPublicJwk: request.expectedIssuerPublicJwk,
|
|
22593
|
+
token: input.vpToken
|
|
22594
|
+
});
|
|
22595
|
+
if (verified === undefined)
|
|
22596
|
+
return failFor("invalid_signature");
|
|
22597
|
+
if (verified.cnf !== undefined) {
|
|
22598
|
+
if (verified.keyBindingJwt === undefined) {
|
|
22599
|
+
return failFor("invalid_holder_binding");
|
|
22600
|
+
}
|
|
22601
|
+
const valid = await verifyHolderBinding({
|
|
22602
|
+
audience: request.clientId,
|
|
22603
|
+
holderJwk: verified.cnf.jwk,
|
|
22604
|
+
keyBindingJwt: verified.keyBindingJwt,
|
|
22605
|
+
nonce: request.nonce
|
|
22606
|
+
});
|
|
22607
|
+
if (!valid)
|
|
22608
|
+
return failFor("invalid_holder_binding");
|
|
22609
|
+
}
|
|
22610
|
+
const missingClaims = request.requestedClaims.filter((claim) => !(claim in verified.disclosedClaims));
|
|
22611
|
+
if (missingClaims.length > 0)
|
|
22612
|
+
return failFor("missing_claims");
|
|
22613
|
+
const statusValid = await checkStatus({
|
|
22614
|
+
config,
|
|
22615
|
+
credentialClaims: verified.protectedClaims
|
|
22616
|
+
});
|
|
22617
|
+
if (!statusValid)
|
|
22618
|
+
return failFor("revoked_credential");
|
|
22619
|
+
const success = {
|
|
22620
|
+
ok: true,
|
|
22621
|
+
verified: {
|
|
22622
|
+
disclosedClaims: verified.disclosedClaims,
|
|
22623
|
+
holderJwk: verified.cnf?.jwk,
|
|
22624
|
+
missingClaims,
|
|
22625
|
+
protectedClaims: verified.protectedClaims,
|
|
22626
|
+
requestId: request.requestId,
|
|
22627
|
+
statusValid: true
|
|
22628
|
+
}
|
|
22629
|
+
};
|
|
22630
|
+
return success;
|
|
22631
|
+
};
|
|
22632
|
+
var verifyHolderBinding = async ({
|
|
22633
|
+
audience,
|
|
22634
|
+
holderJwk,
|
|
22635
|
+
keyBindingJwt,
|
|
22636
|
+
nonce
|
|
22637
|
+
}) => {
|
|
22638
|
+
const decoded = await verifyJwt(keyBindingJwt, holderJwk);
|
|
22639
|
+
if (decoded === undefined)
|
|
22640
|
+
return false;
|
|
22641
|
+
const rawPayload = decoded.payload;
|
|
22642
|
+
if (typeof rawPayload !== "object" || rawPayload === null)
|
|
22643
|
+
return false;
|
|
22644
|
+
const payload = { ...rawPayload };
|
|
22645
|
+
if (payload.aud !== audience)
|
|
22646
|
+
return false;
|
|
22647
|
+
if (payload.nonce !== nonce)
|
|
22648
|
+
return false;
|
|
22649
|
+
if (typeof payload.iat !== "number")
|
|
22650
|
+
return false;
|
|
22651
|
+
return true;
|
|
22652
|
+
};
|
|
22653
|
+
var checkStatus = async ({
|
|
22654
|
+
config,
|
|
22655
|
+
credentialClaims
|
|
22656
|
+
}) => {
|
|
22657
|
+
if (config.statusListResolver === undefined)
|
|
22658
|
+
return true;
|
|
22659
|
+
if (config.statusListPublicJwk === undefined)
|
|
22660
|
+
return true;
|
|
22661
|
+
const { status } = credentialClaims;
|
|
22662
|
+
if (typeof status !== "object" || status === null)
|
|
22663
|
+
return true;
|
|
22664
|
+
const list = Reflect.get(status, "status_list");
|
|
22665
|
+
if (typeof list !== "object" || list === null)
|
|
22666
|
+
return true;
|
|
22667
|
+
const uri = Reflect.get(list, "uri");
|
|
22668
|
+
const idx = Reflect.get(list, "idx");
|
|
22669
|
+
if (typeof uri !== "string" || typeof idx !== "number")
|
|
22670
|
+
return true;
|
|
22671
|
+
const token = await config.statusListResolver(uri);
|
|
22672
|
+
if (token === undefined)
|
|
22673
|
+
return true;
|
|
22674
|
+
const verified = await verifyStatusListJwt({
|
|
22675
|
+
issuerPublicJwk: config.statusListPublicJwk,
|
|
22676
|
+
token
|
|
22677
|
+
});
|
|
22678
|
+
if (verified === undefined)
|
|
22679
|
+
return false;
|
|
22680
|
+
const bitsPerByte = 8;
|
|
22681
|
+
const byteIndex = Math.floor(idx / bitsPerByte);
|
|
22682
|
+
const bitIndex = idx % bitsPerByte;
|
|
22683
|
+
const byte = verified.bits[byteIndex] ?? 0;
|
|
22684
|
+
return (byte >> bitIndex & 1) === 0;
|
|
22685
|
+
};
|
|
22686
|
+
var buildHolderKeyBindingJwt = async ({
|
|
22687
|
+
audience,
|
|
22688
|
+
holderKey,
|
|
22689
|
+
nonce,
|
|
22690
|
+
now = Date.now(),
|
|
22691
|
+
sdHash
|
|
22692
|
+
}) => signJwt({
|
|
22693
|
+
aud: audience,
|
|
22694
|
+
iat: Math.floor(now / MS_PER_SECOND6),
|
|
22695
|
+
nonce,
|
|
22696
|
+
sd_hash: sdHash
|
|
22697
|
+
}, holderKey);
|
|
22698
|
+
var parsePresentationToken = (vpToken) => parseSdJwtVc(vpToken);
|
|
22699
|
+
// src/vc/inMemoryVpStores.ts
|
|
22700
|
+
var createInMemoryPresentationRequestStore = () => {
|
|
22701
|
+
const requests = new Map;
|
|
22702
|
+
return {
|
|
22703
|
+
consumeRequest: async (requestId) => {
|
|
22704
|
+
const request = requests.get(requestId);
|
|
22705
|
+
if (request === undefined)
|
|
22706
|
+
return;
|
|
22707
|
+
requests.delete(requestId);
|
|
22708
|
+
return request;
|
|
22709
|
+
},
|
|
22710
|
+
getRequest: async (requestId) => requests.get(requestId),
|
|
22711
|
+
saveRequest: async (request) => {
|
|
22712
|
+
requests.set(request.requestId, request);
|
|
22713
|
+
}
|
|
22714
|
+
};
|
|
22715
|
+
};
|
|
22716
|
+
// src/vc/vpRoutes.ts
|
|
22717
|
+
import { Elysia as Elysia37, t as t33 } from "elysia";
|
|
22718
|
+
var HTTP_OK5 = 200;
|
|
22719
|
+
var HTTP_BAD_REQUEST4 = 400;
|
|
22720
|
+
var HTTP_NOT_FOUND2 = 404;
|
|
22721
|
+
var errorBody2 = (error, status) => new Response(JSON.stringify({ error }), {
|
|
22722
|
+
headers: { "content-type": "application/json" },
|
|
22723
|
+
status
|
|
22724
|
+
});
|
|
22725
|
+
var DEFAULT_VP_ROUTE = "/vp";
|
|
22726
|
+
var vpRoutes = ({
|
|
22727
|
+
defaultClientId,
|
|
22728
|
+
issuerUrl,
|
|
22729
|
+
onVerifiedPresentation,
|
|
22730
|
+
vpConfig,
|
|
22731
|
+
vpRoute = DEFAULT_VP_ROUTE
|
|
22732
|
+
}) => {
|
|
22733
|
+
const authorizeRoute = `${vpRoute}/authorize`;
|
|
22734
|
+
const requestRoute = `${vpRoute}/request/:id`;
|
|
22735
|
+
const responseRoute = `${vpRoute}/response`;
|
|
22736
|
+
return new Elysia37().post(authorizeRoute, async ({ body }) => {
|
|
22737
|
+
const input = {
|
|
22738
|
+
clientId: body.client_id ?? defaultClientId,
|
|
22739
|
+
requestedClaims: body.requested_claims,
|
|
22740
|
+
state: body.state
|
|
22741
|
+
};
|
|
22742
|
+
const result = await createPresentationRequest({
|
|
22743
|
+
config: vpConfig,
|
|
22744
|
+
input,
|
|
22745
|
+
issuer: issuerUrl,
|
|
22746
|
+
getRequestUri: (id) => `${issuerUrl}${vpRoute}/request/${id}`
|
|
22747
|
+
});
|
|
22748
|
+
return Response.json({
|
|
22749
|
+
nonce: result.nonce,
|
|
22750
|
+
request_uri: result.requestUri,
|
|
22751
|
+
requestId: result.request.requestId
|
|
22752
|
+
}, { status: HTTP_OK5 });
|
|
22753
|
+
}, {
|
|
22754
|
+
body: t33.Object({
|
|
22755
|
+
client_id: t33.Optional(t33.String()),
|
|
22756
|
+
requested_claims: t33.Array(t33.String()),
|
|
22757
|
+
state: t33.Optional(t33.String())
|
|
22758
|
+
})
|
|
22759
|
+
}).get(requestRoute, async ({ params: { id } }) => {
|
|
22760
|
+
const stored = await vpConfig.requestStore.getRequest(id);
|
|
22761
|
+
if (stored === undefined) {
|
|
22762
|
+
return errorBody2("unknown_request", HTTP_NOT_FOUND2);
|
|
22763
|
+
}
|
|
22764
|
+
const rebuilt = await createPresentationRequest({
|
|
22765
|
+
config: { ...vpConfig, requestStore: passthroughStore(stored) },
|
|
22766
|
+
input: {
|
|
22767
|
+
clientId: stored.clientId,
|
|
22768
|
+
requestedClaims: stored.requestedClaims,
|
|
22769
|
+
state: stored.state
|
|
22770
|
+
},
|
|
22771
|
+
issuer: issuerUrl,
|
|
22772
|
+
getRequestUri: () => `${issuerUrl}${vpRoute}/request/${id}`
|
|
22773
|
+
});
|
|
22774
|
+
return new Response(rebuilt.requestObject, {
|
|
22775
|
+
headers: { "content-type": "application/oauth-authz-req+jwt" },
|
|
22776
|
+
status: HTTP_OK5
|
|
22777
|
+
});
|
|
22778
|
+
}, { params: t33.Object({ id: t33.String() }) }).post(responseRoute, async ({ body }) => {
|
|
22779
|
+
const requestId = body.state;
|
|
22780
|
+
if (requestId === undefined) {
|
|
22781
|
+
return errorBody2("missing_state", HTTP_BAD_REQUEST4);
|
|
22782
|
+
}
|
|
22783
|
+
const result = await verifyPresentationResponse({
|
|
22784
|
+
config: vpConfig,
|
|
22785
|
+
input: { requestId, vpToken: body.vp_token }
|
|
22786
|
+
});
|
|
22787
|
+
if (!result.ok)
|
|
22788
|
+
return errorBody2(result.error, HTTP_BAD_REQUEST4);
|
|
22789
|
+
if (onVerifiedPresentation !== undefined) {
|
|
22790
|
+
await onVerifiedPresentation({ verified: result.verified });
|
|
22791
|
+
}
|
|
22792
|
+
return Response.json({
|
|
22793
|
+
disclosed_claims: result.verified.disclosedClaims,
|
|
22794
|
+
holder_jwk: result.verified.holderJwk,
|
|
22795
|
+
protected_claims: result.verified.protectedClaims,
|
|
22796
|
+
verified: true
|
|
22797
|
+
}, { status: HTTP_OK5 });
|
|
22798
|
+
}, {
|
|
22799
|
+
body: t33.Object({
|
|
22800
|
+
presentation_submission: t33.Optional(t33.Unknown()),
|
|
22801
|
+
state: t33.Optional(t33.String()),
|
|
22802
|
+
vp_token: t33.String()
|
|
22803
|
+
})
|
|
22804
|
+
});
|
|
22805
|
+
};
|
|
22806
|
+
var passthroughStore = (request) => ({
|
|
22807
|
+
consumeRequest: async () => request,
|
|
22808
|
+
getRequest: async () => request,
|
|
22809
|
+
saveRequest: async () => {}
|
|
22810
|
+
});
|
|
21903
22811
|
// src/scim/inMemoryScimTokenStore.ts
|
|
21904
22812
|
var createInMemoryScimTokenStore = () => {
|
|
21905
22813
|
const tokens = new Map;
|
|
@@ -22770,6 +23678,7 @@ var createPostgresBackchannelAuthStore = (db) => ({
|
|
|
22770
23678
|
}
|
|
22771
23679
|
});
|
|
22772
23680
|
// src/adaptive/config.ts
|
|
23681
|
+
init_constants();
|
|
22773
23682
|
var DEFAULT_HISTORY_LIMIT = 50;
|
|
22774
23683
|
var DEFAULT_MAX_TRAVEL_KMH = 900;
|
|
22775
23684
|
var DEFAULT_VELOCITY_MAX_ATTEMPTS = 5;
|
|
@@ -22944,6 +23853,7 @@ var trustDevice = async (config, userId, deviceId, label) => {
|
|
|
22944
23853
|
});
|
|
22945
23854
|
};
|
|
22946
23855
|
// src/adaptive/fingerprint.ts
|
|
23856
|
+
init_crypto();
|
|
22947
23857
|
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]))));
|
|
22948
23858
|
var fingerprintDevice = (signals) => hashToken(canonical(signals));
|
|
22949
23859
|
// src/adaptive/inMemoryStores.ts
|
|
@@ -24061,18 +24971,18 @@ var blockMigrations = {
|
|
|
24061
24971
|
webhooks: initMigration("webhooks", [webhookDeliveriesTable])
|
|
24062
24972
|
};
|
|
24063
24973
|
// src/sso/samlIdpRoutes.ts
|
|
24064
|
-
import { Elysia as
|
|
24065
|
-
var
|
|
24066
|
-
var
|
|
24974
|
+
import { Elysia as Elysia38, t as t34 } from "elysia";
|
|
24975
|
+
var HTTP_BAD_REQUEST5 = 400;
|
|
24976
|
+
var HTTP_UNAUTHORIZED4 = 401;
|
|
24067
24977
|
var HTTP_FOUND2 = 302;
|
|
24068
|
-
var
|
|
24978
|
+
var HTTP_OK6 = 200;
|
|
24069
24979
|
var xmlResponse = (body) => new Response(body, {
|
|
24070
24980
|
headers: { "content-type": "application/samlmetadata+xml" },
|
|
24071
|
-
status:
|
|
24981
|
+
status: HTTP_OK6
|
|
24072
24982
|
});
|
|
24073
24983
|
var htmlResponse = (body) => new Response(body, {
|
|
24074
24984
|
headers: { "content-type": "text/html; charset=utf-8" },
|
|
24075
|
-
status:
|
|
24985
|
+
status: HTTP_OK6
|
|
24076
24986
|
});
|
|
24077
24987
|
var redirectTo2 = (url) => new Response(null, { headers: { location: url }, status: HTTP_FOUND2 });
|
|
24078
24988
|
var errorJson = (status, error) => new Response(JSON.stringify({ error }), {
|
|
@@ -24124,7 +25034,7 @@ var samlIdpRoutes = ({
|
|
|
24124
25034
|
userSessionIdValue
|
|
24125
25035
|
}) => {
|
|
24126
25036
|
if (body.SAMLRequest === undefined) {
|
|
24127
|
-
return errorJson(
|
|
25037
|
+
return errorJson(HTTP_BAD_REQUEST5, "missing_saml_request");
|
|
24128
25038
|
}
|
|
24129
25039
|
let firstPass;
|
|
24130
25040
|
try {
|
|
@@ -24133,11 +25043,11 @@ var samlIdpRoutes = ({
|
|
|
24133
25043
|
samlRequest: body.SAMLRequest
|
|
24134
25044
|
});
|
|
24135
25045
|
} catch {
|
|
24136
|
-
return errorJson(
|
|
25046
|
+
return errorJson(HTTP_BAD_REQUEST5, "invalid_authn_request");
|
|
24137
25047
|
}
|
|
24138
25048
|
const serviceProvider = await samlServiceProviderStore.findServiceProvider(firstPass.issuer);
|
|
24139
25049
|
if (serviceProvider === undefined) {
|
|
24140
|
-
return errorJson(
|
|
25050
|
+
return errorJson(HTTP_BAD_REQUEST5, "unknown_service_provider");
|
|
24141
25051
|
}
|
|
24142
25052
|
let parsed;
|
|
24143
25053
|
try {
|
|
@@ -24150,7 +25060,7 @@ var samlIdpRoutes = ({
|
|
|
24150
25060
|
signedQueryString: binding === "Redirect" ? new URL(request.url).search.slice(1) : undefined
|
|
24151
25061
|
});
|
|
24152
25062
|
} catch {
|
|
24153
|
-
return errorJson(
|
|
25063
|
+
return errorJson(HTTP_BAD_REQUEST5, "invalid_authn_request");
|
|
24154
25064
|
}
|
|
24155
25065
|
const userSession = await loadSessionFromSource({
|
|
24156
25066
|
authSessionStore,
|
|
@@ -24159,7 +25069,7 @@ var samlIdpRoutes = ({
|
|
|
24159
25069
|
});
|
|
24160
25070
|
if (userSession === undefined || parsed.forceAuthn === true) {
|
|
24161
25071
|
if (loginUrl === undefined) {
|
|
24162
|
-
return errorJson(
|
|
25072
|
+
return errorJson(HTTP_UNAUTHORIZED4, "login_required");
|
|
24163
25073
|
}
|
|
24164
25074
|
return redirectTo2(`${loginUrl}?return_to=${encodeURIComponent(request.url)}`);
|
|
24165
25075
|
}
|
|
@@ -24171,7 +25081,7 @@ var samlIdpRoutes = ({
|
|
|
24171
25081
|
user: userSession.user
|
|
24172
25082
|
});
|
|
24173
25083
|
};
|
|
24174
|
-
return new
|
|
25084
|
+
return new Elysia38().use(sessionStore()).post(ssoIdpRoute, async ({
|
|
24175
25085
|
body,
|
|
24176
25086
|
cookie: { user_session_id },
|
|
24177
25087
|
request,
|
|
@@ -24183,12 +25093,12 @@ var samlIdpRoutes = ({
|
|
|
24183
25093
|
request,
|
|
24184
25094
|
userSessionIdValue: user_session_id.value
|
|
24185
25095
|
}), {
|
|
24186
|
-
body:
|
|
24187
|
-
RelayState:
|
|
24188
|
-
SAMLRequest:
|
|
25096
|
+
body: t34.Object({
|
|
25097
|
+
RelayState: t34.Optional(t34.String()),
|
|
25098
|
+
SAMLRequest: t34.Optional(t34.String())
|
|
24189
25099
|
}),
|
|
24190
|
-
cookie:
|
|
24191
|
-
user_session_id:
|
|
25100
|
+
cookie: t34.Cookie({
|
|
25101
|
+
user_session_id: t34.Optional(userSessionIdTypebox)
|
|
24192
25102
|
})
|
|
24193
25103
|
}).get(ssoIdpRoute, async ({
|
|
24194
25104
|
cookie: { user_session_id },
|
|
@@ -24202,14 +25112,14 @@ var samlIdpRoutes = ({
|
|
|
24202
25112
|
request,
|
|
24203
25113
|
userSessionIdValue: user_session_id.value
|
|
24204
25114
|
}), {
|
|
24205
|
-
cookie:
|
|
24206
|
-
user_session_id:
|
|
25115
|
+
cookie: t34.Cookie({
|
|
25116
|
+
user_session_id: t34.Optional(userSessionIdTypebox)
|
|
24207
25117
|
}),
|
|
24208
|
-
query:
|
|
24209
|
-
RelayState:
|
|
24210
|
-
SAMLRequest:
|
|
24211
|
-
SigAlg:
|
|
24212
|
-
Signature:
|
|
25118
|
+
query: t34.Object({
|
|
25119
|
+
RelayState: t34.Optional(t34.String()),
|
|
25120
|
+
SAMLRequest: t34.Optional(t34.String()),
|
|
25121
|
+
SigAlg: t34.Optional(t34.String()),
|
|
25122
|
+
Signature: t34.Optional(t34.String())
|
|
24213
25123
|
})
|
|
24214
25124
|
}).get(idpInitiateRoute, async ({
|
|
24215
25125
|
cookie: { user_session_id },
|
|
@@ -24218,11 +25128,11 @@ var samlIdpRoutes = ({
|
|
|
24218
25128
|
store
|
|
24219
25129
|
}) => {
|
|
24220
25130
|
if (serviceProviderEntityId === undefined) {
|
|
24221
|
-
return errorJson(
|
|
25131
|
+
return errorJson(HTTP_BAD_REQUEST5, "missing_sp");
|
|
24222
25132
|
}
|
|
24223
25133
|
const serviceProvider = await samlServiceProviderStore.findServiceProvider(serviceProviderEntityId);
|
|
24224
25134
|
if (serviceProvider === undefined) {
|
|
24225
|
-
return errorJson(
|
|
25135
|
+
return errorJson(HTTP_BAD_REQUEST5, "unknown_service_provider");
|
|
24226
25136
|
}
|
|
24227
25137
|
const userSession = authSessionStore === undefined ? await loadSessionFromSource({
|
|
24228
25138
|
session: store.session,
|
|
@@ -24234,7 +25144,7 @@ var samlIdpRoutes = ({
|
|
|
24234
25144
|
});
|
|
24235
25145
|
if (userSession === undefined) {
|
|
24236
25146
|
if (loginUrl === undefined) {
|
|
24237
|
-
return errorJson(
|
|
25147
|
+
return errorJson(HTTP_UNAUTHORIZED4, "login_required");
|
|
24238
25148
|
}
|
|
24239
25149
|
return redirectTo2(`${loginUrl}?return_to=${encodeURIComponent(request.url)}`);
|
|
24240
25150
|
}
|
|
@@ -24245,12 +25155,12 @@ var samlIdpRoutes = ({
|
|
|
24245
25155
|
user: userSession.user
|
|
24246
25156
|
});
|
|
24247
25157
|
}, {
|
|
24248
|
-
cookie:
|
|
24249
|
-
user_session_id:
|
|
25158
|
+
cookie: t34.Cookie({
|
|
25159
|
+
user_session_id: t34.Optional(userSessionIdTypebox)
|
|
24250
25160
|
}),
|
|
24251
|
-
query:
|
|
24252
|
-
RelayState:
|
|
24253
|
-
sp:
|
|
25161
|
+
query: t34.Object({
|
|
25162
|
+
RelayState: t34.Optional(t34.String()),
|
|
25163
|
+
sp: t34.Optional(t34.String())
|
|
24254
25164
|
})
|
|
24255
25165
|
}).get(idpMetadataRoute, async ({ request }) => xmlResponse(await idpAdapter.getIdpMetadata({
|
|
24256
25166
|
entityId: idpEntityId,
|
|
@@ -24548,7 +25458,7 @@ var auth = async ({
|
|
|
24548
25458
|
const auditedOnCallbackSuccess = auditEmit ? composeCallbackAudit(onCallbackSuccess, auditEmit) : onCallbackSuccess;
|
|
24549
25459
|
const auditedOnRevocationSuccess = auditEmit ? composeRevocationAudit(onRevocationSuccess, auditEmit) : onRevocationSuccess;
|
|
24550
25460
|
const auditedOnSignOut = auditEmit ? composeSignOutAudit(onSignOut, auditEmit) : onSignOut;
|
|
24551
|
-
return new
|
|
25461
|
+
return new Elysia39().use(sessionCleanup({
|
|
24552
25462
|
authSessionStore,
|
|
24553
25463
|
cleanupIntervalMs,
|
|
24554
25464
|
maxSessions,
|
|
@@ -24596,53 +25506,53 @@ var auth = async ({
|
|
|
24596
25506
|
authSessionStore,
|
|
24597
25507
|
cookieSecure: resolvedCookieSecure,
|
|
24598
25508
|
lockoutGuard
|
|
24599
|
-
}) : new
|
|
25509
|
+
}) : new Elysia39).use(auditedMfa ? mfaRoutes({
|
|
24600
25510
|
...auditedMfa,
|
|
24601
25511
|
authSessionStore,
|
|
24602
25512
|
cookieSecure: resolvedCookieSecure
|
|
24603
|
-
}) : new
|
|
25513
|
+
}) : new Elysia39).use(passwordless ? passwordlessRoutes({
|
|
24604
25514
|
...passwordless,
|
|
24605
25515
|
authSessionStore,
|
|
24606
25516
|
cookieSecure: resolvedCookieSecure,
|
|
24607
25517
|
emit: auditEmit
|
|
24608
|
-
}) : new
|
|
25518
|
+
}) : new Elysia39).use(sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia39).use(sso ? oidcSsoRoutes({
|
|
24609
25519
|
...sso,
|
|
24610
25520
|
authSessionStore,
|
|
24611
25521
|
cookieSecure: resolvedCookieSecure
|
|
24612
|
-
}) : new
|
|
25522
|
+
}) : new Elysia39).use(sso && sso.samlAdapter ? samlSsoRoutes({
|
|
24613
25523
|
...sso,
|
|
24614
25524
|
authSessionStore,
|
|
24615
25525
|
cookieSecure: resolvedCookieSecure,
|
|
24616
25526
|
samlAdapter: sso.samlAdapter
|
|
24617
|
-
}) : new
|
|
25527
|
+
}) : new Elysia39).use(sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
|
|
24618
25528
|
getOrganizationByEmailDomain: sso.getOrganizationByEmailDomain,
|
|
24619
25529
|
ssoConnectionStore: sso.ssoConnectionStore,
|
|
24620
25530
|
ssoRoute: sso.ssoRoute
|
|
24621
|
-
}) : new
|
|
25531
|
+
}) : new Elysia39).use(scim ? scimRoutes(scim) : new Elysia39).use(apikeys ? apiKeysRoutes(apikeys) : new Elysia39).use(oidc ? oidcProviderRoutes({ ...oidc, authSessionStore }) : new Elysia39).use(organizations ? organizationRoutes({
|
|
24622
25532
|
...organizations,
|
|
24623
25533
|
authSessionStore,
|
|
24624
25534
|
emit: auditEmit
|
|
24625
|
-
}) : new
|
|
25535
|
+
}) : new Elysia39).use(roles ? roleRoutes({
|
|
24626
25536
|
...roles,
|
|
24627
25537
|
authSessionStore,
|
|
24628
25538
|
emit: auditEmit
|
|
24629
|
-
}) : new
|
|
25539
|
+
}) : new Elysia39).use(portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia39).use(webauthn ? webauthnRoutes({
|
|
24630
25540
|
...webauthn,
|
|
24631
25541
|
authSessionStore,
|
|
24632
25542
|
cookieSecure: resolvedCookieSecure,
|
|
24633
25543
|
emit: auditEmit
|
|
24634
|
-
}) : new
|
|
25544
|
+
}) : new Elysia39).use(compliance ? complianceRoutes({
|
|
24635
25545
|
...compliance,
|
|
24636
25546
|
authSessionStore,
|
|
24637
25547
|
emit: auditEmit
|
|
24638
|
-
}) : new
|
|
25548
|
+
}) : new Elysia39).use(protectRoutePlugin({ authSessionStore })).use(stepUpPlugin({ authSessionStore })).use(authorization ? protectPermissionPlugin({
|
|
24639
25549
|
...authorization,
|
|
24640
25550
|
authSessionStore,
|
|
24641
25551
|
emit: auditEmit
|
|
24642
|
-
}) : new
|
|
25552
|
+
}) : new Elysia39).use(htmx ? createAuthHtmxRoutes({
|
|
24643
25553
|
...htmx,
|
|
24644
25554
|
authSessionStore
|
|
24645
|
-
}) : new
|
|
25555
|
+
}) : new Elysia39);
|
|
24646
25556
|
};
|
|
24647
25557
|
export {
|
|
24648
25558
|
writeWarrant,
|
|
@@ -24652,10 +25562,14 @@ export {
|
|
|
24652
25562
|
webauthnCredentialsTable,
|
|
24653
25563
|
warrantsTable,
|
|
24654
25564
|
warrantKey,
|
|
25565
|
+
vpRoutes,
|
|
24655
25566
|
verifyWebhookSignature,
|
|
24656
25567
|
verifyTurnstile,
|
|
24657
25568
|
verifyTotp,
|
|
25569
|
+
verifyStatusListJwt,
|
|
25570
|
+
verifySdJwtVc,
|
|
24658
25571
|
verifyRecaptcha,
|
|
25572
|
+
verifyPresentationResponse,
|
|
24659
25573
|
verifyPkce,
|
|
24660
25574
|
verifyPassword,
|
|
24661
25575
|
verifyJwtSignedByClient,
|
|
@@ -24671,6 +25585,7 @@ export {
|
|
|
24671
25585
|
verifyAuditChain,
|
|
24672
25586
|
verifyApiKey,
|
|
24673
25587
|
verifyAccessToken,
|
|
25588
|
+
vciRoutes,
|
|
24674
25589
|
vaultEntriesTable,
|
|
24675
25590
|
validateSession,
|
|
24676
25591
|
validateEmailDeliverability,
|
|
@@ -24679,15 +25594,19 @@ export {
|
|
|
24679
25594
|
updateRegisteredClient,
|
|
24680
25595
|
trustDevice,
|
|
24681
25596
|
toPublicJwk,
|
|
25597
|
+
toBase64Url2 as toBase64Url,
|
|
24682
25598
|
switchActiveSession,
|
|
24683
25599
|
stepUpPlugin,
|
|
25600
|
+
statusListRoutes,
|
|
24684
25601
|
startImpersonation,
|
|
24685
25602
|
ssoDiscoveryRoute,
|
|
24686
25603
|
ssoConnectionsTable,
|
|
24687
25604
|
signWebhook,
|
|
25605
|
+
signStatusList,
|
|
24688
25606
|
signJwt,
|
|
24689
25607
|
setupSessionsTable,
|
|
24690
25608
|
setMemberRoles,
|
|
25609
|
+
setCredentialStatus,
|
|
24691
25610
|
sessionStore,
|
|
24692
25611
|
sessionRoutes,
|
|
24693
25612
|
sessionCleanup,
|
|
@@ -24732,12 +25651,15 @@ export {
|
|
|
24732
25651
|
providerOptions,
|
|
24733
25652
|
protectRoutePlugin,
|
|
24734
25653
|
protectPermissionPlugin,
|
|
25654
|
+
presentSdJwtVc,
|
|
24735
25655
|
portalRoutes,
|
|
24736
25656
|
pkceProviderOptions,
|
|
24737
25657
|
passwordlessTokensTable,
|
|
24738
25658
|
passwordlessRoutes,
|
|
24739
25659
|
parseSignedRequestObject,
|
|
25660
|
+
parseSdJwtVc,
|
|
24740
25661
|
parseSchema,
|
|
25662
|
+
parsePresentationToken,
|
|
24741
25663
|
organizationsTable,
|
|
24742
25664
|
organizationRoutes,
|
|
24743
25665
|
organizationMembershipsTable,
|
|
@@ -24772,7 +25694,9 @@ export {
|
|
|
24772
25694
|
knownDevicesTable,
|
|
24773
25695
|
jwkThumbprint,
|
|
24774
25696
|
issueTokenSet,
|
|
25697
|
+
issueSdJwtVc,
|
|
24775
25698
|
issueDeviceAuthorization,
|
|
25699
|
+
issueCredential,
|
|
24776
25700
|
issueBackchannelAuth,
|
|
24777
25701
|
isValidUser,
|
|
24778
25702
|
isValidProviderOption,
|
|
@@ -24805,12 +25729,14 @@ export {
|
|
|
24805
25729
|
getStatus,
|
|
24806
25730
|
getRegisteredClient,
|
|
24807
25731
|
getOrRefreshFederatedTokens,
|
|
25732
|
+
getCredentialStatus,
|
|
24808
25733
|
generateTotpSecret,
|
|
24809
25734
|
generateTotp,
|
|
24810
25735
|
generateSigningKey,
|
|
24811
25736
|
generateSecureToken,
|
|
24812
25737
|
generateEncryptionKey,
|
|
24813
25738
|
generateBackupCodes,
|
|
25739
|
+
fromBase64Url2 as fromBase64Url,
|
|
24814
25740
|
fingerprintDevice,
|
|
24815
25741
|
fetchUserInfo,
|
|
24816
25742
|
fanOutBackchannelLogout,
|
|
@@ -24819,6 +25745,7 @@ export {
|
|
|
24819
25745
|
extractDpopNonceClaim,
|
|
24820
25746
|
exportAuditCsv,
|
|
24821
25747
|
exchangeToken,
|
|
25748
|
+
exchangePreAuthorizedCode,
|
|
24822
25749
|
exchangeDeviceCode,
|
|
24823
25750
|
exchangeClientCredentials,
|
|
24824
25751
|
exchangeBackchannelAuth,
|
|
@@ -24852,6 +25779,7 @@ export {
|
|
|
24852
25779
|
createVault,
|
|
24853
25780
|
createTotpKeyUri,
|
|
24854
25781
|
createTamperEvidentSink,
|
|
25782
|
+
createStatusList,
|
|
24855
25783
|
createSiemLogStream,
|
|
24856
25784
|
createSetupSession,
|
|
24857
25785
|
createSecretCipher,
|
|
@@ -24860,6 +25788,7 @@ export {
|
|
|
24860
25788
|
createRedisLockoutStore,
|
|
24861
25789
|
createRedisFgaCache,
|
|
24862
25790
|
createRedisAuthSessionStore,
|
|
25791
|
+
createPresentationRequest,
|
|
24863
25792
|
createPostgresWebhookDeliveryStore,
|
|
24864
25793
|
createPostgresWebAuthnCredentialStore,
|
|
24865
25794
|
createPostgresWarrantStore,
|
|
@@ -24940,6 +25869,7 @@ export {
|
|
|
24940
25869
|
createInMemorySamlServiceProviderStore,
|
|
24941
25870
|
createInMemoryRoleStore,
|
|
24942
25871
|
createInMemoryPushedAuthorizationRequestStore,
|
|
25872
|
+
createInMemoryPresentationRequestStore,
|
|
24943
25873
|
createInMemoryPasswordlessTokenStore,
|
|
24944
25874
|
createInMemoryOrganizationStore,
|
|
24945
25875
|
createInMemoryOidcRefreshTokenStore,
|
|
@@ -24953,6 +25883,8 @@ export {
|
|
|
24953
25883
|
createInMemoryInitialAccessTokenStore,
|
|
24954
25884
|
createInMemoryDeviceAuthorizationStore,
|
|
24955
25885
|
createInMemoryCredentialStore,
|
|
25886
|
+
createInMemoryCredentialOfferStore,
|
|
25887
|
+
createInMemoryCredentialNonceStore,
|
|
24956
25888
|
createInMemoryClientRegistrationTokenStore,
|
|
24957
25889
|
createInMemoryClientAssertionJtiStore,
|
|
24958
25890
|
createInMemoryCheckCache,
|
|
@@ -24965,6 +25897,7 @@ export {
|
|
|
24965
25897
|
createInMemoryAccessTokenStore,
|
|
24966
25898
|
createFgaEngine,
|
|
24967
25899
|
createFederatedTokenStore,
|
|
25900
|
+
createCredentialOffer,
|
|
24968
25901
|
createAuthHtmxRoutes,
|
|
24969
25902
|
createAuditRedactor,
|
|
24970
25903
|
createAuditEmitter,
|
|
@@ -24979,6 +25912,9 @@ export {
|
|
|
24979
25912
|
computeCertThumbprint,
|
|
24980
25913
|
complianceRoutes,
|
|
24981
25914
|
check,
|
|
25915
|
+
buildStatusClaim,
|
|
25916
|
+
buildIssuerMetadata,
|
|
25917
|
+
buildHolderKeyBindingJwt,
|
|
24982
25918
|
buildClientProviders,
|
|
24983
25919
|
blockMigrations,
|
|
24984
25920
|
base32Encode,
|
|
@@ -24999,14 +25935,20 @@ export {
|
|
|
24999
25935
|
accessTokensTable,
|
|
25000
25936
|
acceptInvitation,
|
|
25001
25937
|
WEBAUTHN_CHALLENGE_COOKIE,
|
|
25938
|
+
STATUS_LIST_TYP,
|
|
25939
|
+
STATUS_LIST_SUB_TYP,
|
|
25002
25940
|
REQUEST_URI_PREFIX,
|
|
25941
|
+
PRE_AUTHORIZED_CODE_GRANT,
|
|
25003
25942
|
DEFAULT_WEBHOOK_TIMEOUT_MS,
|
|
25004
25943
|
DEFAULT_WEBHOOK_RETRY,
|
|
25005
25944
|
DEFAULT_WEBAUTHN_SESSION_TTL_MS,
|
|
25006
25945
|
DEFAULT_WEBAUTHN_ROUTE,
|
|
25007
25946
|
DEFAULT_WEBAUTHN_CHALLENGE_TTL_MS,
|
|
25947
|
+
DEFAULT_VP_ROUTE,
|
|
25008
25948
|
DEFAULT_VERIFICATION_TOKEN_TTL_MS,
|
|
25949
|
+
DEFAULT_VCI_ROUTE,
|
|
25009
25950
|
DEFAULT_TOKEN_ROUTE,
|
|
25951
|
+
DEFAULT_STATUS_ROUTE,
|
|
25010
25952
|
DEFAULT_SSO_SESSION_TTL_MS,
|
|
25011
25953
|
DEFAULT_SSO_ROUTE,
|
|
25012
25954
|
DEFAULT_SETUP_SESSION_TTL_MS,
|
|
@@ -25033,5 +25975,5 @@ export {
|
|
|
25033
25975
|
AuthIdentityConflictError
|
|
25034
25976
|
};
|
|
25035
25977
|
|
|
25036
|
-
//# debugId=
|
|
25978
|
+
//# debugId=6D61B26FBEAED15664756E2164756E21
|
|
25037
25979
|
//# sourceMappingURL=index.js.map
|