@absolutejs/auth 0.29.0-beta.2 → 0.29.0-beta.3

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
@@ -4727,11 +4727,218 @@ var fanOutBackchannelLogout = async ({
4727
4727
  return reachable.map(({ client }) => client.clientId);
4728
4728
  };
4729
4729
 
4730
+ // src/oidc/registration.ts
4731
+ var REG_TOKEN_BYTES = 32;
4732
+ var CLIENT_ID_BYTES = 16;
4733
+ var mintRegistrationToken = async (clientId) => {
4734
+ const plain = generateSecureToken(REG_TOKEN_BYTES);
4735
+ return {
4736
+ plain,
4737
+ record: {
4738
+ clientId,
4739
+ createdAt: Date.now(),
4740
+ tokenHash: await hashToken(plain)
4741
+ }
4742
+ };
4743
+ };
4744
+ var metadataToClient = (clientId, metadata, transform) => {
4745
+ const requestedScopes = metadata.scope === undefined || metadata.scope.length === 0 ? [] : metadata.scope.split(" ").filter((entry) => entry.length > 0);
4746
+ const base = {
4747
+ backchannelLogoutUri: metadata.backchannel_logout_uri,
4748
+ clientId,
4749
+ jwks: metadata.jwks,
4750
+ jwksUri: metadata.jwks_uri,
4751
+ name: metadata.client_name ?? clientId,
4752
+ postLogoutRedirectUris: metadata.post_logout_redirect_uris,
4753
+ redirectUris: metadata.redirect_uris ?? [],
4754
+ scopes: requestedScopes
4755
+ };
4756
+ return { ...base, ...transform, clientId };
4757
+ };
4758
+ var clientToMetadata = (client) => ({
4759
+ backchannel_logout_uri: client.backchannelLogoutUri,
4760
+ client_id: client.clientId,
4761
+ client_name: client.name,
4762
+ jwks: client.jwks,
4763
+ jwks_uri: client.jwksUri,
4764
+ post_logout_redirect_uris: client.postLogoutRedirectUris,
4765
+ redirect_uris: client.redirectUris,
4766
+ scope: client.scopes.join(" ")
4767
+ });
4768
+ var readRegistrationAccessToken = (authorization) => {
4769
+ const prefix = "Bearer ";
4770
+ if (authorization === undefined || !authorization.startsWith(prefix)) {
4771
+ return;
4772
+ }
4773
+ return authorization.slice(prefix.length).trim();
4774
+ };
4775
+ var authorizeManagement = async ({
4776
+ authorization,
4777
+ clientId,
4778
+ registrationTokenStore
4779
+ }) => {
4780
+ const presented = readRegistrationAccessToken(authorization);
4781
+ if (presented === undefined)
4782
+ return false;
4783
+ const record = await registrationTokenStore.findByTokenHash(await hashToken(presented));
4784
+ return record?.clientId === clientId;
4785
+ };
4786
+ var deleteRegisteredClient = async ({
4787
+ authorization,
4788
+ clientId,
4789
+ clientStore,
4790
+ registrationTokenStore
4791
+ }) => {
4792
+ if (clientStore.deleteClient === undefined) {
4793
+ return {
4794
+ body: { error: "unsupported_response_type" },
4795
+ status: 501
4796
+ };
4797
+ }
4798
+ const authed = await authorizeManagement({
4799
+ authorization,
4800
+ clientId,
4801
+ registrationTokenStore
4802
+ });
4803
+ if (!authed)
4804
+ return { body: { error: "invalid_token" }, status: 401 };
4805
+ await clientStore.deleteClient(clientId);
4806
+ await registrationTokenStore.deleteByClientId(clientId);
4807
+ return { status: 204 };
4808
+ };
4809
+ var getRegisteredClient = async ({
4810
+ authorization,
4811
+ clientId,
4812
+ clientStore,
4813
+ registrationTokenStore
4814
+ }) => {
4815
+ const authed = await authorizeManagement({
4816
+ authorization,
4817
+ clientId,
4818
+ registrationTokenStore
4819
+ });
4820
+ if (!authed)
4821
+ return { body: { error: "invalid_token" }, status: 401 };
4822
+ const client = await clientStore.findClient(clientId);
4823
+ if (client === undefined) {
4824
+ return { body: { error: "invalid_client" }, status: 404 };
4825
+ }
4826
+ return { body: clientToMetadata(client), status: 200 };
4827
+ };
4828
+ var registerClient = async ({
4829
+ clientStore,
4830
+ initialAccessTokenStore,
4831
+ metadata,
4832
+ onClientRegistration,
4833
+ presentedInitialAccessToken,
4834
+ registrationBaseUrl,
4835
+ registrationTokenStore
4836
+ }) => {
4837
+ if (clientStore.saveClient === undefined || clientStore.findClient === undefined) {
4838
+ return {
4839
+ body: { error: "unsupported_response_type" },
4840
+ ok: false,
4841
+ status: 501
4842
+ };
4843
+ }
4844
+ if (initialAccessTokenStore !== undefined) {
4845
+ if (presentedInitialAccessToken === undefined) {
4846
+ return { body: { error: "invalid_token" }, ok: false, status: 401 };
4847
+ }
4848
+ const consumed = await initialAccessTokenStore.consumeToken(await hashToken(presentedInitialAccessToken));
4849
+ if (!consumed) {
4850
+ return { body: { error: "invalid_token" }, ok: false, status: 401 };
4851
+ }
4852
+ }
4853
+ if (!Array.isArray(metadata.redirect_uris) || metadata.redirect_uris.length === 0) {
4854
+ return {
4855
+ body: { error: "invalid_redirect_uri" },
4856
+ ok: false,
4857
+ status: 400
4858
+ };
4859
+ }
4860
+ const decision = await onClientRegistration?.({ metadata }) ?? { allow: true };
4861
+ if (!decision.allow) {
4862
+ return {
4863
+ body: {
4864
+ error: "invalid_client_metadata",
4865
+ error_description: decision.denyReason
4866
+ },
4867
+ ok: false,
4868
+ status: 403
4869
+ };
4870
+ }
4871
+ const clientId = generateSecureToken(CLIENT_ID_BYTES);
4872
+ const client = metadataToClient(clientId, metadata, decision.transform);
4873
+ await clientStore.saveClient(client);
4874
+ const regToken = await mintRegistrationToken(clientId);
4875
+ await registrationTokenStore.saveToken(regToken.record);
4876
+ return {
4877
+ body: {
4878
+ ...clientToMetadata(client),
4879
+ registration_access_token: regToken.plain,
4880
+ registration_client_uri: `${registrationBaseUrl}/${clientId}`
4881
+ },
4882
+ ok: true
4883
+ };
4884
+ };
4885
+ var updateRegisteredClient = async ({
4886
+ authorization,
4887
+ clientId,
4888
+ clientStore,
4889
+ metadata,
4890
+ onClientRegistration,
4891
+ registrationTokenStore
4892
+ }) => {
4893
+ if (clientStore.updateClient === undefined) {
4894
+ return {
4895
+ body: { error: "unsupported_response_type" },
4896
+ status: 501
4897
+ };
4898
+ }
4899
+ const authed = await authorizeManagement({
4900
+ authorization,
4901
+ clientId,
4902
+ registrationTokenStore
4903
+ });
4904
+ if (!authed)
4905
+ return { body: { error: "invalid_token" }, status: 401 };
4906
+ const decision = await onClientRegistration?.({ metadata }) ?? { allow: true };
4907
+ if (!decision.allow) {
4908
+ return {
4909
+ body: {
4910
+ error: "invalid_client_metadata",
4911
+ error_description: decision.denyReason
4912
+ },
4913
+ status: 403
4914
+ };
4915
+ }
4916
+ if (!Array.isArray(metadata.redirect_uris) || metadata.redirect_uris.length === 0) {
4917
+ return {
4918
+ body: { error: "invalid_redirect_uri" },
4919
+ status: 400
4920
+ };
4921
+ }
4922
+ const updated = metadataToClient(clientId, metadata, decision.transform);
4923
+ await clientStore.updateClient(clientId, updated);
4924
+ const rotated = await mintRegistrationToken(clientId);
4925
+ await registrationTokenStore.saveToken(rotated.record);
4926
+ return {
4927
+ body: {
4928
+ ...clientToMetadata(updated),
4929
+ registration_access_token: rotated.plain
4930
+ },
4931
+ status: 200
4932
+ };
4933
+ };
4934
+
4730
4935
  // src/oidc/routes.ts
4731
4936
  var HTTP_OK2 = 200;
4937
+ var HTTP_NO_CONTENT = 204;
4938
+ var HTTP_FOUND = 302;
4732
4939
  var HTTP_BAD_REQUEST2 = 400;
4733
4940
  var HTTP_UNAUTHORIZED2 = 401;
4734
- var HTTP_FOUND = 302;
4941
+ var HTTP_NOT_IMPLEMENTED = 501;
4735
4942
  var CODE_TTL_MINUTES = 10;
4736
4943
  var CODE_TTL_MS = MILLISECONDS_IN_A_MINUTE * CODE_TTL_MINUTES;
4737
4944
  var TOKEN_BYTES3 = 32;
@@ -4781,6 +4988,8 @@ var oidcProviderRoutes = (config) => {
4781
4988
  const deviceAuthorizationRoute = `${oidcRoute}/device_authorization`;
4782
4989
  const deviceApproveRoute = `${oidcRoute}/device/decision`;
4783
4990
  const endSessionRoute = `${oidcRoute}/end_session`;
4991
+ const registrationRoute = `${oidcRoute}/register`;
4992
+ const registrationBaseUrl = `${issuer}${registrationRoute}`;
4784
4993
  const tokenUrl = `${issuer}${oidcRoute}/token`;
4785
4994
  const authenticateClient = async (clientId, clientSecret) => {
4786
4995
  const client = await clientStore.findClient(clientId);
@@ -4971,6 +5180,9 @@ var oidcProviderRoutes = (config) => {
4971
5180
  if (config.deviceAuthorizationStore) {
4972
5181
  discovery.device_authorization_endpoint = `${issuer}${deviceAuthorizationRoute}`;
4973
5182
  }
5183
+ if (config.clientRegistrationTokenStore !== undefined) {
5184
+ discovery.registration_endpoint = registrationBaseUrl;
5185
+ }
4974
5186
  const handleEndSession = async ({
4975
5187
  cookie,
4976
5188
  inMemorySession,
@@ -5284,6 +5496,96 @@ var oidcProviderRoutes = (config) => {
5284
5496
  cookie: t12.Cookie({
5285
5497
  user_session_id: t12.Optional(userSessionIdTypebox)
5286
5498
  })
5499
+ }).post(registrationRoute, async ({ body, headers }) => {
5500
+ if (config.clientRegistrationTokenStore === undefined) {
5501
+ return jsonResponse({ error: "unsupported_response_type" }, HTTP_NOT_IMPLEMENTED);
5502
+ }
5503
+ const presented = headers.authorization?.startsWith("Bearer ") ? headers.authorization.slice("Bearer ".length).trim() : undefined;
5504
+ const result = await registerClient({
5505
+ clientStore,
5506
+ initialAccessTokenStore: config.initialAccessTokenStore,
5507
+ metadata: body,
5508
+ onClientRegistration: config.onClientRegistration,
5509
+ presentedInitialAccessToken: presented,
5510
+ registrationBaseUrl,
5511
+ registrationTokenStore: config.clientRegistrationTokenStore
5512
+ });
5513
+ return jsonResponse(result.body, result.ok ? HTTP_OK2 : result.status);
5514
+ }, {
5515
+ body: t12.Object({
5516
+ backchannel_logout_uri: t12.Optional(t12.String()),
5517
+ client_name: t12.Optional(t12.String()),
5518
+ jwks: t12.Optional(t12.Any()),
5519
+ jwks_uri: t12.Optional(t12.String()),
5520
+ post_logout_redirect_uris: t12.Optional(t12.Array(t12.String())),
5521
+ redirect_uris: t12.Optional(t12.Array(t12.String())),
5522
+ scope: t12.Optional(t12.String())
5523
+ }),
5524
+ headers: t12.Object({
5525
+ authorization: t12.Optional(t12.String())
5526
+ })
5527
+ }).get(`${registrationRoute}/:clientId`, async ({ headers, params: { clientId } }) => {
5528
+ if (config.clientRegistrationTokenStore === undefined) {
5529
+ return jsonResponse({ error: "unsupported_response_type" }, HTTP_NOT_IMPLEMENTED);
5530
+ }
5531
+ const result = await getRegisteredClient({
5532
+ authorization: headers.authorization,
5533
+ clientId,
5534
+ clientStore,
5535
+ registrationTokenStore: config.clientRegistrationTokenStore
5536
+ });
5537
+ return jsonResponse(result.body, result.status);
5538
+ }, {
5539
+ headers: t12.Object({
5540
+ authorization: t12.Optional(t12.String())
5541
+ }),
5542
+ params: t12.Object({ clientId: t12.String() })
5543
+ }).put(`${registrationRoute}/:clientId`, async ({ body, headers, params: { clientId } }) => {
5544
+ if (config.clientRegistrationTokenStore === undefined) {
5545
+ return jsonResponse({ error: "unsupported_response_type" }, HTTP_NOT_IMPLEMENTED);
5546
+ }
5547
+ const result = await updateRegisteredClient({
5548
+ authorization: headers.authorization,
5549
+ clientId,
5550
+ clientStore,
5551
+ metadata: body,
5552
+ onClientRegistration: config.onClientRegistration,
5553
+ registrationTokenStore: config.clientRegistrationTokenStore
5554
+ });
5555
+ return jsonResponse(result.body, result.status);
5556
+ }, {
5557
+ body: t12.Object({
5558
+ backchannel_logout_uri: t12.Optional(t12.String()),
5559
+ client_name: t12.Optional(t12.String()),
5560
+ jwks: t12.Optional(t12.Any()),
5561
+ jwks_uri: t12.Optional(t12.String()),
5562
+ post_logout_redirect_uris: t12.Optional(t12.Array(t12.String())),
5563
+ redirect_uris: t12.Optional(t12.Array(t12.String())),
5564
+ scope: t12.Optional(t12.String())
5565
+ }),
5566
+ headers: t12.Object({
5567
+ authorization: t12.Optional(t12.String())
5568
+ }),
5569
+ params: t12.Object({ clientId: t12.String() })
5570
+ }).delete(`${registrationRoute}/:clientId`, async ({ headers, params: { clientId } }) => {
5571
+ if (config.clientRegistrationTokenStore === undefined) {
5572
+ return jsonResponse({ error: "unsupported_response_type" }, HTTP_NOT_IMPLEMENTED);
5573
+ }
5574
+ const result = await deleteRegisteredClient({
5575
+ authorization: headers.authorization,
5576
+ clientId,
5577
+ clientStore,
5578
+ registrationTokenStore: config.clientRegistrationTokenStore
5579
+ });
5580
+ if (result.status === HTTP_NO_CONTENT) {
5581
+ return new Response(null, { status: HTTP_NO_CONTENT });
5582
+ }
5583
+ return jsonResponse(result.body, result.status);
5584
+ }, {
5585
+ headers: t12.Object({
5586
+ authorization: t12.Optional(t12.String())
5587
+ }),
5588
+ params: t12.Object({ clientId: t12.String() })
5287
5589
  }).get(jwksRoute, () => ({ keys: [toPublicJwk(signingKey)] })).get("/.well-known/openid-configuration", () => discovery);
5288
5590
  };
5289
5591
 
@@ -20493,10 +20795,49 @@ var createInMemoryLogoutDeliveryStore = () => {
20493
20795
  }
20494
20796
  };
20495
20797
  };
20798
+ var createInMemoryClientRegistrationTokenStore = () => {
20799
+ const byHash = new Map;
20800
+ return {
20801
+ deleteByClientId: async (clientId) => {
20802
+ for (const [hash, token] of byHash) {
20803
+ if (token.clientId === clientId)
20804
+ byHash.delete(hash);
20805
+ }
20806
+ },
20807
+ findByTokenHash: async (tokenHash) => byHash.get(tokenHash),
20808
+ saveToken: async (token) => {
20809
+ for (const [hash, existing] of byHash) {
20810
+ if (existing.clientId === token.clientId)
20811
+ byHash.delete(hash);
20812
+ }
20813
+ byHash.set(token.tokenHash, { ...token });
20814
+ }
20815
+ };
20816
+ };
20817
+ var createInMemoryInitialAccessTokenStore = (initialHashes = []) => {
20818
+ const remaining = new Set(initialHashes);
20819
+ return {
20820
+ consumeToken: async (tokenHash) => {
20821
+ if (!remaining.has(tokenHash))
20822
+ return false;
20823
+ remaining.delete(tokenHash);
20824
+ return true;
20825
+ }
20826
+ };
20827
+ };
20496
20828
  var createInMemoryOAuthClientStore = (clients) => {
20497
20829
  const registry = new Map(clients.map((client) => [client.clientId, client]));
20498
20830
  return {
20499
- findClient: async (clientId) => registry.get(clientId)
20831
+ deleteClient: async (clientId) => {
20832
+ registry.delete(clientId);
20833
+ },
20834
+ findClient: async (clientId) => registry.get(clientId),
20835
+ saveClient: async (client) => {
20836
+ registry.set(client.clientId, { ...client });
20837
+ },
20838
+ updateClient: async (clientId, client) => {
20839
+ registry.set(clientId, { ...client });
20840
+ }
20500
20841
  };
20501
20842
  };
20502
20843
  var createInMemoryOidcRefreshTokenStore = () => {
@@ -20536,6 +20877,11 @@ var oauthClientAssertionJtisTable = pgTable("auth_oauth_client_assertion_jtis",
20536
20877
  expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
20537
20878
  jti: varchar("jti", { length: ID_LENGTH7 }).notNull()
20538
20879
  });
20880
+ var oauthClientRegistrationTokensTable = pgTable("auth_oauth_client_registration_tokens", {
20881
+ client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
20882
+ created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
20883
+ token_hash: varchar("token_hash", { length: ID_LENGTH7 }).primaryKey()
20884
+ });
20539
20885
  var oauthClientsTable = pgTable("auth_oauth_clients", {
20540
20886
  backchannel_logout_uri: varchar("backchannel_logout_uri", {
20541
20887
  length: URL_LENGTH
@@ -20575,6 +20921,9 @@ var oauthDeviceAuthorizationsTable = pgTable("auth_oauth_device_authorizations",
20575
20921
  user_code: varchar("user_code", { length: 16 }).notNull().unique(),
20576
20922
  user_sub: varchar("user_sub", { length: ID_LENGTH7 })
20577
20923
  });
20924
+ var oauthInitialAccessTokensTable = pgTable("auth_oauth_initial_access_tokens", {
20925
+ token_hash: varchar("token_hash", { length: ID_LENGTH7 }).primaryKey()
20926
+ });
20578
20927
  var oauthLogoutDeliveriesTable = pgTable("auth_oauth_logout_deliveries", {
20579
20928
  attempts: bigint("attempts", { mode: "number" }).notNull(),
20580
20929
  client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
@@ -20677,7 +21026,9 @@ var toRefreshValues = (token) => ({
20677
21026
  });
20678
21027
  var createNeonAuthorizationCodeStore = (databaseUrl) => createPostgresAuthorizationCodeStore(createNeonDatabase(databaseUrl));
20679
21028
  var createNeonClientAssertionJtiStore = (databaseUrl) => createPostgresClientAssertionJtiStore(createNeonDatabase(databaseUrl));
21029
+ var createNeonClientRegistrationTokenStore = (databaseUrl) => createPostgresClientRegistrationTokenStore(createNeonDatabase(databaseUrl));
20680
21030
  var createNeonDeviceAuthorizationStore = (databaseUrl) => createPostgresDeviceAuthorizationStore(createNeonDatabase(databaseUrl));
21031
+ var createNeonInitialAccessTokenStore = (databaseUrl) => createPostgresInitialAccessTokenStore(createNeonDatabase(databaseUrl));
20681
21032
  var createNeonLogoutDeliveryStore = (databaseUrl) => createPostgresLogoutDeliveryStore(createNeonDatabase(databaseUrl));
20682
21033
  var createNeonOAuthClientStore = (databaseUrl) => createPostgresOAuthClientStore(createNeonDatabase(databaseUrl));
20683
21034
  var createNeonOidcRefreshTokenStore = (databaseUrl) => createPostgresOidcRefreshTokenStore(createNeonDatabase(databaseUrl));
@@ -20707,6 +21058,30 @@ var createPostgresClientAssertionJtiStore = (db) => ({
20707
21058
  }
20708
21059
  }
20709
21060
  });
21061
+ var createPostgresClientRegistrationTokenStore = (db) => ({
21062
+ deleteByClientId: async (clientId) => {
21063
+ await db.delete(oauthClientRegistrationTokensTable).where(eq(oauthClientRegistrationTokensTable.client_id, clientId));
21064
+ },
21065
+ findByTokenHash: async (tokenHash) => {
21066
+ const [row] = await db.select().from(oauthClientRegistrationTokensTable).where(eq(oauthClientRegistrationTokensTable.token_hash, tokenHash)).limit(1);
21067
+ if (!row)
21068
+ return;
21069
+ const token = {
21070
+ clientId: row.client_id,
21071
+ createdAt: row.created_at_ms,
21072
+ tokenHash: row.token_hash
21073
+ };
21074
+ return token;
21075
+ },
21076
+ saveToken: async (token) => {
21077
+ await db.delete(oauthClientRegistrationTokensTable).where(eq(oauthClientRegistrationTokensTable.client_id, token.clientId));
21078
+ await db.insert(oauthClientRegistrationTokensTable).values({
21079
+ client_id: token.clientId,
21080
+ created_at_ms: token.createdAt,
21081
+ token_hash: token.tokenHash
21082
+ });
21083
+ }
21084
+ });
20710
21085
  var createPostgresDeviceAuthorizationStore = (db) => ({
20711
21086
  deleteByDeviceCodeHash: async (deviceCodeHash) => {
20712
21087
  await db.delete(oauthDeviceAuthorizationsTable).where(eq(oauthDeviceAuthorizationsTable.device_code_hash, deviceCodeHash));
@@ -20736,6 +21111,12 @@ var createPostgresDeviceAuthorizationStore = (db) => ({
20736
21111
  await db.update(oauthDeviceAuthorizationsTable).set({ status, user_sub: userSub ?? null }).where(eq(oauthDeviceAuthorizationsTable.device_code_hash, deviceCodeHash));
20737
21112
  }
20738
21113
  });
21114
+ var createPostgresInitialAccessTokenStore = (db) => ({
21115
+ consumeToken: async (tokenHash) => {
21116
+ const deleted = await db.delete(oauthInitialAccessTokensTable).where(eq(oauthInitialAccessTokensTable.token_hash, tokenHash)).returning({ token_hash: oauthInitialAccessTokensTable.token_hash });
21117
+ return deleted.length > 0;
21118
+ }
21119
+ });
20739
21120
  var createPostgresLogoutDeliveryStore = (db) => ({
20740
21121
  listFailed: async (limit = DEFAULT_LIST_LIMIT2) => {
20741
21122
  const rows = await db.select().from(oauthLogoutDeliveriesTable).orderBy(desc(oauthLogoutDeliveriesTable.created_at_ms)).limit(limit);
@@ -20758,10 +21139,30 @@ var createPostgresLogoutDeliveryStore = (db) => ({
20758
21139
  await db.delete(oauthLogoutDeliveriesTable).where(eq(oauthLogoutDeliveriesTable.id, deliveryId));
20759
21140
  }
20760
21141
  });
21142
+ var toClientValues2 = (client) => ({
21143
+ backchannel_logout_uri: client.backchannelLogoutUri ?? null,
21144
+ client_id: client.clientId,
21145
+ hashed_secret: client.hashedSecret ?? null,
21146
+ jwks_json: client.jwks ?? null,
21147
+ jwks_uri: client.jwksUri ?? null,
21148
+ name: client.name,
21149
+ post_logout_redirect_uris: client.postLogoutRedirectUris ?? null,
21150
+ redirect_uris: client.redirectUris,
21151
+ scopes: client.scopes
21152
+ });
20761
21153
  var createPostgresOAuthClientStore = (db) => ({
21154
+ deleteClient: async (clientId) => {
21155
+ await db.delete(oauthClientsTable).where(eq(oauthClientsTable.client_id, clientId));
21156
+ },
20762
21157
  findClient: async (clientId) => {
20763
21158
  const [row] = await db.select().from(oauthClientsTable).where(eq(oauthClientsTable.client_id, clientId)).limit(1);
20764
21159
  return row ? toClient2(row) : undefined;
21160
+ },
21161
+ saveClient: async (client) => {
21162
+ await db.insert(oauthClientsTable).values(toClientValues2(client));
21163
+ },
21164
+ updateClient: async (clientId, client) => {
21165
+ await db.update(oauthClientsTable).set(toClientValues2(client)).where(eq(oauthClientsTable.client_id, clientId));
20765
21166
  }
20766
21167
  });
20767
21168
  var createPostgresOidcRefreshTokenStore = (db) => ({
@@ -22215,6 +22616,7 @@ export {
22215
22616
  validateSession,
22216
22617
  validateEmailDeliverability,
22217
22618
  userSessionIdTypebox,
22619
+ updateRegisteredClient,
22218
22620
  trustDevice,
22219
22621
  toPublicJwk,
22220
22622
  switchActiveSession,
@@ -22252,6 +22654,7 @@ export {
22252
22654
  resolveAuthHtmxRenderers,
22253
22655
  resolveApiPrincipal,
22254
22656
  removeFromSessionRing,
22657
+ registerClient,
22255
22658
  refreshableProviderOptions,
22256
22659
  recordLoginAttempt,
22257
22660
  readSessionRing,
@@ -22273,9 +22676,11 @@ export {
22273
22676
  oidcProviderOptions,
22274
22677
  oauthRefreshTokensTable,
22275
22678
  oauthLogoutDeliveriesTable,
22679
+ oauthInitialAccessTokensTable,
22276
22680
  oauthDeviceAuthorizationsTable,
22277
22681
  oauthCodesTable,
22278
22682
  oauthClientsTable,
22683
+ oauthClientRegistrationTokensTable,
22279
22684
  oauthClientAssertionJtisTable,
22280
22685
  mintLogoutToken,
22281
22686
  mfaTotpRoutes,
@@ -22319,6 +22724,7 @@ export {
22319
22724
  hasOrganizationScope,
22320
22725
  getUserSessionId,
22321
22726
  getStatus,
22727
+ getRegisteredClient,
22322
22728
  generateTotpSecret,
22323
22729
  generateTotp,
22324
22730
  generateSigningKey,
@@ -22338,6 +22744,7 @@ export {
22338
22744
  encryptSecret,
22339
22745
  denyDeviceAuthorization,
22340
22746
  deleteWarrant,
22747
+ deleteRegisteredClient,
22341
22748
  defineProvidersConfiguration,
22342
22749
  defineAuthSettings,
22343
22750
  defineAuthHtmxConfig,
@@ -22382,8 +22789,10 @@ export {
22382
22789
  createPostgresLoginHistoryStore,
22383
22790
  createPostgresLockoutStore,
22384
22791
  createPostgresKnownDeviceStore,
22792
+ createPostgresInitialAccessTokenStore,
22385
22793
  createPostgresDeviceAuthorizationStore,
22386
22794
  createPostgresCredentialStore,
22795
+ createPostgresClientRegistrationTokenStore,
22387
22796
  createPostgresClientAssertionJtiStore,
22388
22797
  createPostgresAuthorizationCodeStore,
22389
22798
  createPostgresAuditSink,
@@ -22411,9 +22820,11 @@ export {
22411
22820
  createNeonLockoutStore,
22412
22821
  createNeonLinkedProviderStores,
22413
22822
  createNeonKnownDeviceStore,
22823
+ createNeonInitialAccessTokenStore,
22414
22824
  createNeonDeviceAuthorizationStore,
22415
22825
  createNeonDatabase,
22416
22826
  createNeonCredentialStore,
22827
+ createNeonClientRegistrationTokenStore,
22417
22828
  createNeonClientAssertionJtiStore,
22418
22829
  createNeonAuthorizationCodeStore,
22419
22830
  createNeonAuthSessionStore,
@@ -22443,8 +22854,10 @@ export {
22443
22854
  createInMemoryLockoutStore,
22444
22855
  createInMemoryLinkedProviderStores,
22445
22856
  createInMemoryKnownDeviceStore,
22857
+ createInMemoryInitialAccessTokenStore,
22446
22858
  createInMemoryDeviceAuthorizationStore,
22447
22859
  createInMemoryCredentialStore,
22860
+ createInMemoryClientRegistrationTokenStore,
22448
22861
  createInMemoryClientAssertionJtiStore,
22449
22862
  createInMemoryCheckCache,
22450
22863
  createInMemoryAuthorizationCodeStore,
@@ -22515,5 +22928,5 @@ export {
22515
22928
  AuthIdentityConflictError
22516
22929
  };
22517
22930
 
22518
- //# debugId=A9BAB004D30595D664756E2164756E21
22931
+ //# debugId=670CF7C3F8CEA35064756E2164756E21
22519
22932
  //# sourceMappingURL=index.js.map