@absolutejs/auth 0.56.12 → 0.56.14

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.
@@ -1,5 +1,5 @@
1
1
  import type { RouteString } from '../types';
2
- import { type SigningKey } from './keys';
2
+ import { type SigningKey, type SigningKeyIdentity } from './keys';
3
3
  import type { OnClientRegistered, OnClientRegistration } from './registration';
4
4
  import type { VciConfig } from './vci';
5
5
  import type { AuthorizationCodeStore, BackchannelAuthStore, ClientAssertionJtiStore, ClientRegistrationTokenStore, DeviceAuthorizationStore, InitialAccessTokenStore, LogoutDeliveryStore, OAuthClient, OAuthClientStore, OidcRefreshTokenStore, PushedAuthorizationRequestStore } from './types';
@@ -107,6 +107,10 @@ export type OidcProviderConfig<UserType> = {
107
107
  pushedAuthorizationRequestTtlMs?: number;
108
108
  refreshTokenStore: OidcRefreshTokenStore;
109
109
  refreshTokenTtlMs?: number;
110
+ /** Previous public signing identities retained only for the bounded token
111
+ * overlap window after rotation. The active `signingKey` always signs new
112
+ * tokens and is published first. Private material does not belong here. */
113
+ previousSigningKeys?: readonly SigningKeyIdentity[];
110
114
  signingKey: SigningKey;
111
115
  strictFapi?: boolean;
112
116
  vciConfig?: VciConfig;
@@ -6,7 +6,7 @@
6
6
  * through the package root.
7
7
  */
8
8
  export type { OidcProviderConfig } from './config';
9
- export { generateSigningKey, jwkThumbprint, signJwt, toPublicJwk, verifyJwt, type SigningKey } from './keys';
9
+ export { generateSigningKey, jwkThumbprint, signJwt, signingVerificationKeys, toPublicJwk, verifyJwt, verifyJwtWithKeys, type SigningKey, type SigningKeyIdentity } from './keys';
10
10
  export { revokeOAuthClientCredentials } from './operator';
11
11
  export { createNeonAuthorizationCodeStore, createNeonClientAssertionJtiStore, createNeonClientRegistrationTokenStore, createNeonDeviceAuthorizationStore, createNeonInitialAccessTokenStore, createNeonOAuthClientStore, createNeonOidcRefreshTokenStore, createPostgresAuthorizationCodeStore, createPostgresClientAssertionJtiStore, createPostgresClientRegistrationTokenStore, createPostgresDeviceAuthorizationStore, createPostgresInitialAccessTokenStore, createPostgresOAuthClientStore, createPostgresOidcRefreshTokenStore } from './postgresStores';
12
12
  export type { AuthorizationCodeStore, ClientAssertionJtiStore, ClientRegistrationTokenStore, DeviceAuthorizationStore, InitialAccessTokenStore, OAuthClient, OAuthClientStore, OidcRefreshTokenConnection, OidcRefreshTokenStore } from './types';
@@ -125,6 +125,26 @@ var verifyJwt = async (token, publicJwk) => {
125
125
  payload
126
126
  };
127
127
  };
128
+ var signingVerificationKeys = (active, previous = []) => {
129
+ const keys = [active, ...previous];
130
+ const keyIds = new Set(keys.map(({ kid }) => kid));
131
+ if (keyIds.size !== keys.length)
132
+ throw new Error("OIDC signing key IDs must be unique");
133
+ return keys;
134
+ };
135
+ var verifyJwtWithKeys = async (token, keys) => {
136
+ const [headerSegment] = token.split(".");
137
+ if (!headerSegment)
138
+ return;
139
+ const header = decodeSegment(headerSegment);
140
+ const kid = header?.kid;
141
+ if (typeof kid !== "string" || kid.length === 0)
142
+ return;
143
+ const key = keys.find((candidate) => candidate.kid === kid);
144
+ if (!key)
145
+ return;
146
+ return verifyJwt(token, key.publicJwk);
147
+ };
128
148
  // src/oidc/operator.ts
129
149
  var operatorDelete = (store, storeName) => {
130
150
  if (!store.deleteForClient)
@@ -12188,8 +12208,10 @@ var createPostgresBackchannelAuthStore = (db) => ({
12188
12208
  }
12189
12209
  });
12190
12210
  export {
12211
+ verifyJwtWithKeys,
12191
12212
  verifyJwt,
12192
12213
  toPublicJwk,
12214
+ signingVerificationKeys,
12193
12215
  signJwt,
12194
12216
  revokeOAuthClientCredentials,
12195
12217
  jwkThumbprint,
@@ -12210,5 +12232,5 @@ export {
12210
12232
  createNeonAuthorizationCodeStore
12211
12233
  };
12212
12234
 
12213
- //# debugId=3782E808539F50C164756E2164756E21
12235
+ //# debugId=09059391C2D6086264756E2164756E21
12214
12236
  //# sourceMappingURL=index.js.map