add authInternal shortcut function (Big thanks @Ionys320)

This commit is contained in:
Louis Lam
2026-06-29 00:22:28 +08:00
parent 86ac3c84a6
commit 2a0a6cb114
+12 -1
View File
@@ -21,7 +21,9 @@ let godKumaHeaders: Headers;
let godKumaInitSecret: string = "";
/**
*
* Get the singleton instance of better-auth
* Mainly used for http and socket.io authentication
* @returns The singleton instance of better-auth
*/
export function auth() {
if (authInstance) {
@@ -31,6 +33,15 @@ export function auth() {
return authInstance;
}
/**
* Do staff without any auth
* For internal usage only, the api should be a superset of auth().api
* @returns Internal adapter of better-auth
*/
export async function authInternal() {
return (await auth().$context).internalAdapter;
}
/**
*
*/