Skip to content

feat: honor foreign public-route metadata - #13

Merged
kauandotnet merged 1 commit into
mainfrom
codex/public-metadata-interop
Aug 5, 2026
Merged

feat: honor foreign public-route metadata#13
kauandotnet merged 1 commit into
mainfrom
codex/public-metadata-interop

Conversation

@kauandotnet

Copy link
Copy Markdown
Contributor

Summary

  • add opt-in interop.publicKeys module configuration
  • let BetterAuthGuard honor public-route metadata owned by another guard
  • skip session resolution for matching public routes
  • preserve fail-closed precedence:
    • handler-level Better Auth requirements override inherited foreign markers
    • explicit handler-level foreign markers win across every configured key
  • preserve the guard's existing two-argument constructor
  • document and export the new interop option

Why

Applications integrating another framework with its own @Public() metadata currently need an application-level wrapper guard. This makes that interoperability first-class while preserving Better Auth's authorization precedence.

Public API

BetterAuthModuleOptions gains the optional interop.publicKeys setting. Existing configuration and direct two-argument BetterAuthGuard construction remain compatible.

Validation

  • pnpm test — 155 Express and 155 Fastify tests passed
  • pnpm run check
  • pnpm run verify:pack
  • packed-type consumer, including the original guard constructor
  • git diff --check

@kauandotnet
kauandotnet marked this pull request as ready for review August 4, 2026 21:29
@kauandotnet
kauandotnet merged commit 9d33311 into main Aug 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant