@absolutejs/auth 0.40.0-beta.0 → 0.40.0-beta.2

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
@@ -2672,7 +2672,7 @@ var createOAuth2Client = async (providerName, config) => {
2672
2672
  };
2673
2673
 
2674
2674
  // src/index.ts
2675
- import { Elysia as Elysia37 } from "elysia";
2675
+ import { Elysia as Elysia39 } from "elysia";
2676
2676
 
2677
2677
  // src/apikeys/routes.ts
2678
2678
  import { Elysia, t } from "elysia";
@@ -5288,6 +5288,36 @@ var extractHolderJwk = (proofJwt) => {
5288
5288
  y: typeof candidate.y === "string" ? candidate.y : undefined
5289
5289
  };
5290
5290
  };
5291
+ var verifyProofJwt = async ({
5292
+ config,
5293
+ issuer,
5294
+ now,
5295
+ proofJwt
5296
+ }) => {
5297
+ const holderJwk = extractHolderJwk(proofJwt);
5298
+ if (holderJwk === undefined)
5299
+ return;
5300
+ const decoded = await verifyJwt(proofJwt, holderJwk);
5301
+ if (decoded === undefined)
5302
+ return;
5303
+ const rawPayload = decoded.payload;
5304
+ if (typeof rawPayload !== "object" || rawPayload === null)
5305
+ return;
5306
+ const payload = { ...rawPayload };
5307
+ if (payload.aud !== issuer)
5308
+ return;
5309
+ if (typeof payload.iat !== "number")
5310
+ return;
5311
+ if (config.credentialNonceStore !== undefined) {
5312
+ const { nonce } = payload;
5313
+ if (typeof nonce !== "string")
5314
+ return;
5315
+ const record = await config.credentialNonceStore.consumeNonce(await hashToken(nonce));
5316
+ if (record === undefined || record.expiresAt < now)
5317
+ return;
5318
+ }
5319
+ return holderJwk;
5320
+ };
5291
5321
  var buildIssuerMetadata = ({
5292
5322
  config,
5293
5323
  issuer,
@@ -5352,9 +5382,16 @@ var issueCredential = async ({
5352
5382
  const configuration = config.credentialConfigurations.find((entry) => entry.id === configurationId);
5353
5383
  if (configuration === undefined)
5354
5384
  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");
5385
+ let holderJwk;
5386
+ if (input.proofJwt !== undefined) {
5387
+ holderJwk = await verifyProofJwt({
5388
+ config,
5389
+ issuer,
5390
+ now,
5391
+ proofJwt: input.proofJwt
5392
+ });
5393
+ if (holderJwk === undefined)
5394
+ return issueFail("invalid_proof");
5358
5395
  }
5359
5396
  const selective = await config.resolveCredentialClaims({
5360
5397
  configurationId,
@@ -22384,6 +22421,554 @@ var vciRoutes = ({
22384
22421
  return Response.json({ c_nonce: nonce, c_nonce_expires_in: Math.floor(ttlMs / msPerSecond) }, { status: HTTP_OK3 });
22385
22422
  });
22386
22423
  };
22424
+ // src/vc/statusList.ts
22425
+ var STATUS_LIST_TYP = "statuslist+jwt";
22426
+ var STATUS_LIST_SUB_TYP = "application/statuslist+jwt";
22427
+ var DEFAULT_LIST_SIZE = 131072;
22428
+ var BITS_PER_BYTE = 8;
22429
+ var MS_PER_SECOND5 = 1000;
22430
+ var BYTE_MASK = 255;
22431
+ var createStatusList = (size = DEFAULT_LIST_SIZE) => {
22432
+ if (size % BITS_PER_BYTE !== 0) {
22433
+ throw new Error("Status list size must be a multiple of 8");
22434
+ }
22435
+ return new Uint8Array(size / BITS_PER_BYTE);
22436
+ };
22437
+ var getCredentialStatus = (bits, idx) => {
22438
+ const byteIndex = Math.floor(idx / BITS_PER_BYTE);
22439
+ const bitIndex = idx % BITS_PER_BYTE;
22440
+ if (byteIndex >= bits.length)
22441
+ return;
22442
+ const byte = bits[byteIndex] ?? 0;
22443
+ return (byte >> bitIndex & 1) === 1 ? 1 : 0;
22444
+ };
22445
+ var setCredentialStatus = (bits, idx, value) => {
22446
+ const byteIndex = Math.floor(idx / BITS_PER_BYTE);
22447
+ const bitIndex = idx % BITS_PER_BYTE;
22448
+ if (byteIndex >= bits.length) {
22449
+ throw new Error(`Status idx ${idx} out of range for this list`);
22450
+ }
22451
+ const current = bits[byteIndex] ?? 0;
22452
+ const mask = 1 << bitIndex;
22453
+ const next = value === 1 ? current | mask : current & (BYTE_MASK ^ mask);
22454
+ bits[byteIndex] = next;
22455
+ return bits;
22456
+ };
22457
+ var compress = async (bits) => {
22458
+ const blob = new Blob([new Uint8Array(bits)]);
22459
+ const stream = new Response(blob.stream().pipeThrough(new CompressionStream("deflate")));
22460
+ const compressed = new Uint8Array(await stream.arrayBuffer());
22461
+ return Buffer.from(compressed).toString("base64url");
22462
+ };
22463
+ var decompress = async (encoded) => {
22464
+ const compressed = Buffer.from(encoded, "base64url");
22465
+ const blob = new Blob([new Uint8Array(compressed)]);
22466
+ const stream = new Response(blob.stream().pipeThrough(new DecompressionStream("deflate")));
22467
+ return new Uint8Array(await stream.arrayBuffer());
22468
+ };
22469
+ var nowSeconds3 = (timeMs) => Math.floor(timeMs / MS_PER_SECOND5);
22470
+ var buildStatusClaim = (idx, uri) => ({
22471
+ status_list: { idx, uri }
22472
+ });
22473
+ var signStatusList = async ({
22474
+ bits,
22475
+ issuer,
22476
+ listUri,
22477
+ now = Date.now(),
22478
+ signingKey,
22479
+ ttlSeconds
22480
+ }) => {
22481
+ const payload = {
22482
+ iat: nowSeconds3(now),
22483
+ iss: issuer,
22484
+ status_list: {
22485
+ bits: 1,
22486
+ lst: await compress(bits)
22487
+ },
22488
+ sub: listUri,
22489
+ ttl: ttlSeconds
22490
+ };
22491
+ if (ttlSeconds !== undefined) {
22492
+ payload.exp = nowSeconds3(now) + ttlSeconds;
22493
+ }
22494
+ return signJwt(payload, signingKey);
22495
+ };
22496
+ var verifyStatusListJwt = async ({
22497
+ issuerPublicJwk,
22498
+ token
22499
+ }) => {
22500
+ const decoded = await verifyJwt(token, issuerPublicJwk);
22501
+ if (decoded === undefined)
22502
+ return;
22503
+ const rawPayload = decoded.payload;
22504
+ if (typeof rawPayload !== "object" || rawPayload === null)
22505
+ return;
22506
+ const payload = { ...rawPayload };
22507
+ const statusList = payload.status_list;
22508
+ if (typeof statusList !== "object" || statusList === null)
22509
+ return;
22510
+ const lst = Reflect.get(statusList, "lst");
22511
+ const bitsPerEntry = Reflect.get(statusList, "bits");
22512
+ if (typeof lst !== "string")
22513
+ return;
22514
+ if (bitsPerEntry !== undefined && bitsPerEntry !== 1) {
22515
+ return;
22516
+ }
22517
+ const bits = await decompress(lst);
22518
+ return { bits, sub: typeof payload.sub === "string" ? payload.sub : undefined };
22519
+ };
22520
+ // src/vc/statusListRoutes.ts
22521
+ import { Elysia as Elysia36, t as t32 } from "elysia";
22522
+ var HTTP_OK4 = 200;
22523
+ var HTTP_NOT_FOUND = 404;
22524
+ var DEFAULT_STATUS_ROUTE = "/vc/status";
22525
+ var statusListRoutes = ({
22526
+ getStatusList,
22527
+ issuerUrl,
22528
+ signingKey,
22529
+ statusRoute = DEFAULT_STATUS_ROUTE,
22530
+ ttlSeconds
22531
+ }) => {
22532
+ const listRoute = `${statusRoute}/:listId`;
22533
+ return new Elysia36().get(listRoute, async ({ params: { listId } }) => {
22534
+ const bits = await getStatusList(listId);
22535
+ if (bits === undefined) {
22536
+ return new Response("Not found", { status: HTTP_NOT_FOUND });
22537
+ }
22538
+ const jwt = await signStatusList({
22539
+ bits,
22540
+ issuer: issuerUrl,
22541
+ listUri: `${issuerUrl}${statusRoute}/${listId}`,
22542
+ signingKey,
22543
+ ttlSeconds
22544
+ });
22545
+ return new Response(jwt, {
22546
+ headers: { "content-type": STATUS_LIST_SUB_TYP },
22547
+ status: HTTP_OK4
22548
+ });
22549
+ }, { params: t32.Object({ listId: t32.String() }) });
22550
+ };
22551
+ // src/vc/openid4vp.ts
22552
+ init_crypto();
22553
+ var REQUEST_BYTES = 16;
22554
+ var DEFAULT_REQUEST_TTL_MS = 600000;
22555
+ var MS_PER_SECOND6 = 1000;
22556
+ var createPresentationRequest = async ({
22557
+ config,
22558
+ getRequestUri,
22559
+ input,
22560
+ issuer
22561
+ }) => {
22562
+ const requestId = generateSecureToken(REQUEST_BYTES);
22563
+ const nonce = generateSecureToken(REQUEST_BYTES);
22564
+ const now = input.now ?? Date.now();
22565
+ const ttlMs = config.requestTtlMs ?? DEFAULT_REQUEST_TTL_MS;
22566
+ const request = {
22567
+ clientId: input.clientId,
22568
+ createdAt: now,
22569
+ expectedIssuerPublicJwk: config.defaultExpectedIssuerPublicJwk,
22570
+ expiresAt: now + ttlMs,
22571
+ nonce,
22572
+ requestedClaims: input.requestedClaims,
22573
+ requestId,
22574
+ responseUri: config.getResponseUri(requestId),
22575
+ state: input.state
22576
+ };
22577
+ await config.requestStore.saveRequest(request);
22578
+ const requestObject = await signJwt({
22579
+ aud: "https://self-issued.me/v2",
22580
+ client_id: input.clientId,
22581
+ iat: Math.floor(now / MS_PER_SECOND6),
22582
+ iss: issuer,
22583
+ nonce,
22584
+ presentation_definition: buildSimplePresentationDefinition(requestId, input.requestedClaims),
22585
+ response_mode: "direct_post",
22586
+ response_type: "vp_token",
22587
+ response_uri: request.responseUri,
22588
+ state: input.state
22589
+ }, config.clientSigningKey);
22590
+ return {
22591
+ nonce,
22592
+ request,
22593
+ requestObject,
22594
+ requestUri: getRequestUri(requestId)
22595
+ };
22596
+ };
22597
+ var buildSimplePresentationDefinition = (requestId, requestedClaims) => ({
22598
+ id: requestId,
22599
+ input_descriptors: [
22600
+ {
22601
+ constraints: {
22602
+ fields: requestedClaims.map((claim) => ({
22603
+ path: [`$.${claim}`]
22604
+ })),
22605
+ limit_disclosure: "required"
22606
+ },
22607
+ format: { "vc+sd-jwt": { "sd-jwt_alg_values": ["ES256"] } },
22608
+ id: "sd-jwt-vc",
22609
+ name: "SD-JWT VC",
22610
+ purpose: "Verify holder claims"
22611
+ }
22612
+ ]
22613
+ });
22614
+ var verifyPresentationResponse = async ({
22615
+ config,
22616
+ input,
22617
+ now = Date.now()
22618
+ }) => {
22619
+ const failFor = (error) => {
22620
+ const failure = { error, ok: false };
22621
+ return failure;
22622
+ };
22623
+ const request = await config.requestStore.consumeRequest(input.requestId);
22624
+ if (request === undefined)
22625
+ return failFor("unknown_request");
22626
+ if (request.expiresAt < now)
22627
+ return failFor("expired_request");
22628
+ const verified = await verifySdJwtVc({
22629
+ issuerPublicJwk: request.expectedIssuerPublicJwk,
22630
+ token: input.vpToken
22631
+ });
22632
+ if (verified === undefined)
22633
+ return failFor("invalid_signature");
22634
+ if (verified.cnf !== undefined) {
22635
+ if (verified.keyBindingJwt === undefined) {
22636
+ return failFor("invalid_holder_binding");
22637
+ }
22638
+ const valid = await verifyHolderBinding({
22639
+ audience: request.clientId,
22640
+ holderJwk: verified.cnf.jwk,
22641
+ keyBindingJwt: verified.keyBindingJwt,
22642
+ nonce: request.nonce
22643
+ });
22644
+ if (!valid)
22645
+ return failFor("invalid_holder_binding");
22646
+ }
22647
+ const missingClaims = request.requestedClaims.filter((claim) => !(claim in verified.disclosedClaims));
22648
+ if (missingClaims.length > 0)
22649
+ return failFor("missing_claims");
22650
+ const statusValid = await checkStatus({
22651
+ config,
22652
+ credentialClaims: verified.protectedClaims
22653
+ });
22654
+ if (!statusValid)
22655
+ return failFor("revoked_credential");
22656
+ const success = {
22657
+ ok: true,
22658
+ verified: {
22659
+ disclosedClaims: verified.disclosedClaims,
22660
+ holderJwk: verified.cnf?.jwk,
22661
+ missingClaims,
22662
+ protectedClaims: verified.protectedClaims,
22663
+ requestId: request.requestId,
22664
+ statusValid: true
22665
+ }
22666
+ };
22667
+ return success;
22668
+ };
22669
+ var verifyHolderBinding = async ({
22670
+ audience,
22671
+ holderJwk,
22672
+ keyBindingJwt,
22673
+ nonce
22674
+ }) => {
22675
+ const decoded = await verifyJwt(keyBindingJwt, holderJwk);
22676
+ if (decoded === undefined)
22677
+ return false;
22678
+ const rawPayload = decoded.payload;
22679
+ if (typeof rawPayload !== "object" || rawPayload === null)
22680
+ return false;
22681
+ const payload = { ...rawPayload };
22682
+ if (payload.aud !== audience)
22683
+ return false;
22684
+ if (payload.nonce !== nonce)
22685
+ return false;
22686
+ if (typeof payload.iat !== "number")
22687
+ return false;
22688
+ return true;
22689
+ };
22690
+ var checkStatus = async ({
22691
+ config,
22692
+ credentialClaims
22693
+ }) => {
22694
+ if (config.statusListResolver === undefined)
22695
+ return true;
22696
+ if (config.statusListPublicJwk === undefined)
22697
+ return true;
22698
+ const { status } = credentialClaims;
22699
+ if (typeof status !== "object" || status === null)
22700
+ return true;
22701
+ const list = Reflect.get(status, "status_list");
22702
+ if (typeof list !== "object" || list === null)
22703
+ return true;
22704
+ const uri = Reflect.get(list, "uri");
22705
+ const idx = Reflect.get(list, "idx");
22706
+ if (typeof uri !== "string" || typeof idx !== "number")
22707
+ return true;
22708
+ const token = await config.statusListResolver(uri);
22709
+ if (token === undefined)
22710
+ return true;
22711
+ const verified = await verifyStatusListJwt({
22712
+ issuerPublicJwk: config.statusListPublicJwk,
22713
+ token
22714
+ });
22715
+ if (verified === undefined)
22716
+ return false;
22717
+ const bitsPerByte = 8;
22718
+ const byteIndex = Math.floor(idx / bitsPerByte);
22719
+ const bitIndex = idx % bitsPerByte;
22720
+ const byte = verified.bits[byteIndex] ?? 0;
22721
+ return (byte >> bitIndex & 1) === 0;
22722
+ };
22723
+ var buildHolderKeyBindingJwt = async ({
22724
+ audience,
22725
+ holderKey,
22726
+ nonce,
22727
+ now = Date.now(),
22728
+ sdHash
22729
+ }) => signJwt({
22730
+ aud: audience,
22731
+ iat: Math.floor(now / MS_PER_SECOND6),
22732
+ nonce,
22733
+ sd_hash: sdHash
22734
+ }, holderKey);
22735
+ var parsePresentationToken = (vpToken) => parseSdJwtVc(vpToken);
22736
+ // src/vc/inMemoryVpStores.ts
22737
+ var createInMemoryPresentationRequestStore = () => {
22738
+ const requests = new Map;
22739
+ return {
22740
+ consumeRequest: async (requestId) => {
22741
+ const request = requests.get(requestId);
22742
+ if (request === undefined)
22743
+ return;
22744
+ requests.delete(requestId);
22745
+ return request;
22746
+ },
22747
+ getRequest: async (requestId) => requests.get(requestId),
22748
+ saveRequest: async (request) => {
22749
+ requests.set(request.requestId, request);
22750
+ }
22751
+ };
22752
+ };
22753
+ // src/vc/vpRoutes.ts
22754
+ import { Elysia as Elysia37, t as t33 } from "elysia";
22755
+ var HTTP_OK5 = 200;
22756
+ var HTTP_BAD_REQUEST4 = 400;
22757
+ var HTTP_NOT_FOUND2 = 404;
22758
+ var errorBody2 = (error, status) => new Response(JSON.stringify({ error }), {
22759
+ headers: { "content-type": "application/json" },
22760
+ status
22761
+ });
22762
+ var DEFAULT_VP_ROUTE = "/vp";
22763
+ var vpRoutes = ({
22764
+ defaultClientId,
22765
+ issuerUrl,
22766
+ onVerifiedPresentation,
22767
+ vpConfig,
22768
+ vpRoute = DEFAULT_VP_ROUTE
22769
+ }) => {
22770
+ const authorizeRoute = `${vpRoute}/authorize`;
22771
+ const requestRoute = `${vpRoute}/request/:id`;
22772
+ const responseRoute = `${vpRoute}/response`;
22773
+ return new Elysia37().post(authorizeRoute, async ({ body }) => {
22774
+ const input = {
22775
+ clientId: body.client_id ?? defaultClientId,
22776
+ requestedClaims: body.requested_claims,
22777
+ state: body.state
22778
+ };
22779
+ const result = await createPresentationRequest({
22780
+ config: vpConfig,
22781
+ input,
22782
+ issuer: issuerUrl,
22783
+ getRequestUri: (id) => `${issuerUrl}${vpRoute}/request/${id}`
22784
+ });
22785
+ return Response.json({
22786
+ nonce: result.nonce,
22787
+ request_uri: result.requestUri,
22788
+ requestId: result.request.requestId
22789
+ }, { status: HTTP_OK5 });
22790
+ }, {
22791
+ body: t33.Object({
22792
+ client_id: t33.Optional(t33.String()),
22793
+ requested_claims: t33.Array(t33.String()),
22794
+ state: t33.Optional(t33.String())
22795
+ })
22796
+ }).get(requestRoute, async ({ params: { id } }) => {
22797
+ const stored = await vpConfig.requestStore.getRequest(id);
22798
+ if (stored === undefined) {
22799
+ return errorBody2("unknown_request", HTTP_NOT_FOUND2);
22800
+ }
22801
+ const rebuilt = await createPresentationRequest({
22802
+ config: { ...vpConfig, requestStore: passthroughStore(stored) },
22803
+ input: {
22804
+ clientId: stored.clientId,
22805
+ requestedClaims: stored.requestedClaims,
22806
+ state: stored.state
22807
+ },
22808
+ issuer: issuerUrl,
22809
+ getRequestUri: () => `${issuerUrl}${vpRoute}/request/${id}`
22810
+ });
22811
+ return new Response(rebuilt.requestObject, {
22812
+ headers: { "content-type": "application/oauth-authz-req+jwt" },
22813
+ status: HTTP_OK5
22814
+ });
22815
+ }, { params: t33.Object({ id: t33.String() }) }).post(responseRoute, async ({ body }) => {
22816
+ const requestId = body.state;
22817
+ if (requestId === undefined) {
22818
+ return errorBody2("missing_state", HTTP_BAD_REQUEST4);
22819
+ }
22820
+ const result = await verifyPresentationResponse({
22821
+ config: vpConfig,
22822
+ input: { requestId, vpToken: body.vp_token }
22823
+ });
22824
+ if (!result.ok)
22825
+ return errorBody2(result.error, HTTP_BAD_REQUEST4);
22826
+ if (onVerifiedPresentation !== undefined) {
22827
+ await onVerifiedPresentation({ verified: result.verified });
22828
+ }
22829
+ return Response.json({
22830
+ disclosed_claims: result.verified.disclosedClaims,
22831
+ holder_jwk: result.verified.holderJwk,
22832
+ protected_claims: result.verified.protectedClaims,
22833
+ verified: true
22834
+ }, { status: HTTP_OK5 });
22835
+ }, {
22836
+ body: t33.Object({
22837
+ presentation_submission: t33.Optional(t33.Unknown()),
22838
+ state: t33.Optional(t33.String()),
22839
+ vp_token: t33.String()
22840
+ })
22841
+ });
22842
+ };
22843
+ var passthroughStore = (request) => ({
22844
+ consumeRequest: async () => request,
22845
+ getRequest: async () => request,
22846
+ saveRequest: async () => {}
22847
+ });
22848
+ // src/vc/postgresVcStores.ts
22849
+ var ID_LENGTH5 = 255;
22850
+ var vcCredentialNoncesTable = pgTable("auth_vc_credential_nonces", {
22851
+ expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22852
+ nonce_hash: varchar("nonce_hash", { length: ID_LENGTH5 }).primaryKey()
22853
+ });
22854
+ var vcCredentialOffersTable = pgTable("auth_vc_credential_offers", {
22855
+ client_id: varchar("client_id", { length: ID_LENGTH5 }).notNull(),
22856
+ configuration_id: varchar("configuration_id", {
22857
+ length: ID_LENGTH5
22858
+ }).notNull(),
22859
+ created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22860
+ expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22861
+ pre_authorized_code_hash: varchar("pre_authorized_code_hash", {
22862
+ length: ID_LENGTH5
22863
+ }).primaryKey(),
22864
+ redeemed: boolean("redeemed").notNull(),
22865
+ user_id: varchar("user_id", { length: ID_LENGTH5 }).notNull()
22866
+ });
22867
+ var vcPresentationRequestsTable = pgTable("auth_vc_presentation_requests", {
22868
+ client_id: varchar("client_id", { length: ID_LENGTH5 }).notNull(),
22869
+ created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22870
+ expected_issuer_jwk_json: jsonb("expected_issuer_jwk_json").$type().notNull(),
22871
+ expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22872
+ nonce: varchar("nonce", { length: ID_LENGTH5 }).notNull(),
22873
+ request_id: varchar("request_id", { length: ID_LENGTH5 }).primaryKey(),
22874
+ requested_claims: jsonb("requested_claims").$type().notNull(),
22875
+ response_uri: varchar("response_uri", { length: ID_LENGTH5 }).notNull(),
22876
+ state: varchar("state", { length: ID_LENGTH5 })
22877
+ });
22878
+ var toOffer = (row) => ({
22879
+ clientId: row.client_id,
22880
+ configurationId: row.configuration_id,
22881
+ createdAt: row.created_at_ms,
22882
+ expiresAt: row.expires_at_ms,
22883
+ preAuthorizedCodeHash: row.pre_authorized_code_hash,
22884
+ redeemed: row.redeemed,
22885
+ userId: row.user_id
22886
+ });
22887
+ var toOfferValues = (offer) => ({
22888
+ client_id: offer.clientId,
22889
+ configuration_id: offer.configurationId,
22890
+ created_at_ms: offer.createdAt,
22891
+ expires_at_ms: offer.expiresAt,
22892
+ pre_authorized_code_hash: offer.preAuthorizedCodeHash,
22893
+ redeemed: offer.redeemed,
22894
+ user_id: offer.userId
22895
+ });
22896
+ var toPresentationRequest = (row) => ({
22897
+ clientId: row.client_id,
22898
+ createdAt: row.created_at_ms,
22899
+ expectedIssuerPublicJwk: row.expected_issuer_jwk_json,
22900
+ expiresAt: row.expires_at_ms,
22901
+ nonce: row.nonce,
22902
+ requestedClaims: row.requested_claims,
22903
+ requestId: row.request_id,
22904
+ responseUri: row.response_uri,
22905
+ state: row.state ?? undefined
22906
+ });
22907
+ var toPresentationRequestValues = (request) => ({
22908
+ client_id: request.clientId,
22909
+ created_at_ms: request.createdAt,
22910
+ expected_issuer_jwk_json: request.expectedIssuerPublicJwk,
22911
+ expires_at_ms: request.expiresAt,
22912
+ nonce: request.nonce,
22913
+ request_id: request.requestId,
22914
+ requested_claims: request.requestedClaims,
22915
+ response_uri: request.responseUri,
22916
+ state: request.state ?? null
22917
+ });
22918
+ var createNeonCredentialNonceStore = (databaseUrl) => createPostgresCredentialNonceStore(createNeonDatabase(databaseUrl));
22919
+ var createNeonCredentialOfferStore = (databaseUrl) => createPostgresCredentialOfferStore(createNeonDatabase(databaseUrl));
22920
+ var createNeonPresentationRequestStore = (databaseUrl) => createPostgresPresentationRequestStore(createNeonDatabase(databaseUrl));
22921
+ var createPostgresCredentialNonceStore = (database) => ({
22922
+ consumeNonce: async (nonceHash) => {
22923
+ const rows = await database.select().from(vcCredentialNoncesTable).where(eq(vcCredentialNoncesTable.nonce_hash, nonceHash)).limit(1);
22924
+ const [row] = rows;
22925
+ if (row === undefined)
22926
+ return;
22927
+ await database.delete(vcCredentialNoncesTable).where(eq(vcCredentialNoncesTable.nonce_hash, nonceHash));
22928
+ const record = {
22929
+ expiresAt: row.expires_at_ms,
22930
+ nonceHash: row.nonce_hash
22931
+ };
22932
+ return record;
22933
+ },
22934
+ saveNonce: async (record) => {
22935
+ await database.insert(vcCredentialNoncesTable).values({
22936
+ expires_at_ms: record.expiresAt,
22937
+ nonce_hash: record.nonceHash
22938
+ });
22939
+ }
22940
+ });
22941
+ var createPostgresCredentialOfferStore = (database) => ({
22942
+ consumeOffer: async (preAuthorizedCodeHash) => {
22943
+ const rows = await database.select().from(vcCredentialOffersTable).where(eq(vcCredentialOffersTable.pre_authorized_code_hash, preAuthorizedCodeHash)).limit(1);
22944
+ const [row] = rows;
22945
+ if (row === undefined)
22946
+ return;
22947
+ await database.update(vcCredentialOffersTable).set({ redeemed: true }).where(eq(vcCredentialOffersTable.pre_authorized_code_hash, preAuthorizedCodeHash));
22948
+ return toOffer(row);
22949
+ },
22950
+ saveOffer: async (offer) => {
22951
+ await database.insert(vcCredentialOffersTable).values(toOfferValues(offer));
22952
+ }
22953
+ });
22954
+ var createPostgresPresentationRequestStore = (database) => ({
22955
+ consumeRequest: async (requestId) => {
22956
+ const rows = await database.select().from(vcPresentationRequestsTable).where(eq(vcPresentationRequestsTable.request_id, requestId)).limit(1);
22957
+ const [row] = rows;
22958
+ if (row === undefined)
22959
+ return;
22960
+ await database.delete(vcPresentationRequestsTable).where(eq(vcPresentationRequestsTable.request_id, requestId));
22961
+ return toPresentationRequest(row);
22962
+ },
22963
+ getRequest: async (requestId) => {
22964
+ const rows = await database.select().from(vcPresentationRequestsTable).where(eq(vcPresentationRequestsTable.request_id, requestId)).limit(1);
22965
+ const [row] = rows;
22966
+ return row === undefined ? undefined : toPresentationRequest(row);
22967
+ },
22968
+ saveRequest: async (request) => {
22969
+ await database.insert(vcPresentationRequestsTable).values(toPresentationRequestValues(request));
22970
+ }
22971
+ });
22387
22972
  // src/scim/inMemoryScimTokenStore.ts
22388
22973
  var createInMemoryScimTokenStore = () => {
22389
22974
  const tokens = new Map;
@@ -22399,15 +22984,15 @@ var createInMemoryScimTokenStore = () => {
22399
22984
  };
22400
22985
  };
22401
22986
  // src/scim/postgresScimTokenStore.ts
22402
- var ID_LENGTH5 = 255;
22987
+ var ID_LENGTH6 = 255;
22403
22988
  var scimTokensTable = pgTable("auth_scim_tokens", {
22404
22989
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22405
- hashed_token: varchar("hashed_token", { length: ID_LENGTH5 }).notNull(),
22990
+ hashed_token: varchar("hashed_token", { length: ID_LENGTH6 }).notNull(),
22406
22991
  last_used_at_ms: bigint("last_used_at_ms", { mode: "number" }),
22407
22992
  organization_id: varchar("organization_id", {
22408
- length: ID_LENGTH5
22993
+ length: ID_LENGTH6
22409
22994
  }).notNull(),
22410
- token_id: varchar("token_id", { length: ID_LENGTH5 }).primaryKey()
22995
+ token_id: varchar("token_id", { length: ID_LENGTH6 }).primaryKey()
22411
22996
  });
22412
22997
  var toToken2 = (row) => ({
22413
22998
  createdAt: row.created_at_ms,
@@ -22496,33 +23081,33 @@ var createInMemoryApiKeyStore = () => {
22496
23081
  };
22497
23082
  };
22498
23083
  // src/apikeys/postgresStores.ts
22499
- var ID_LENGTH6 = 255;
23084
+ var ID_LENGTH7 = 255;
22500
23085
  var accessTokensTable = pgTable("auth_access_tokens", {
22501
- client_id: varchar("client_id", { length: ID_LENGTH6 }).notNull(),
23086
+ client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
22502
23087
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22503
23088
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22504
- hashed_token: varchar("hashed_token", { length: ID_LENGTH6 }).notNull(),
22505
- owner_id: varchar("owner_id", { length: ID_LENGTH6 }),
23089
+ hashed_token: varchar("hashed_token", { length: ID_LENGTH7 }).notNull(),
23090
+ owner_id: varchar("owner_id", { length: ID_LENGTH7 }),
22506
23091
  scopes: text("scopes").array().notNull(),
22507
- token_id: varchar("token_id", { length: ID_LENGTH6 }).primaryKey()
23092
+ token_id: varchar("token_id", { length: ID_LENGTH7 }).primaryKey()
22508
23093
  });
22509
23094
  var apiClientsTable = pgTable("auth_api_clients", {
22510
- client_id: varchar("client_id", { length: ID_LENGTH6 }).primaryKey(),
23095
+ client_id: varchar("client_id", { length: ID_LENGTH7 }).primaryKey(),
22511
23096
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22512
- hashed_secret: varchar("hashed_secret", { length: ID_LENGTH6 }).notNull(),
22513
- name: varchar("name", { length: ID_LENGTH6 }).notNull(),
22514
- owner_id: varchar("owner_id", { length: ID_LENGTH6 }),
23097
+ hashed_secret: varchar("hashed_secret", { length: ID_LENGTH7 }).notNull(),
23098
+ name: varchar("name", { length: ID_LENGTH7 }).notNull(),
23099
+ owner_id: varchar("owner_id", { length: ID_LENGTH7 }),
22515
23100
  scopes: text("scopes").array().notNull()
22516
23101
  });
22517
23102
  var apiKeysTable = pgTable("auth_api_keys", {
22518
23103
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22519
23104
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }),
22520
- hashed_key: varchar("hashed_key", { length: ID_LENGTH6 }).notNull(),
22521
- key_id: varchar("key_id", { length: ID_LENGTH6 }).primaryKey(),
23105
+ hashed_key: varchar("hashed_key", { length: ID_LENGTH7 }).notNull(),
23106
+ key_id: varchar("key_id", { length: ID_LENGTH7 }).primaryKey(),
22522
23107
  last_used_at_ms: bigint("last_used_at_ms", { mode: "number" }),
22523
- name: varchar("name", { length: ID_LENGTH6 }).notNull(),
22524
- owner_id: varchar("owner_id", { length: ID_LENGTH6 }),
22525
- prefix: varchar("prefix", { length: ID_LENGTH6 }).notNull(),
23108
+ name: varchar("name", { length: ID_LENGTH7 }).notNull(),
23109
+ owner_id: varchar("owner_id", { length: ID_LENGTH7 }),
23110
+ prefix: varchar("prefix", { length: ID_LENGTH7 }).notNull(),
22526
23111
  scopes: text("scopes").array().notNull()
22527
23112
  });
22528
23113
  var toKey = (row) => ({
@@ -22831,11 +23416,11 @@ var createInMemoryPushedAuthorizationRequestStore = () => {
22831
23416
  // src/oidc/postgresStores.ts
22832
23417
  var URL_LENGTH = 2048;
22833
23418
  var DEFAULT_LIST_LIMIT2 = 100;
22834
- var ID_LENGTH7 = 255;
23419
+ var ID_LENGTH8 = 255;
22835
23420
  var oauthBackchannelAuthRequestsTable = pgTable("auth_oauth_backchannel_auth_requests", {
22836
- auth_req_id: varchar("auth_req_id", { length: ID_LENGTH7 }).primaryKey(),
23421
+ auth_req_id: varchar("auth_req_id", { length: ID_LENGTH8 }).primaryKey(),
22837
23422
  binding_message: text("binding_message"),
22838
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23423
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
22839
23424
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22840
23425
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22841
23426
  interval_seconds: bigint("interval_seconds", {
@@ -22844,30 +23429,30 @@ var oauthBackchannelAuthRequestsTable = pgTable("auth_oauth_backchannel_auth_req
22844
23429
  last_polled_at_ms: bigint("last_polled_at_ms", { mode: "number" }),
22845
23430
  scopes: text("scopes").array().notNull(),
22846
23431
  status: varchar("status", { length: 16 }).notNull(),
22847
- user_sub: varchar("user_sub", { length: ID_LENGTH7 })
23432
+ user_sub: varchar("user_sub", { length: ID_LENGTH8 })
22848
23433
  });
22849
23434
  var oauthClientAssertionJtisTable = pgTable("auth_oauth_client_assertion_jtis", {
22850
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23435
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
22851
23436
  composite_key: varchar("composite_key", {
22852
- length: ID_LENGTH7
23437
+ length: ID_LENGTH8
22853
23438
  }).primaryKey(),
22854
23439
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22855
- jti: varchar("jti", { length: ID_LENGTH7 }).notNull()
23440
+ jti: varchar("jti", { length: ID_LENGTH8 }).notNull()
22856
23441
  });
22857
23442
  var oauthClientRegistrationTokensTable = pgTable("auth_oauth_client_registration_tokens", {
22858
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23443
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
22859
23444
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22860
- token_hash: varchar("token_hash", { length: ID_LENGTH7 }).primaryKey()
23445
+ token_hash: varchar("token_hash", { length: ID_LENGTH8 }).primaryKey()
22861
23446
  });
22862
23447
  var oauthClientsTable = pgTable("auth_oauth_clients", {
22863
23448
  backchannel_logout_uri: varchar("backchannel_logout_uri", {
22864
23449
  length: URL_LENGTH
22865
23450
  }),
22866
- client_id: varchar("client_id", { length: ID_LENGTH7 }).primaryKey(),
22867
- hashed_secret: varchar("hashed_secret", { length: ID_LENGTH7 }),
23451
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).primaryKey(),
23452
+ hashed_secret: varchar("hashed_secret", { length: ID_LENGTH8 }),
22868
23453
  jwks_json: jsonb("jwks_json").$type(),
22869
23454
  jwks_uri: varchar("jwks_uri", { length: URL_LENGTH }),
22870
- name: varchar("name", { length: ID_LENGTH7 }).notNull(),
23455
+ name: varchar("name", { length: ID_LENGTH8 }).notNull(),
22871
23456
  post_logout_redirect_uris: text("post_logout_redirect_uris").array(),
22872
23457
  redirect_uris: text("redirect_uris").array().notNull(),
22873
23458
  require_pushed_authorization_requests: boolean("require_pushed_authorization_requests"),
@@ -22875,65 +23460,65 @@ var oauthClientsTable = pgTable("auth_oauth_clients", {
22875
23460
  scopes: text("scopes").array().notNull()
22876
23461
  });
22877
23462
  var oauthCodesTable = pgTable("auth_oauth_codes", {
22878
- acr: varchar("acr", { length: ID_LENGTH7 }),
23463
+ acr: varchar("acr", { length: ID_LENGTH8 }),
22879
23464
  claims_json: jsonb("claims_json").$type(),
22880
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
22881
- code_challenge: varchar("code_challenge", { length: ID_LENGTH7 }).notNull(),
22882
- code_hash: varchar("code_hash", { length: ID_LENGTH7 }).primaryKey(),
23465
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
23466
+ code_challenge: varchar("code_challenge", { length: ID_LENGTH8 }).notNull(),
23467
+ code_hash: varchar("code_hash", { length: ID_LENGTH8 }).primaryKey(),
22883
23468
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22884
- dpop_jkt: varchar("dpop_jkt", { length: ID_LENGTH7 }),
23469
+ dpop_jkt: varchar("dpop_jkt", { length: ID_LENGTH8 }),
22885
23470
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22886
- nonce: varchar("nonce", { length: ID_LENGTH7 }),
22887
- redirect_uri: varchar("redirect_uri", { length: ID_LENGTH7 }).notNull(),
23471
+ nonce: varchar("nonce", { length: ID_LENGTH8 }),
23472
+ redirect_uri: varchar("redirect_uri", { length: ID_LENGTH8 }).notNull(),
22888
23473
  scopes: text("scopes").array().notNull(),
22889
- user_id: varchar("user_id", { length: ID_LENGTH7 }).notNull()
23474
+ user_id: varchar("user_id", { length: ID_LENGTH8 }).notNull()
22890
23475
  });
22891
23476
  var oauthDeviceAuthorizationsTable = pgTable("auth_oauth_device_authorizations", {
22892
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23477
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
22893
23478
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22894
23479
  device_code_hash: varchar("device_code_hash", {
22895
- length: ID_LENGTH7
23480
+ length: ID_LENGTH8
22896
23481
  }).primaryKey(),
22897
23482
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22898
23483
  interval_seconds: bigint("interval_seconds", { mode: "number" }).notNull(),
22899
23484
  scopes: text("scopes").array().notNull(),
22900
23485
  status: varchar("status", { length: 16 }).notNull(),
22901
23486
  user_code: varchar("user_code", { length: 16 }).notNull().unique(),
22902
- user_sub: varchar("user_sub", { length: ID_LENGTH7 })
23487
+ user_sub: varchar("user_sub", { length: ID_LENGTH8 })
22903
23488
  });
22904
23489
  var oauthInitialAccessTokensTable = pgTable("auth_oauth_initial_access_tokens", {
22905
- token_hash: varchar("token_hash", { length: ID_LENGTH7 }).primaryKey()
23490
+ token_hash: varchar("token_hash", { length: ID_LENGTH8 }).primaryKey()
22906
23491
  });
22907
23492
  var oauthLogoutDeliveriesTable = pgTable("auth_oauth_logout_deliveries", {
22908
23493
  attempts: bigint("attempts", { mode: "number" }).notNull(),
22909
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23494
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
22910
23495
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22911
23496
  endpoint_url: varchar("endpoint_url", { length: URL_LENGTH }).notNull(),
22912
- id: varchar("id", { length: ID_LENGTH7 }).primaryKey(),
23497
+ id: varchar("id", { length: ID_LENGTH8 }).primaryKey(),
22913
23498
  last_error: text("last_error"),
22914
23499
  last_status: bigint("last_status", { mode: "number" }),
22915
23500
  logout_token: text("logout_token").notNull(),
22916
- user_id: varchar("user_id", { length: ID_LENGTH7 }).notNull()
23501
+ user_id: varchar("user_id", { length: ID_LENGTH8 }).notNull()
22917
23502
  });
22918
23503
  var oauthPushedAuthorizationRequestsTable = pgTable("auth_oauth_pushed_authorization_requests", {
22919
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23504
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
22920
23505
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22921
23506
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22922
23507
  params_json: jsonb("params_json").$type().notNull(),
22923
23508
  request_uri_hash: varchar("request_uri_hash", {
22924
- length: ID_LENGTH7
23509
+ length: ID_LENGTH8
22925
23510
  }).primaryKey()
22926
23511
  });
22927
23512
  var oauthRefreshTokensTable = pgTable("auth_oauth_refresh_tokens", {
22928
- acr: varchar("acr", { length: ID_LENGTH7 }),
23513
+ acr: varchar("acr", { length: ID_LENGTH8 }),
22929
23514
  claims_json: jsonb("claims_json").$type(),
22930
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23515
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
22931
23516
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22932
- dpop_jkt: varchar("dpop_jkt", { length: ID_LENGTH7 }),
23517
+ dpop_jkt: varchar("dpop_jkt", { length: ID_LENGTH8 }),
22933
23518
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22934
23519
  scopes: text("scopes").array().notNull(),
22935
- token_hash: varchar("token_hash", { length: ID_LENGTH7 }).primaryKey(),
22936
- user_id: varchar("user_id", { length: ID_LENGTH7 }).notNull()
23520
+ token_hash: varchar("token_hash", { length: ID_LENGTH8 }).primaryKey(),
23521
+ user_id: varchar("user_id", { length: ID_LENGTH8 }).notNull()
22937
23522
  });
22938
23523
  var toClient2 = (row) => ({
22939
23524
  backchannelLogoutUri: row.backchannel_logout_uri ?? undefined,
@@ -23456,29 +24041,29 @@ var createInMemoryLoginHistoryStore = () => {
23456
24041
  };
23457
24042
  };
23458
24043
  // src/adaptive/postgresStores.ts
23459
- var ID_LENGTH8 = 255;
24044
+ var ID_LENGTH9 = 255;
23460
24045
  var knownDevicesTable = pgTable("auth_known_devices", {
23461
- device_id: varchar("device_id", { length: ID_LENGTH8 }).notNull(),
24046
+ device_id: varchar("device_id", { length: ID_LENGTH9 }).notNull(),
23462
24047
  first_seen_at_ms: bigint("first_seen_at_ms", {
23463
24048
  mode: "number"
23464
24049
  }).notNull(),
23465
- label: varchar("label", { length: ID_LENGTH8 }),
24050
+ label: varchar("label", { length: ID_LENGTH9 }),
23466
24051
  last_seen_at_ms: bigint("last_seen_at_ms", {
23467
24052
  mode: "number"
23468
24053
  }).notNull(),
23469
24054
  trusted: boolean("trusted").notNull().default(false),
23470
- user_id: varchar("user_id", { length: ID_LENGTH8 }).notNull()
24055
+ user_id: varchar("user_id", { length: ID_LENGTH9 }).notNull()
23471
24056
  }, (table) => [primaryKey({ columns: [table.user_id, table.device_id] })]);
23472
24057
  var loginHistoryTable = pgTable("auth_login_history", {
23473
- attempt_id: varchar("attempt_id", { length: ID_LENGTH8 }).primaryKey(),
23474
- country: varchar("country", { length: ID_LENGTH8 }),
23475
- device_id: varchar("device_id", { length: ID_LENGTH8 }).notNull(),
23476
- ip_address: varchar("ip_address", { length: ID_LENGTH8 }),
24058
+ attempt_id: varchar("attempt_id", { length: ID_LENGTH9 }).primaryKey(),
24059
+ country: varchar("country", { length: ID_LENGTH9 }),
24060
+ device_id: varchar("device_id", { length: ID_LENGTH9 }).notNull(),
24061
+ ip_address: varchar("ip_address", { length: ID_LENGTH9 }),
23477
24062
  latitude: doublePrecision("latitude"),
23478
24063
  longitude: doublePrecision("longitude"),
23479
- outcome: varchar("outcome", { length: ID_LENGTH8 }).notNull(),
24064
+ outcome: varchar("outcome", { length: ID_LENGTH9 }).notNull(),
23480
24065
  timestamp_ms: bigint("timestamp_ms", { mode: "number" }).notNull(),
23481
- user_id: varchar("user_id", { length: ID_LENGTH8 }).notNull()
24066
+ user_id: varchar("user_id", { length: ID_LENGTH9 }).notNull()
23482
24067
  });
23483
24068
  var toRiskAction = (value) => {
23484
24069
  if (value === "deny")
@@ -23802,15 +24387,15 @@ var createRedisFgaCache = (redis, { keyPrefix = DEFAULT_PREFIX2, ttlMs = DEFAULT
23802
24387
  }
23803
24388
  });
23804
24389
  // src/fga/postgresStores.ts
23805
- var ID_LENGTH9 = 255;
24390
+ var ID_LENGTH10 = 255;
23806
24391
  var warrantsTable = pgTable("auth_fga_warrants", {
23807
- id: varchar("id", { length: ID_LENGTH9 }).primaryKey(),
23808
- relation: varchar("relation", { length: ID_LENGTH9 }).notNull(),
23809
- resource_id: varchar("resource_id", { length: ID_LENGTH9 }).notNull(),
23810
- resource_type: varchar("resource_type", { length: ID_LENGTH9 }).notNull(),
23811
- subject_id: varchar("subject_id", { length: ID_LENGTH9 }).notNull(),
23812
- subject_relation: varchar("subject_relation", { length: ID_LENGTH9 }),
23813
- subject_type: varchar("subject_type", { length: ID_LENGTH9 }).notNull()
24392
+ id: varchar("id", { length: ID_LENGTH10 }).primaryKey(),
24393
+ relation: varchar("relation", { length: ID_LENGTH10 }).notNull(),
24394
+ resource_id: varchar("resource_id", { length: ID_LENGTH10 }).notNull(),
24395
+ resource_type: varchar("resource_type", { length: ID_LENGTH10 }).notNull(),
24396
+ subject_id: varchar("subject_id", { length: ID_LENGTH10 }).notNull(),
24397
+ subject_relation: varchar("subject_relation", { length: ID_LENGTH10 }),
24398
+ subject_type: varchar("subject_type", { length: ID_LENGTH10 }).notNull()
23814
24399
  });
23815
24400
  var toWarrant = (row) => ({
23816
24401
  relation: row.relation,
@@ -23847,41 +24432,41 @@ var createPostgresWarrantStore = (db) => ({
23847
24432
  });
23848
24433
 
23849
24434
  // src/organizations/postgresOrganizationStore.ts
23850
- var ID_LENGTH10 = 255;
24435
+ var ID_LENGTH11 = 255;
23851
24436
  var NAME_LENGTH = 255;
23852
24437
  var STATE_LENGTH = 16;
23853
24438
  var organizationInvitationsTable = pgTable("auth_organization_invitations", {
23854
24439
  accepted_at_ms: bigint("accepted_at_ms", { mode: "number" }),
23855
24440
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
23856
- email: varchar("email", { length: ID_LENGTH10 }).notNull(),
24441
+ email: varchar("email", { length: ID_LENGTH11 }).notNull(),
23857
24442
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
23858
24443
  invitation_id: varchar("invitation_id", {
23859
- length: ID_LENGTH10
24444
+ length: ID_LENGTH11
23860
24445
  }).primaryKey(),
23861
- inviter_user_id: varchar("inviter_user_id", { length: ID_LENGTH10 }),
24446
+ inviter_user_id: varchar("inviter_user_id", { length: ID_LENGTH11 }),
23862
24447
  organization_id: varchar("organization_id", {
23863
- length: ID_LENGTH10
24448
+ length: ID_LENGTH11
23864
24449
  }).notNull(),
23865
24450
  roles: jsonb("roles").$type().notNull().default([]),
23866
24451
  state: varchar("state", { length: STATE_LENGTH }).$type().notNull().default("pending"),
23867
- token_hash: varchar("token_hash", { length: ID_LENGTH10 }).notNull().unique()
24452
+ token_hash: varchar("token_hash", { length: ID_LENGTH11 }).notNull().unique()
23868
24453
  });
23869
24454
  var organizationMembershipsTable = pgTable("auth_organization_memberships", {
23870
24455
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
23871
24456
  organization_id: varchar("organization_id", {
23872
- length: ID_LENGTH10
24457
+ length: ID_LENGTH11
23873
24458
  }).notNull(),
23874
24459
  roles: jsonb("roles").$type().notNull().default([]),
23875
24460
  status: varchar("status", { length: STATE_LENGTH }).$type().notNull().default("active"),
23876
24461
  updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull(),
23877
- user_id: varchar("user_id", { length: ID_LENGTH10 }).notNull()
24462
+ user_id: varchar("user_id", { length: ID_LENGTH11 }).notNull()
23878
24463
  }, (table) => [primaryKey({ columns: [table.organization_id, table.user_id] })]);
23879
24464
  var organizationsTable = pgTable("auth_organizations", {
23880
24465
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
23881
24466
  metadata: jsonb("metadata").$type(),
23882
24467
  name: varchar("name", { length: NAME_LENGTH }).notNull(),
23883
24468
  organization_id: varchar("organization_id", {
23884
- length: ID_LENGTH10
24469
+ length: ID_LENGTH11
23885
24470
  }).primaryKey(),
23886
24471
  updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull()
23887
24472
  });
@@ -23999,11 +24584,11 @@ var createPostgresOrganizationStore = (db) => ({
23999
24584
  });
24000
24585
 
24001
24586
  // src/passwordless/postgresPasswordlessTokenStore.ts
24002
- var ID_LENGTH11 = 255;
24587
+ var ID_LENGTH12 = 255;
24003
24588
  var passwordlessTokensTable = pgTable("auth_passwordless_tokens", {
24004
- email: varchar("email", { length: ID_LENGTH11 }).notNull(),
24589
+ email: varchar("email", { length: ID_LENGTH12 }).notNull(),
24005
24590
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
24006
- token_hash: varchar("token_hash", { length: ID_LENGTH11 }).primaryKey()
24591
+ token_hash: varchar("token_hash", { length: ID_LENGTH12 }).primaryKey()
24007
24592
  });
24008
24593
  var toToken3 = (row) => ({
24009
24594
  email: row.email,
@@ -24030,19 +24615,19 @@ var createPostgresPasswordlessTokenStore = (db) => ({
24030
24615
  });
24031
24616
 
24032
24617
  // src/portal/postgresSetupSessionStore.ts
24033
- var ID_LENGTH12 = 255;
24618
+ var ID_LENGTH13 = 255;
24034
24619
  var setupSessionsTable = pgTable("auth_setup_sessions", {
24035
24620
  capabilities: jsonb("capabilities").$type().notNull().default([]),
24036
24621
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24037
- created_by: varchar("created_by", { length: ID_LENGTH12 }),
24622
+ created_by: varchar("created_by", { length: ID_LENGTH13 }),
24038
24623
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
24039
24624
  organization_id: varchar("organization_id", {
24040
- length: ID_LENGTH12
24625
+ length: ID_LENGTH13
24041
24626
  }).notNull(),
24042
24627
  setup_session_id: varchar("setup_session_id", {
24043
- length: ID_LENGTH12
24628
+ length: ID_LENGTH13
24044
24629
  }).primaryKey(),
24045
- token_hash: varchar("token_hash", { length: ID_LENGTH12 }).notNull().unique()
24630
+ token_hash: varchar("token_hash", { length: ID_LENGTH13 }).notNull().unique()
24046
24631
  });
24047
24632
  var toSession = (row) => ({
24048
24633
  capabilities: row.capabilities,
@@ -24080,12 +24665,12 @@ var createPostgresSetupSessionStore = (db) => ({
24080
24665
  });
24081
24666
 
24082
24667
  // src/roles/postgresRoleStore.ts
24083
- var ID_LENGTH13 = 255;
24668
+ var ID_LENGTH14 = 255;
24084
24669
  var SLUG_LENGTH = 128;
24085
24670
  var GLOBAL_SCOPE = "";
24086
24671
  var rolesTable = pgTable("auth_roles", {
24087
24672
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24088
- organization_id: varchar("organization_id", { length: ID_LENGTH13 }).notNull().default(GLOBAL_SCOPE),
24673
+ organization_id: varchar("organization_id", { length: ID_LENGTH14 }).notNull().default(GLOBAL_SCOPE),
24089
24674
  permissions: jsonb("permissions").$type().notNull().default([]),
24090
24675
  slug: varchar("slug", { length: SLUG_LENGTH }).notNull(),
24091
24676
  updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull()
@@ -24126,13 +24711,13 @@ var createPostgresRoleStore = (db) => ({
24126
24711
  });
24127
24712
 
24128
24713
  // src/sso/postgresSamlServiceProviderStore.ts
24129
- var ID_LENGTH14 = 255;
24714
+ var ID_LENGTH15 = 255;
24130
24715
  var URL_LENGTH2 = 2048;
24131
24716
  var samlServiceProvidersTable = pgTable("auth_saml_service_providers", {
24132
24717
  acs_url: varchar("acs_url", { length: URL_LENGTH2 }).notNull(),
24133
24718
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24134
24719
  entity_id: varchar("entity_id", { length: URL_LENGTH2 }).primaryKey(),
24135
- name_id_format: varchar("name_id_format", { length: ID_LENGTH14 }),
24720
+ name_id_format: varchar("name_id_format", { length: ID_LENGTH15 }),
24136
24721
  signing_cert: text("signing_cert"),
24137
24722
  updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull()
24138
24723
  });
@@ -24174,15 +24759,15 @@ var createPostgresSamlServiceProviderStore = (db) => ({
24174
24759
  });
24175
24760
 
24176
24761
  // src/sso/postgresSsoConnectionStore.ts
24177
- var ID_LENGTH15 = 255;
24762
+ var ID_LENGTH16 = 255;
24178
24763
  var TYPE_LENGTH2 = 16;
24179
24764
  var ssoConnectionsTable = pgTable("auth_sso_connections", {
24180
24765
  config: jsonb("config").$type().notNull(),
24181
- connection_id: varchar("connection_id", { length: ID_LENGTH15 }).primaryKey(),
24766
+ connection_id: varchar("connection_id", { length: ID_LENGTH16 }).primaryKey(),
24182
24767
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24183
24768
  enabled: boolean("enabled").notNull().default(true),
24184
24769
  organization_id: varchar("organization_id", {
24185
- length: ID_LENGTH15
24770
+ length: ID_LENGTH16
24186
24771
  }).notNull(),
24187
24772
  type: varchar("type", { length: TYPE_LENGTH2 }).$type().notNull(),
24188
24773
  updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull()
@@ -24288,18 +24873,18 @@ var createPostgresSsoConnectionStore = (db) => ({
24288
24873
  });
24289
24874
 
24290
24875
  // src/webauthn/postgresWebAuthnCredentialStore.ts
24291
- var ID_LENGTH16 = 255;
24876
+ var ID_LENGTH17 = 255;
24292
24877
  var DEVICE_TYPE_LENGTH = 32;
24293
24878
  var webauthnCredentialsTable = pgTable("auth_webauthn_credentials", {
24294
24879
  backed_up: boolean("backed_up"),
24295
24880
  counter: bigint("counter", { mode: "number" }).notNull().default(0),
24296
24881
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24297
- credential_id: varchar("credential_id", { length: ID_LENGTH16 }).primaryKey(),
24882
+ credential_id: varchar("credential_id", { length: ID_LENGTH17 }).primaryKey(),
24298
24883
  device_type: varchar("device_type", { length: DEVICE_TYPE_LENGTH }),
24299
24884
  last_used_at_ms: bigint("last_used_at_ms", { mode: "number" }),
24300
24885
  public_key: text("public_key").notNull(),
24301
24886
  transports: jsonb("transports").$type(),
24302
- user_id: varchar("user_id", { length: ID_LENGTH16 }).notNull()
24887
+ user_id: varchar("user_id", { length: ID_LENGTH17 }).notNull()
24303
24888
  });
24304
24889
  var toCredential = (row) => ({
24305
24890
  backedUp: row.backed_up ?? undefined,
@@ -24346,14 +24931,14 @@ var createPostgresWebAuthnCredentialStore = (db) => ({
24346
24931
  });
24347
24932
 
24348
24933
  // src/webhooks/postgresStore.ts
24349
- var ID_LENGTH17 = 255;
24934
+ var ID_LENGTH18 = 255;
24350
24935
  var URL_LENGTH3 = 2048;
24351
24936
  var DEFAULT_LIST_LIMIT3 = 100;
24352
24937
  var webhookDeliveriesTable = pgTable("auth_webhook_deliveries", {
24353
24938
  attempts: bigint("attempts", { mode: "number" }).notNull(),
24354
24939
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24355
24940
  endpoint_url: varchar("endpoint_url", { length: URL_LENGTH3 }).notNull(),
24356
- envelope_id: varchar("envelope_id", { length: ID_LENGTH17 }).primaryKey(),
24941
+ envelope_id: varchar("envelope_id", { length: ID_LENGTH18 }).primaryKey(),
24357
24942
  envelope_json: jsonb("envelope_json").$type().notNull(),
24358
24943
  last_error: text("last_error"),
24359
24944
  last_status: bigint("last_status", { mode: "number" })
@@ -24543,22 +25128,27 @@ var blockMigrations = {
24543
25128
  ]),
24544
25129
  sso: initMigration("sso", [ssoConnectionsTable, samlServiceProvidersTable]),
24545
25130
  vault: initMigration("vault", [vaultEntriesTable]),
25131
+ vc: initMigration("vc", [
25132
+ vcCredentialOffersTable,
25133
+ vcCredentialNoncesTable,
25134
+ vcPresentationRequestsTable
25135
+ ]),
24546
25136
  webauthn: initMigration("webauthn", [webauthnCredentialsTable]),
24547
25137
  webhooks: initMigration("webhooks", [webhookDeliveriesTable])
24548
25138
  };
24549
25139
  // src/sso/samlIdpRoutes.ts
24550
- import { Elysia as Elysia36, t as t32 } from "elysia";
24551
- var HTTP_BAD_REQUEST4 = 400;
25140
+ import { Elysia as Elysia38, t as t34 } from "elysia";
25141
+ var HTTP_BAD_REQUEST5 = 400;
24552
25142
  var HTTP_UNAUTHORIZED4 = 401;
24553
25143
  var HTTP_FOUND2 = 302;
24554
- var HTTP_OK4 = 200;
25144
+ var HTTP_OK6 = 200;
24555
25145
  var xmlResponse = (body) => new Response(body, {
24556
25146
  headers: { "content-type": "application/samlmetadata+xml" },
24557
- status: HTTP_OK4
25147
+ status: HTTP_OK6
24558
25148
  });
24559
25149
  var htmlResponse = (body) => new Response(body, {
24560
25150
  headers: { "content-type": "text/html; charset=utf-8" },
24561
- status: HTTP_OK4
25151
+ status: HTTP_OK6
24562
25152
  });
24563
25153
  var redirectTo2 = (url) => new Response(null, { headers: { location: url }, status: HTTP_FOUND2 });
24564
25154
  var errorJson = (status, error) => new Response(JSON.stringify({ error }), {
@@ -24610,7 +25200,7 @@ var samlIdpRoutes = ({
24610
25200
  userSessionIdValue
24611
25201
  }) => {
24612
25202
  if (body.SAMLRequest === undefined) {
24613
- return errorJson(HTTP_BAD_REQUEST4, "missing_saml_request");
25203
+ return errorJson(HTTP_BAD_REQUEST5, "missing_saml_request");
24614
25204
  }
24615
25205
  let firstPass;
24616
25206
  try {
@@ -24619,11 +25209,11 @@ var samlIdpRoutes = ({
24619
25209
  samlRequest: body.SAMLRequest
24620
25210
  });
24621
25211
  } catch {
24622
- return errorJson(HTTP_BAD_REQUEST4, "invalid_authn_request");
25212
+ return errorJson(HTTP_BAD_REQUEST5, "invalid_authn_request");
24623
25213
  }
24624
25214
  const serviceProvider = await samlServiceProviderStore.findServiceProvider(firstPass.issuer);
24625
25215
  if (serviceProvider === undefined) {
24626
- return errorJson(HTTP_BAD_REQUEST4, "unknown_service_provider");
25216
+ return errorJson(HTTP_BAD_REQUEST5, "unknown_service_provider");
24627
25217
  }
24628
25218
  let parsed;
24629
25219
  try {
@@ -24636,7 +25226,7 @@ var samlIdpRoutes = ({
24636
25226
  signedQueryString: binding === "Redirect" ? new URL(request.url).search.slice(1) : undefined
24637
25227
  });
24638
25228
  } catch {
24639
- return errorJson(HTTP_BAD_REQUEST4, "invalid_authn_request");
25229
+ return errorJson(HTTP_BAD_REQUEST5, "invalid_authn_request");
24640
25230
  }
24641
25231
  const userSession = await loadSessionFromSource({
24642
25232
  authSessionStore,
@@ -24657,7 +25247,7 @@ var samlIdpRoutes = ({
24657
25247
  user: userSession.user
24658
25248
  });
24659
25249
  };
24660
- return new Elysia36().use(sessionStore()).post(ssoIdpRoute, async ({
25250
+ return new Elysia38().use(sessionStore()).post(ssoIdpRoute, async ({
24661
25251
  body,
24662
25252
  cookie: { user_session_id },
24663
25253
  request,
@@ -24669,12 +25259,12 @@ var samlIdpRoutes = ({
24669
25259
  request,
24670
25260
  userSessionIdValue: user_session_id.value
24671
25261
  }), {
24672
- body: t32.Object({
24673
- RelayState: t32.Optional(t32.String()),
24674
- SAMLRequest: t32.Optional(t32.String())
25262
+ body: t34.Object({
25263
+ RelayState: t34.Optional(t34.String()),
25264
+ SAMLRequest: t34.Optional(t34.String())
24675
25265
  }),
24676
- cookie: t32.Cookie({
24677
- user_session_id: t32.Optional(userSessionIdTypebox)
25266
+ cookie: t34.Cookie({
25267
+ user_session_id: t34.Optional(userSessionIdTypebox)
24678
25268
  })
24679
25269
  }).get(ssoIdpRoute, async ({
24680
25270
  cookie: { user_session_id },
@@ -24688,14 +25278,14 @@ var samlIdpRoutes = ({
24688
25278
  request,
24689
25279
  userSessionIdValue: user_session_id.value
24690
25280
  }), {
24691
- cookie: t32.Cookie({
24692
- user_session_id: t32.Optional(userSessionIdTypebox)
25281
+ cookie: t34.Cookie({
25282
+ user_session_id: t34.Optional(userSessionIdTypebox)
24693
25283
  }),
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())
25284
+ query: t34.Object({
25285
+ RelayState: t34.Optional(t34.String()),
25286
+ SAMLRequest: t34.Optional(t34.String()),
25287
+ SigAlg: t34.Optional(t34.String()),
25288
+ Signature: t34.Optional(t34.String())
24699
25289
  })
24700
25290
  }).get(idpInitiateRoute, async ({
24701
25291
  cookie: { user_session_id },
@@ -24704,11 +25294,11 @@ var samlIdpRoutes = ({
24704
25294
  store
24705
25295
  }) => {
24706
25296
  if (serviceProviderEntityId === undefined) {
24707
- return errorJson(HTTP_BAD_REQUEST4, "missing_sp");
25297
+ return errorJson(HTTP_BAD_REQUEST5, "missing_sp");
24708
25298
  }
24709
25299
  const serviceProvider = await samlServiceProviderStore.findServiceProvider(serviceProviderEntityId);
24710
25300
  if (serviceProvider === undefined) {
24711
- return errorJson(HTTP_BAD_REQUEST4, "unknown_service_provider");
25301
+ return errorJson(HTTP_BAD_REQUEST5, "unknown_service_provider");
24712
25302
  }
24713
25303
  const userSession = authSessionStore === undefined ? await loadSessionFromSource({
24714
25304
  session: store.session,
@@ -24731,12 +25321,12 @@ var samlIdpRoutes = ({
24731
25321
  user: userSession.user
24732
25322
  });
24733
25323
  }, {
24734
- cookie: t32.Cookie({
24735
- user_session_id: t32.Optional(userSessionIdTypebox)
25324
+ cookie: t34.Cookie({
25325
+ user_session_id: t34.Optional(userSessionIdTypebox)
24736
25326
  }),
24737
- query: t32.Object({
24738
- RelayState: t32.Optional(t32.String()),
24739
- sp: t32.Optional(t32.String())
25327
+ query: t34.Object({
25328
+ RelayState: t34.Optional(t34.String()),
25329
+ sp: t34.Optional(t34.String())
24740
25330
  })
24741
25331
  }).get(idpMetadataRoute, async ({ request }) => xmlResponse(await idpAdapter.getIdpMetadata({
24742
25332
  entityId: idpEntityId,
@@ -25034,7 +25624,7 @@ var auth = async ({
25034
25624
  const auditedOnCallbackSuccess = auditEmit ? composeCallbackAudit(onCallbackSuccess, auditEmit) : onCallbackSuccess;
25035
25625
  const auditedOnRevocationSuccess = auditEmit ? composeRevocationAudit(onRevocationSuccess, auditEmit) : onRevocationSuccess;
25036
25626
  const auditedOnSignOut = auditEmit ? composeSignOutAudit(onSignOut, auditEmit) : onSignOut;
25037
- return new Elysia37().use(sessionCleanup({
25627
+ return new Elysia39().use(sessionCleanup({
25038
25628
  authSessionStore,
25039
25629
  cleanupIntervalMs,
25040
25630
  maxSessions,
@@ -25082,53 +25672,53 @@ var auth = async ({
25082
25672
  authSessionStore,
25083
25673
  cookieSecure: resolvedCookieSecure,
25084
25674
  lockoutGuard
25085
- }) : new Elysia37).use(auditedMfa ? mfaRoutes({
25675
+ }) : new Elysia39).use(auditedMfa ? mfaRoutes({
25086
25676
  ...auditedMfa,
25087
25677
  authSessionStore,
25088
25678
  cookieSecure: resolvedCookieSecure
25089
- }) : new Elysia37).use(passwordless ? passwordlessRoutes({
25679
+ }) : new Elysia39).use(passwordless ? passwordlessRoutes({
25090
25680
  ...passwordless,
25091
25681
  authSessionStore,
25092
25682
  cookieSecure: resolvedCookieSecure,
25093
25683
  emit: auditEmit
25094
- }) : new Elysia37).use(sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia37).use(sso ? oidcSsoRoutes({
25684
+ }) : new Elysia39).use(sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia39).use(sso ? oidcSsoRoutes({
25095
25685
  ...sso,
25096
25686
  authSessionStore,
25097
25687
  cookieSecure: resolvedCookieSecure
25098
- }) : new Elysia37).use(sso && sso.samlAdapter ? samlSsoRoutes({
25688
+ }) : new Elysia39).use(sso && sso.samlAdapter ? samlSsoRoutes({
25099
25689
  ...sso,
25100
25690
  authSessionStore,
25101
25691
  cookieSecure: resolvedCookieSecure,
25102
25692
  samlAdapter: sso.samlAdapter
25103
- }) : new Elysia37).use(sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
25693
+ }) : new Elysia39).use(sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
25104
25694
  getOrganizationByEmailDomain: sso.getOrganizationByEmailDomain,
25105
25695
  ssoConnectionStore: sso.ssoConnectionStore,
25106
25696
  ssoRoute: sso.ssoRoute
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({
25697
+ }) : new Elysia39).use(scim ? scimRoutes(scim) : new Elysia39).use(apikeys ? apiKeysRoutes(apikeys) : new Elysia39).use(oidc ? oidcProviderRoutes({ ...oidc, authSessionStore }) : new Elysia39).use(organizations ? organizationRoutes({
25108
25698
  ...organizations,
25109
25699
  authSessionStore,
25110
25700
  emit: auditEmit
25111
- }) : new Elysia37).use(roles ? roleRoutes({
25701
+ }) : new Elysia39).use(roles ? roleRoutes({
25112
25702
  ...roles,
25113
25703
  authSessionStore,
25114
25704
  emit: auditEmit
25115
- }) : new Elysia37).use(portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia37).use(webauthn ? webauthnRoutes({
25705
+ }) : new Elysia39).use(portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia39).use(webauthn ? webauthnRoutes({
25116
25706
  ...webauthn,
25117
25707
  authSessionStore,
25118
25708
  cookieSecure: resolvedCookieSecure,
25119
25709
  emit: auditEmit
25120
- }) : new Elysia37).use(compliance ? complianceRoutes({
25710
+ }) : new Elysia39).use(compliance ? complianceRoutes({
25121
25711
  ...compliance,
25122
25712
  authSessionStore,
25123
25713
  emit: auditEmit
25124
- }) : new Elysia37).use(protectRoutePlugin({ authSessionStore })).use(stepUpPlugin({ authSessionStore })).use(authorization ? protectPermissionPlugin({
25714
+ }) : new Elysia39).use(protectRoutePlugin({ authSessionStore })).use(stepUpPlugin({ authSessionStore })).use(authorization ? protectPermissionPlugin({
25125
25715
  ...authorization,
25126
25716
  authSessionStore,
25127
25717
  emit: auditEmit
25128
- }) : new Elysia37).use(htmx ? createAuthHtmxRoutes({
25718
+ }) : new Elysia39).use(htmx ? createAuthHtmxRoutes({
25129
25719
  ...htmx,
25130
25720
  authSessionStore
25131
- }) : new Elysia37);
25721
+ }) : new Elysia39);
25132
25722
  };
25133
25723
  export {
25134
25724
  writeWarrant,
@@ -25138,11 +25728,14 @@ export {
25138
25728
  webauthnCredentialsTable,
25139
25729
  warrantsTable,
25140
25730
  warrantKey,
25731
+ vpRoutes,
25141
25732
  verifyWebhookSignature,
25142
25733
  verifyTurnstile,
25143
25734
  verifyTotp,
25735
+ verifyStatusListJwt,
25144
25736
  verifySdJwtVc,
25145
25737
  verifyRecaptcha,
25738
+ verifyPresentationResponse,
25146
25739
  verifyPkce,
25147
25740
  verifyPassword,
25148
25741
  verifyJwtSignedByClient,
@@ -25159,6 +25752,9 @@ export {
25159
25752
  verifyApiKey,
25160
25753
  verifyAccessToken,
25161
25754
  vciRoutes,
25755
+ vcPresentationRequestsTable,
25756
+ vcCredentialOffersTable,
25757
+ vcCredentialNoncesTable,
25162
25758
  vaultEntriesTable,
25163
25759
  validateSession,
25164
25760
  validateEmailDeliverability,
@@ -25170,13 +25766,16 @@ export {
25170
25766
  toBase64Url2 as toBase64Url,
25171
25767
  switchActiveSession,
25172
25768
  stepUpPlugin,
25769
+ statusListRoutes,
25173
25770
  startImpersonation,
25174
25771
  ssoDiscoveryRoute,
25175
25772
  ssoConnectionsTable,
25176
25773
  signWebhook,
25774
+ signStatusList,
25177
25775
  signJwt,
25178
25776
  setupSessionsTable,
25179
25777
  setMemberRoles,
25778
+ setCredentialStatus,
25180
25779
  sessionStore,
25181
25780
  sessionRoutes,
25182
25781
  sessionCleanup,
@@ -25229,6 +25828,7 @@ export {
25229
25828
  parseSignedRequestObject,
25230
25829
  parseSdJwtVc,
25231
25830
  parseSchema,
25831
+ parsePresentationToken,
25232
25832
  organizationsTable,
25233
25833
  organizationRoutes,
25234
25834
  organizationMembershipsTable,
@@ -25298,6 +25898,7 @@ export {
25298
25898
  getStatus,
25299
25899
  getRegisteredClient,
25300
25900
  getOrRefreshFederatedTokens,
25901
+ getCredentialStatus,
25301
25902
  generateTotpSecret,
25302
25903
  generateTotp,
25303
25904
  generateSigningKey,
@@ -25347,6 +25948,7 @@ export {
25347
25948
  createVault,
25348
25949
  createTotpKeyUri,
25349
25950
  createTamperEvidentSink,
25951
+ createStatusList,
25350
25952
  createSiemLogStream,
25351
25953
  createSetupSession,
25352
25954
  createSecretCipher,
@@ -25355,6 +25957,7 @@ export {
25355
25957
  createRedisLockoutStore,
25356
25958
  createRedisFgaCache,
25357
25959
  createRedisAuthSessionStore,
25960
+ createPresentationRequest,
25358
25961
  createPostgresWebhookDeliveryStore,
25359
25962
  createPostgresWebAuthnCredentialStore,
25360
25963
  createPostgresWarrantStore,
@@ -25365,6 +25968,7 @@ export {
25365
25968
  createPostgresSamlServiceProviderStore,
25366
25969
  createPostgresRoleStore,
25367
25970
  createPostgresPushedAuthorizationRequestStore,
25971
+ createPostgresPresentationRequestStore,
25368
25972
  createPostgresPasswordlessTokenStore,
25369
25973
  createPostgresOrganizationStore,
25370
25974
  createPostgresOidcRefreshTokenStore,
@@ -25377,6 +25981,8 @@ export {
25377
25981
  createPostgresInitialAccessTokenStore,
25378
25982
  createPostgresDeviceAuthorizationStore,
25379
25983
  createPostgresCredentialStore,
25984
+ createPostgresCredentialOfferStore,
25985
+ createPostgresCredentialNonceStore,
25380
25986
  createPostgresClientRegistrationTokenStore,
25381
25987
  createPostgresClientAssertionJtiStore,
25382
25988
  createPostgresBackchannelAuthStore,
@@ -25397,6 +26003,7 @@ export {
25397
26003
  createNeonSamlServiceProviderStore,
25398
26004
  createNeonRoleStore,
25399
26005
  createNeonPushedAuthorizationRequestStore,
26006
+ createNeonPresentationRequestStore,
25400
26007
  createNeonPasswordlessTokenStore,
25401
26008
  createNeonOrganizationStore,
25402
26009
  createNeonOidcRefreshTokenStore,
@@ -25412,6 +26019,8 @@ export {
25412
26019
  createNeonDeviceAuthorizationStore,
25413
26020
  createNeonDatabase,
25414
26021
  createNeonCredentialStore,
26022
+ createNeonCredentialOfferStore,
26023
+ createNeonCredentialNonceStore,
25415
26024
  createNeonClientRegistrationTokenStore,
25416
26025
  createNeonClientAssertionJtiStore,
25417
26026
  createNeonBackchannelAuthStore,
@@ -25435,6 +26044,7 @@ export {
25435
26044
  createInMemorySamlServiceProviderStore,
25436
26045
  createInMemoryRoleStore,
25437
26046
  createInMemoryPushedAuthorizationRequestStore,
26047
+ createInMemoryPresentationRequestStore,
25438
26048
  createInMemoryPasswordlessTokenStore,
25439
26049
  createInMemoryOrganizationStore,
25440
26050
  createInMemoryOidcRefreshTokenStore,
@@ -25477,7 +26087,9 @@ export {
25477
26087
  computeCertThumbprint,
25478
26088
  complianceRoutes,
25479
26089
  check,
26090
+ buildStatusClaim,
25480
26091
  buildIssuerMetadata,
26092
+ buildHolderKeyBindingJwt,
25481
26093
  buildClientProviders,
25482
26094
  blockMigrations,
25483
26095
  base32Encode,
@@ -25498,6 +26110,8 @@ export {
25498
26110
  accessTokensTable,
25499
26111
  acceptInvitation,
25500
26112
  WEBAUTHN_CHALLENGE_COOKIE,
26113
+ STATUS_LIST_TYP,
26114
+ STATUS_LIST_SUB_TYP,
25501
26115
  REQUEST_URI_PREFIX,
25502
26116
  PRE_AUTHORIZED_CODE_GRANT,
25503
26117
  DEFAULT_WEBHOOK_TIMEOUT_MS,
@@ -25505,9 +26119,11 @@ export {
25505
26119
  DEFAULT_WEBAUTHN_SESSION_TTL_MS,
25506
26120
  DEFAULT_WEBAUTHN_ROUTE,
25507
26121
  DEFAULT_WEBAUTHN_CHALLENGE_TTL_MS,
26122
+ DEFAULT_VP_ROUTE,
25508
26123
  DEFAULT_VERIFICATION_TOKEN_TTL_MS,
25509
26124
  DEFAULT_VCI_ROUTE,
25510
26125
  DEFAULT_TOKEN_ROUTE,
26126
+ DEFAULT_STATUS_ROUTE,
25511
26127
  DEFAULT_SSO_SESSION_TTL_MS,
25512
26128
  DEFAULT_SSO_ROUTE,
25513
26129
  DEFAULT_SETUP_SESSION_TTL_MS,
@@ -25534,5 +26150,5 @@ export {
25534
26150
  AuthIdentityConflictError
25535
26151
  };
25536
26152
 
25537
- //# debugId=72970D27E7C7DE2F64756E2164756E21
26153
+ //# debugId=447AA182107369F564756E2164756E21
25538
26154
  //# sourceMappingURL=index.js.map