@ultimat3/auth 31.20.0 → 31.22.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/CLAUDE.md CHANGED
@@ -181,7 +181,7 @@ A rule marked `†` has its full text in [`docs/history/auth-rules.md`](../../do
181
181
  | `limiter-install.ts` | the host's one install point for that limiter — the factory, what it built, and the purge over it, and the TOTP guard's |
182
182
  | `oauth.ts` | `OAuthProvider`, PKCE, `beginOAuth`, the callback gate. No I/O, no env |
183
183
  | `oauth-builtins.ts` | the two shipped IdPs (`github`, `google`), as data. Imports only the type, so no cycle |
184
- | `oauth-registry.ts` | the registry: `registerOAuthProvider`, `providerFor`, `oauthProviderIds` |
184
+ | `oauth-registry.ts` | the registry: `registerOAuthProvider`, `providerFor`, `oauthProviderIds`; test-only `registeredOAuthProviders` / `restoreOAuthProviders` (re-seals) |
185
185
  | `oauth-discovery.ts` | `/.well-known/openid-configuration` → an `OAuthProvider`. One `fetch` |
186
186
  | `jwks.ts` | `crypto.subtle` signature verification, cached by `kid`, one shared in-flight refresh. No dependency |
187
187
  | `workload.ts` | a workload JWT (K8s SA / SPIFFE / IMDS / RFC 8693) → a `ServiceIdentity`; `checkWorkloadToken`, the verdict form |
package/README.md CHANGED
@@ -254,7 +254,8 @@ the two built-ins go through the same call. Before 1.3.0 the id was `keyof typeo
254
254
  OAUTH_PROVIDERS` over `github | google | apple`, so an enterprise OP was **unrepresentable**: the
255
255
  constraint was a type, there was no runtime escape, and the only ways out were forking the package
256
256
  or bypassing OAuth entirely and losing PKCE, the sealed handshake, issuer pinning and account
257
- linking with it.
257
+ linking with it. There is still no unregister: `registeredOAuthProviders()` /
258
+ `restoreOAuthProviders(providers)` are test-only, the pair `@ultimat3/testing`'s rerun seam uses.
258
259
 
259
260
  ```ts
260
261
  import { discoverOAuthProvider, registerOAuthProvider } from '@ultimat3/auth';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/auth",
3
- "version": "31.20.0",
3
+ "version": "31.22.0",
4
4
  "description": "Sessions, passwords, OAuth, MFA and api keys — resolved to one Actor",
5
5
  "keywords": [
6
6
  "ultimate",
@@ -50,8 +50,8 @@
50
50
  "test": "bun test"
51
51
  },
52
52
  "dependencies": {
53
- "@ultimat3/core": "31.20.0",
54
- "@ultimat3/db": "31.20.0",
55
- "@ultimat3/schema": "31.20.0"
53
+ "@ultimat3/core": "31.22.0",
54
+ "@ultimat3/db": "31.22.0",
55
+ "@ultimat3/schema": "31.22.0"
56
56
  }
57
57
  }
package/src/index.ts CHANGED
@@ -300,7 +300,9 @@ export {
300
300
  hasOAuthProvider,
301
301
  oauthProviderIds,
302
302
  providerFor,
303
+ registeredOAuthProviders,
303
304
  registerOAuthProvider,
305
+ restoreOAuthProviders,
304
306
  } from './oauth-registry';
305
307
  export type { AuthRouteDescriptor, OAuthLoginOptions, OAuthLoginRoutes } from './oauth-route';
306
308
  export { oauthLogin } from './oauth-route';
@@ -78,3 +78,18 @@ export function providerFor(id: string): OAuthProvider {
78
78
  export function oauthProviderIds(): readonly string[] {
79
79
  return [...registry.keys()];
80
80
  }
81
+
82
+ /** Test-only: every registered provider, the built-ins included — a copy, never the live map. */
83
+ export function registeredOAuthProviders(): readonly OAuthProvider[] {
84
+ return [...registry.values()];
85
+ }
86
+
87
+ /**
88
+ * Test-only: the registry becomes exactly `providers`, each sealed again on the way in. There is
89
+ * no unregister for an app to reach: `@ultimat3/testing`'s rerun seam forgets one test file's ids
90
+ * with this when that file loads again, and puts back what it did not declare a second time.
91
+ */
92
+ export function restoreOAuthProviders(providers: readonly OAuthProvider[]): void {
93
+ registry.clear();
94
+ for (const provider of providers) registry.set(provider.id, seal(provider));
95
+ }