mirror of
https://github.com/hanzoai/dataroom.git
synced 2026-10-30 18:41:07 +00:00
Return null from getHanko() when HANKO_API_KEY is unset, and conditionally include PasskeyProvider in NextAuth only when configured.
19 lines
477 B
TypeScript
19 lines
477 B
TypeScript
import { tenant } from "@teamhanko/passkeys-next-auth-provider";
|
|
|
|
let _hanko: ReturnType<typeof tenant> | null = null;
|
|
|
|
function getHanko(): ReturnType<typeof tenant> | null {
|
|
if (!_hanko) {
|
|
if (!process.env.HANKO_API_KEY || !process.env.NEXT_PUBLIC_HANKO_TENANT_ID) {
|
|
return null;
|
|
}
|
|
_hanko = tenant({
|
|
apiKey: process.env.HANKO_API_KEY,
|
|
tenantId: process.env.NEXT_PUBLIC_HANKO_TENANT_ID,
|
|
});
|
|
}
|
|
return _hanko;
|
|
}
|
|
|
|
export default getHanko;
|