@absolutejs/auth 0.40.0-beta.1 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -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,
@@ -22808,6 +22845,130 @@ var passthroughStore = (request) => ({
22808
22845
  getRequest: async () => request,
22809
22846
  saveRequest: async () => {}
22810
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
+ });
22811
22972
  // src/scim/inMemoryScimTokenStore.ts
22812
22973
  var createInMemoryScimTokenStore = () => {
22813
22974
  const tokens = new Map;
@@ -22823,15 +22984,15 @@ var createInMemoryScimTokenStore = () => {
22823
22984
  };
22824
22985
  };
22825
22986
  // src/scim/postgresScimTokenStore.ts
22826
- var ID_LENGTH5 = 255;
22987
+ var ID_LENGTH6 = 255;
22827
22988
  var scimTokensTable = pgTable("auth_scim_tokens", {
22828
22989
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22829
- hashed_token: varchar("hashed_token", { length: ID_LENGTH5 }).notNull(),
22990
+ hashed_token: varchar("hashed_token", { length: ID_LENGTH6 }).notNull(),
22830
22991
  last_used_at_ms: bigint("last_used_at_ms", { mode: "number" }),
22831
22992
  organization_id: varchar("organization_id", {
22832
- length: ID_LENGTH5
22993
+ length: ID_LENGTH6
22833
22994
  }).notNull(),
22834
- token_id: varchar("token_id", { length: ID_LENGTH5 }).primaryKey()
22995
+ token_id: varchar("token_id", { length: ID_LENGTH6 }).primaryKey()
22835
22996
  });
22836
22997
  var toToken2 = (row) => ({
22837
22998
  createdAt: row.created_at_ms,
@@ -22920,33 +23081,33 @@ var createInMemoryApiKeyStore = () => {
22920
23081
  };
22921
23082
  };
22922
23083
  // src/apikeys/postgresStores.ts
22923
- var ID_LENGTH6 = 255;
23084
+ var ID_LENGTH7 = 255;
22924
23085
  var accessTokensTable = pgTable("auth_access_tokens", {
22925
- client_id: varchar("client_id", { length: ID_LENGTH6 }).notNull(),
23086
+ client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
22926
23087
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22927
23088
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
22928
- hashed_token: varchar("hashed_token", { length: ID_LENGTH6 }).notNull(),
22929
- 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 }),
22930
23091
  scopes: text("scopes").array().notNull(),
22931
- token_id: varchar("token_id", { length: ID_LENGTH6 }).primaryKey()
23092
+ token_id: varchar("token_id", { length: ID_LENGTH7 }).primaryKey()
22932
23093
  });
22933
23094
  var apiClientsTable = pgTable("auth_api_clients", {
22934
- client_id: varchar("client_id", { length: ID_LENGTH6 }).primaryKey(),
23095
+ client_id: varchar("client_id", { length: ID_LENGTH7 }).primaryKey(),
22935
23096
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22936
- hashed_secret: varchar("hashed_secret", { length: ID_LENGTH6 }).notNull(),
22937
- name: varchar("name", { length: ID_LENGTH6 }).notNull(),
22938
- 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 }),
22939
23100
  scopes: text("scopes").array().notNull()
22940
23101
  });
22941
23102
  var apiKeysTable = pgTable("auth_api_keys", {
22942
23103
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
22943
23104
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }),
22944
- hashed_key: varchar("hashed_key", { length: ID_LENGTH6 }).notNull(),
22945
- 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(),
22946
23107
  last_used_at_ms: bigint("last_used_at_ms", { mode: "number" }),
22947
- name: varchar("name", { length: ID_LENGTH6 }).notNull(),
22948
- owner_id: varchar("owner_id", { length: ID_LENGTH6 }),
22949
- 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(),
22950
23111
  scopes: text("scopes").array().notNull()
22951
23112
  });
22952
23113
  var toKey = (row) => ({
@@ -23255,11 +23416,11 @@ var createInMemoryPushedAuthorizationRequestStore = () => {
23255
23416
  // src/oidc/postgresStores.ts
23256
23417
  var URL_LENGTH = 2048;
23257
23418
  var DEFAULT_LIST_LIMIT2 = 100;
23258
- var ID_LENGTH7 = 255;
23419
+ var ID_LENGTH8 = 255;
23259
23420
  var oauthBackchannelAuthRequestsTable = pgTable("auth_oauth_backchannel_auth_requests", {
23260
- auth_req_id: varchar("auth_req_id", { length: ID_LENGTH7 }).primaryKey(),
23421
+ auth_req_id: varchar("auth_req_id", { length: ID_LENGTH8 }).primaryKey(),
23261
23422
  binding_message: text("binding_message"),
23262
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23423
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
23263
23424
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
23264
23425
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
23265
23426
  interval_seconds: bigint("interval_seconds", {
@@ -23268,30 +23429,30 @@ var oauthBackchannelAuthRequestsTable = pgTable("auth_oauth_backchannel_auth_req
23268
23429
  last_polled_at_ms: bigint("last_polled_at_ms", { mode: "number" }),
23269
23430
  scopes: text("scopes").array().notNull(),
23270
23431
  status: varchar("status", { length: 16 }).notNull(),
23271
- user_sub: varchar("user_sub", { length: ID_LENGTH7 })
23432
+ user_sub: varchar("user_sub", { length: ID_LENGTH8 })
23272
23433
  });
23273
23434
  var oauthClientAssertionJtisTable = pgTable("auth_oauth_client_assertion_jtis", {
23274
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23435
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
23275
23436
  composite_key: varchar("composite_key", {
23276
- length: ID_LENGTH7
23437
+ length: ID_LENGTH8
23277
23438
  }).primaryKey(),
23278
23439
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
23279
- jti: varchar("jti", { length: ID_LENGTH7 }).notNull()
23440
+ jti: varchar("jti", { length: ID_LENGTH8 }).notNull()
23280
23441
  });
23281
23442
  var oauthClientRegistrationTokensTable = pgTable("auth_oauth_client_registration_tokens", {
23282
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23443
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
23283
23444
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
23284
- token_hash: varchar("token_hash", { length: ID_LENGTH7 }).primaryKey()
23445
+ token_hash: varchar("token_hash", { length: ID_LENGTH8 }).primaryKey()
23285
23446
  });
23286
23447
  var oauthClientsTable = pgTable("auth_oauth_clients", {
23287
23448
  backchannel_logout_uri: varchar("backchannel_logout_uri", {
23288
23449
  length: URL_LENGTH
23289
23450
  }),
23290
- client_id: varchar("client_id", { length: ID_LENGTH7 }).primaryKey(),
23291
- 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 }),
23292
23453
  jwks_json: jsonb("jwks_json").$type(),
23293
23454
  jwks_uri: varchar("jwks_uri", { length: URL_LENGTH }),
23294
- name: varchar("name", { length: ID_LENGTH7 }).notNull(),
23455
+ name: varchar("name", { length: ID_LENGTH8 }).notNull(),
23295
23456
  post_logout_redirect_uris: text("post_logout_redirect_uris").array(),
23296
23457
  redirect_uris: text("redirect_uris").array().notNull(),
23297
23458
  require_pushed_authorization_requests: boolean("require_pushed_authorization_requests"),
@@ -23299,65 +23460,65 @@ var oauthClientsTable = pgTable("auth_oauth_clients", {
23299
23460
  scopes: text("scopes").array().notNull()
23300
23461
  });
23301
23462
  var oauthCodesTable = pgTable("auth_oauth_codes", {
23302
- acr: varchar("acr", { length: ID_LENGTH7 }),
23463
+ acr: varchar("acr", { length: ID_LENGTH8 }),
23303
23464
  claims_json: jsonb("claims_json").$type(),
23304
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23305
- code_challenge: varchar("code_challenge", { length: ID_LENGTH7 }).notNull(),
23306
- 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(),
23307
23468
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
23308
- dpop_jkt: varchar("dpop_jkt", { length: ID_LENGTH7 }),
23469
+ dpop_jkt: varchar("dpop_jkt", { length: ID_LENGTH8 }),
23309
23470
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
23310
- nonce: varchar("nonce", { length: ID_LENGTH7 }),
23311
- 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(),
23312
23473
  scopes: text("scopes").array().notNull(),
23313
- user_id: varchar("user_id", { length: ID_LENGTH7 }).notNull()
23474
+ user_id: varchar("user_id", { length: ID_LENGTH8 }).notNull()
23314
23475
  });
23315
23476
  var oauthDeviceAuthorizationsTable = pgTable("auth_oauth_device_authorizations", {
23316
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23477
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
23317
23478
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
23318
23479
  device_code_hash: varchar("device_code_hash", {
23319
- length: ID_LENGTH7
23480
+ length: ID_LENGTH8
23320
23481
  }).primaryKey(),
23321
23482
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
23322
23483
  interval_seconds: bigint("interval_seconds", { mode: "number" }).notNull(),
23323
23484
  scopes: text("scopes").array().notNull(),
23324
23485
  status: varchar("status", { length: 16 }).notNull(),
23325
23486
  user_code: varchar("user_code", { length: 16 }).notNull().unique(),
23326
- user_sub: varchar("user_sub", { length: ID_LENGTH7 })
23487
+ user_sub: varchar("user_sub", { length: ID_LENGTH8 })
23327
23488
  });
23328
23489
  var oauthInitialAccessTokensTable = pgTable("auth_oauth_initial_access_tokens", {
23329
- token_hash: varchar("token_hash", { length: ID_LENGTH7 }).primaryKey()
23490
+ token_hash: varchar("token_hash", { length: ID_LENGTH8 }).primaryKey()
23330
23491
  });
23331
23492
  var oauthLogoutDeliveriesTable = pgTable("auth_oauth_logout_deliveries", {
23332
23493
  attempts: bigint("attempts", { mode: "number" }).notNull(),
23333
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23494
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
23334
23495
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
23335
23496
  endpoint_url: varchar("endpoint_url", { length: URL_LENGTH }).notNull(),
23336
- id: varchar("id", { length: ID_LENGTH7 }).primaryKey(),
23497
+ id: varchar("id", { length: ID_LENGTH8 }).primaryKey(),
23337
23498
  last_error: text("last_error"),
23338
23499
  last_status: bigint("last_status", { mode: "number" }),
23339
23500
  logout_token: text("logout_token").notNull(),
23340
- user_id: varchar("user_id", { length: ID_LENGTH7 }).notNull()
23501
+ user_id: varchar("user_id", { length: ID_LENGTH8 }).notNull()
23341
23502
  });
23342
23503
  var oauthPushedAuthorizationRequestsTable = pgTable("auth_oauth_pushed_authorization_requests", {
23343
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23504
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
23344
23505
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
23345
23506
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
23346
23507
  params_json: jsonb("params_json").$type().notNull(),
23347
23508
  request_uri_hash: varchar("request_uri_hash", {
23348
- length: ID_LENGTH7
23509
+ length: ID_LENGTH8
23349
23510
  }).primaryKey()
23350
23511
  });
23351
23512
  var oauthRefreshTokensTable = pgTable("auth_oauth_refresh_tokens", {
23352
- acr: varchar("acr", { length: ID_LENGTH7 }),
23513
+ acr: varchar("acr", { length: ID_LENGTH8 }),
23353
23514
  claims_json: jsonb("claims_json").$type(),
23354
- client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
23515
+ client_id: varchar("client_id", { length: ID_LENGTH8 }).notNull(),
23355
23516
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
23356
- dpop_jkt: varchar("dpop_jkt", { length: ID_LENGTH7 }),
23517
+ dpop_jkt: varchar("dpop_jkt", { length: ID_LENGTH8 }),
23357
23518
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
23358
23519
  scopes: text("scopes").array().notNull(),
23359
- token_hash: varchar("token_hash", { length: ID_LENGTH7 }).primaryKey(),
23360
- 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()
23361
23522
  });
23362
23523
  var toClient2 = (row) => ({
23363
23524
  backchannelLogoutUri: row.backchannel_logout_uri ?? undefined,
@@ -23880,29 +24041,29 @@ var createInMemoryLoginHistoryStore = () => {
23880
24041
  };
23881
24042
  };
23882
24043
  // src/adaptive/postgresStores.ts
23883
- var ID_LENGTH8 = 255;
24044
+ var ID_LENGTH9 = 255;
23884
24045
  var knownDevicesTable = pgTable("auth_known_devices", {
23885
- device_id: varchar("device_id", { length: ID_LENGTH8 }).notNull(),
24046
+ device_id: varchar("device_id", { length: ID_LENGTH9 }).notNull(),
23886
24047
  first_seen_at_ms: bigint("first_seen_at_ms", {
23887
24048
  mode: "number"
23888
24049
  }).notNull(),
23889
- label: varchar("label", { length: ID_LENGTH8 }),
24050
+ label: varchar("label", { length: ID_LENGTH9 }),
23890
24051
  last_seen_at_ms: bigint("last_seen_at_ms", {
23891
24052
  mode: "number"
23892
24053
  }).notNull(),
23893
24054
  trusted: boolean("trusted").notNull().default(false),
23894
- user_id: varchar("user_id", { length: ID_LENGTH8 }).notNull()
24055
+ user_id: varchar("user_id", { length: ID_LENGTH9 }).notNull()
23895
24056
  }, (table) => [primaryKey({ columns: [table.user_id, table.device_id] })]);
23896
24057
  var loginHistoryTable = pgTable("auth_login_history", {
23897
- attempt_id: varchar("attempt_id", { length: ID_LENGTH8 }).primaryKey(),
23898
- country: varchar("country", { length: ID_LENGTH8 }),
23899
- device_id: varchar("device_id", { length: ID_LENGTH8 }).notNull(),
23900
- 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 }),
23901
24062
  latitude: doublePrecision("latitude"),
23902
24063
  longitude: doublePrecision("longitude"),
23903
- outcome: varchar("outcome", { length: ID_LENGTH8 }).notNull(),
24064
+ outcome: varchar("outcome", { length: ID_LENGTH9 }).notNull(),
23904
24065
  timestamp_ms: bigint("timestamp_ms", { mode: "number" }).notNull(),
23905
- user_id: varchar("user_id", { length: ID_LENGTH8 }).notNull()
24066
+ user_id: varchar("user_id", { length: ID_LENGTH9 }).notNull()
23906
24067
  });
23907
24068
  var toRiskAction = (value) => {
23908
24069
  if (value === "deny")
@@ -24226,15 +24387,15 @@ var createRedisFgaCache = (redis, { keyPrefix = DEFAULT_PREFIX2, ttlMs = DEFAULT
24226
24387
  }
24227
24388
  });
24228
24389
  // src/fga/postgresStores.ts
24229
- var ID_LENGTH9 = 255;
24390
+ var ID_LENGTH10 = 255;
24230
24391
  var warrantsTable = pgTable("auth_fga_warrants", {
24231
- id: varchar("id", { length: ID_LENGTH9 }).primaryKey(),
24232
- relation: varchar("relation", { length: ID_LENGTH9 }).notNull(),
24233
- resource_id: varchar("resource_id", { length: ID_LENGTH9 }).notNull(),
24234
- resource_type: varchar("resource_type", { length: ID_LENGTH9 }).notNull(),
24235
- subject_id: varchar("subject_id", { length: ID_LENGTH9 }).notNull(),
24236
- subject_relation: varchar("subject_relation", { length: ID_LENGTH9 }),
24237
- 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()
24238
24399
  });
24239
24400
  var toWarrant = (row) => ({
24240
24401
  relation: row.relation,
@@ -24271,41 +24432,41 @@ var createPostgresWarrantStore = (db) => ({
24271
24432
  });
24272
24433
 
24273
24434
  // src/organizations/postgresOrganizationStore.ts
24274
- var ID_LENGTH10 = 255;
24435
+ var ID_LENGTH11 = 255;
24275
24436
  var NAME_LENGTH = 255;
24276
24437
  var STATE_LENGTH = 16;
24277
24438
  var organizationInvitationsTable = pgTable("auth_organization_invitations", {
24278
24439
  accepted_at_ms: bigint("accepted_at_ms", { mode: "number" }),
24279
24440
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24280
- email: varchar("email", { length: ID_LENGTH10 }).notNull(),
24441
+ email: varchar("email", { length: ID_LENGTH11 }).notNull(),
24281
24442
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
24282
24443
  invitation_id: varchar("invitation_id", {
24283
- length: ID_LENGTH10
24444
+ length: ID_LENGTH11
24284
24445
  }).primaryKey(),
24285
- inviter_user_id: varchar("inviter_user_id", { length: ID_LENGTH10 }),
24446
+ inviter_user_id: varchar("inviter_user_id", { length: ID_LENGTH11 }),
24286
24447
  organization_id: varchar("organization_id", {
24287
- length: ID_LENGTH10
24448
+ length: ID_LENGTH11
24288
24449
  }).notNull(),
24289
24450
  roles: jsonb("roles").$type().notNull().default([]),
24290
24451
  state: varchar("state", { length: STATE_LENGTH }).$type().notNull().default("pending"),
24291
- token_hash: varchar("token_hash", { length: ID_LENGTH10 }).notNull().unique()
24452
+ token_hash: varchar("token_hash", { length: ID_LENGTH11 }).notNull().unique()
24292
24453
  });
24293
24454
  var organizationMembershipsTable = pgTable("auth_organization_memberships", {
24294
24455
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24295
24456
  organization_id: varchar("organization_id", {
24296
- length: ID_LENGTH10
24457
+ length: ID_LENGTH11
24297
24458
  }).notNull(),
24298
24459
  roles: jsonb("roles").$type().notNull().default([]),
24299
24460
  status: varchar("status", { length: STATE_LENGTH }).$type().notNull().default("active"),
24300
24461
  updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull(),
24301
- user_id: varchar("user_id", { length: ID_LENGTH10 }).notNull()
24462
+ user_id: varchar("user_id", { length: ID_LENGTH11 }).notNull()
24302
24463
  }, (table) => [primaryKey({ columns: [table.organization_id, table.user_id] })]);
24303
24464
  var organizationsTable = pgTable("auth_organizations", {
24304
24465
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24305
24466
  metadata: jsonb("metadata").$type(),
24306
24467
  name: varchar("name", { length: NAME_LENGTH }).notNull(),
24307
24468
  organization_id: varchar("organization_id", {
24308
- length: ID_LENGTH10
24469
+ length: ID_LENGTH11
24309
24470
  }).primaryKey(),
24310
24471
  updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull()
24311
24472
  });
@@ -24423,11 +24584,11 @@ var createPostgresOrganizationStore = (db) => ({
24423
24584
  });
24424
24585
 
24425
24586
  // src/passwordless/postgresPasswordlessTokenStore.ts
24426
- var ID_LENGTH11 = 255;
24587
+ var ID_LENGTH12 = 255;
24427
24588
  var passwordlessTokensTable = pgTable("auth_passwordless_tokens", {
24428
- email: varchar("email", { length: ID_LENGTH11 }).notNull(),
24589
+ email: varchar("email", { length: ID_LENGTH12 }).notNull(),
24429
24590
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
24430
- token_hash: varchar("token_hash", { length: ID_LENGTH11 }).primaryKey()
24591
+ token_hash: varchar("token_hash", { length: ID_LENGTH12 }).primaryKey()
24431
24592
  });
24432
24593
  var toToken3 = (row) => ({
24433
24594
  email: row.email,
@@ -24454,19 +24615,19 @@ var createPostgresPasswordlessTokenStore = (db) => ({
24454
24615
  });
24455
24616
 
24456
24617
  // src/portal/postgresSetupSessionStore.ts
24457
- var ID_LENGTH12 = 255;
24618
+ var ID_LENGTH13 = 255;
24458
24619
  var setupSessionsTable = pgTable("auth_setup_sessions", {
24459
24620
  capabilities: jsonb("capabilities").$type().notNull().default([]),
24460
24621
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24461
- created_by: varchar("created_by", { length: ID_LENGTH12 }),
24622
+ created_by: varchar("created_by", { length: ID_LENGTH13 }),
24462
24623
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
24463
24624
  organization_id: varchar("organization_id", {
24464
- length: ID_LENGTH12
24625
+ length: ID_LENGTH13
24465
24626
  }).notNull(),
24466
24627
  setup_session_id: varchar("setup_session_id", {
24467
- length: ID_LENGTH12
24628
+ length: ID_LENGTH13
24468
24629
  }).primaryKey(),
24469
- token_hash: varchar("token_hash", { length: ID_LENGTH12 }).notNull().unique()
24630
+ token_hash: varchar("token_hash", { length: ID_LENGTH13 }).notNull().unique()
24470
24631
  });
24471
24632
  var toSession = (row) => ({
24472
24633
  capabilities: row.capabilities,
@@ -24504,12 +24665,12 @@ var createPostgresSetupSessionStore = (db) => ({
24504
24665
  });
24505
24666
 
24506
24667
  // src/roles/postgresRoleStore.ts
24507
- var ID_LENGTH13 = 255;
24668
+ var ID_LENGTH14 = 255;
24508
24669
  var SLUG_LENGTH = 128;
24509
24670
  var GLOBAL_SCOPE = "";
24510
24671
  var rolesTable = pgTable("auth_roles", {
24511
24672
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24512
- 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),
24513
24674
  permissions: jsonb("permissions").$type().notNull().default([]),
24514
24675
  slug: varchar("slug", { length: SLUG_LENGTH }).notNull(),
24515
24676
  updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull()
@@ -24550,13 +24711,13 @@ var createPostgresRoleStore = (db) => ({
24550
24711
  });
24551
24712
 
24552
24713
  // src/sso/postgresSamlServiceProviderStore.ts
24553
- var ID_LENGTH14 = 255;
24714
+ var ID_LENGTH15 = 255;
24554
24715
  var URL_LENGTH2 = 2048;
24555
24716
  var samlServiceProvidersTable = pgTable("auth_saml_service_providers", {
24556
24717
  acs_url: varchar("acs_url", { length: URL_LENGTH2 }).notNull(),
24557
24718
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24558
24719
  entity_id: varchar("entity_id", { length: URL_LENGTH2 }).primaryKey(),
24559
- name_id_format: varchar("name_id_format", { length: ID_LENGTH14 }),
24720
+ name_id_format: varchar("name_id_format", { length: ID_LENGTH15 }),
24560
24721
  signing_cert: text("signing_cert"),
24561
24722
  updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull()
24562
24723
  });
@@ -24598,15 +24759,15 @@ var createPostgresSamlServiceProviderStore = (db) => ({
24598
24759
  });
24599
24760
 
24600
24761
  // src/sso/postgresSsoConnectionStore.ts
24601
- var ID_LENGTH15 = 255;
24762
+ var ID_LENGTH16 = 255;
24602
24763
  var TYPE_LENGTH2 = 16;
24603
24764
  var ssoConnectionsTable = pgTable("auth_sso_connections", {
24604
24765
  config: jsonb("config").$type().notNull(),
24605
- connection_id: varchar("connection_id", { length: ID_LENGTH15 }).primaryKey(),
24766
+ connection_id: varchar("connection_id", { length: ID_LENGTH16 }).primaryKey(),
24606
24767
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24607
24768
  enabled: boolean("enabled").notNull().default(true),
24608
24769
  organization_id: varchar("organization_id", {
24609
- length: ID_LENGTH15
24770
+ length: ID_LENGTH16
24610
24771
  }).notNull(),
24611
24772
  type: varchar("type", { length: TYPE_LENGTH2 }).$type().notNull(),
24612
24773
  updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull()
@@ -24712,18 +24873,18 @@ var createPostgresSsoConnectionStore = (db) => ({
24712
24873
  });
24713
24874
 
24714
24875
  // src/webauthn/postgresWebAuthnCredentialStore.ts
24715
- var ID_LENGTH16 = 255;
24876
+ var ID_LENGTH17 = 255;
24716
24877
  var DEVICE_TYPE_LENGTH = 32;
24717
24878
  var webauthnCredentialsTable = pgTable("auth_webauthn_credentials", {
24718
24879
  backed_up: boolean("backed_up"),
24719
24880
  counter: bigint("counter", { mode: "number" }).notNull().default(0),
24720
24881
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24721
- credential_id: varchar("credential_id", { length: ID_LENGTH16 }).primaryKey(),
24882
+ credential_id: varchar("credential_id", { length: ID_LENGTH17 }).primaryKey(),
24722
24883
  device_type: varchar("device_type", { length: DEVICE_TYPE_LENGTH }),
24723
24884
  last_used_at_ms: bigint("last_used_at_ms", { mode: "number" }),
24724
24885
  public_key: text("public_key").notNull(),
24725
24886
  transports: jsonb("transports").$type(),
24726
- user_id: varchar("user_id", { length: ID_LENGTH16 }).notNull()
24887
+ user_id: varchar("user_id", { length: ID_LENGTH17 }).notNull()
24727
24888
  });
24728
24889
  var toCredential = (row) => ({
24729
24890
  backedUp: row.backed_up ?? undefined,
@@ -24770,14 +24931,14 @@ var createPostgresWebAuthnCredentialStore = (db) => ({
24770
24931
  });
24771
24932
 
24772
24933
  // src/webhooks/postgresStore.ts
24773
- var ID_LENGTH17 = 255;
24934
+ var ID_LENGTH18 = 255;
24774
24935
  var URL_LENGTH3 = 2048;
24775
24936
  var DEFAULT_LIST_LIMIT3 = 100;
24776
24937
  var webhookDeliveriesTable = pgTable("auth_webhook_deliveries", {
24777
24938
  attempts: bigint("attempts", { mode: "number" }).notNull(),
24778
24939
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
24779
24940
  endpoint_url: varchar("endpoint_url", { length: URL_LENGTH3 }).notNull(),
24780
- envelope_id: varchar("envelope_id", { length: ID_LENGTH17 }).primaryKey(),
24941
+ envelope_id: varchar("envelope_id", { length: ID_LENGTH18 }).primaryKey(),
24781
24942
  envelope_json: jsonb("envelope_json").$type().notNull(),
24782
24943
  last_error: text("last_error"),
24783
24944
  last_status: bigint("last_status", { mode: "number" })
@@ -24967,6 +25128,11 @@ var blockMigrations = {
24967
25128
  ]),
24968
25129
  sso: initMigration("sso", [ssoConnectionsTable, samlServiceProvidersTable]),
24969
25130
  vault: initMigration("vault", [vaultEntriesTable]),
25131
+ vc: initMigration("vc", [
25132
+ vcCredentialOffersTable,
25133
+ vcCredentialNoncesTable,
25134
+ vcPresentationRequestsTable
25135
+ ]),
24970
25136
  webauthn: initMigration("webauthn", [webauthnCredentialsTable]),
24971
25137
  webhooks: initMigration("webhooks", [webhookDeliveriesTable])
24972
25138
  };
@@ -25586,6 +25752,9 @@ export {
25586
25752
  verifyApiKey,
25587
25753
  verifyAccessToken,
25588
25754
  vciRoutes,
25755
+ vcPresentationRequestsTable,
25756
+ vcCredentialOffersTable,
25757
+ vcCredentialNoncesTable,
25589
25758
  vaultEntriesTable,
25590
25759
  validateSession,
25591
25760
  validateEmailDeliverability,
@@ -25799,6 +25968,7 @@ export {
25799
25968
  createPostgresSamlServiceProviderStore,
25800
25969
  createPostgresRoleStore,
25801
25970
  createPostgresPushedAuthorizationRequestStore,
25971
+ createPostgresPresentationRequestStore,
25802
25972
  createPostgresPasswordlessTokenStore,
25803
25973
  createPostgresOrganizationStore,
25804
25974
  createPostgresOidcRefreshTokenStore,
@@ -25811,6 +25981,8 @@ export {
25811
25981
  createPostgresInitialAccessTokenStore,
25812
25982
  createPostgresDeviceAuthorizationStore,
25813
25983
  createPostgresCredentialStore,
25984
+ createPostgresCredentialOfferStore,
25985
+ createPostgresCredentialNonceStore,
25814
25986
  createPostgresClientRegistrationTokenStore,
25815
25987
  createPostgresClientAssertionJtiStore,
25816
25988
  createPostgresBackchannelAuthStore,
@@ -25831,6 +26003,7 @@ export {
25831
26003
  createNeonSamlServiceProviderStore,
25832
26004
  createNeonRoleStore,
25833
26005
  createNeonPushedAuthorizationRequestStore,
26006
+ createNeonPresentationRequestStore,
25834
26007
  createNeonPasswordlessTokenStore,
25835
26008
  createNeonOrganizationStore,
25836
26009
  createNeonOidcRefreshTokenStore,
@@ -25846,6 +26019,8 @@ export {
25846
26019
  createNeonDeviceAuthorizationStore,
25847
26020
  createNeonDatabase,
25848
26021
  createNeonCredentialStore,
26022
+ createNeonCredentialOfferStore,
26023
+ createNeonCredentialNonceStore,
25849
26024
  createNeonClientRegistrationTokenStore,
25850
26025
  createNeonClientAssertionJtiStore,
25851
26026
  createNeonBackchannelAuthStore,
@@ -25975,5 +26150,5 @@ export {
25975
26150
  AuthIdentityConflictError
25976
26151
  };
25977
26152
 
25978
- //# debugId=6D61B26FBEAED15664756E2164756E21
26153
+ //# debugId=447AA182107369F564756E2164756E21
25979
26154
  //# sourceMappingURL=index.js.map