better-auth
Version:
The most comprehensive authentication library for TypeScript.
90 lines (86 loc) • 3.04 kB
JavaScript
require('../shared/better-auth.DiSjtgs9.cjs');
require('@better-auth/utils/base64');
require('@better-auth/utils/hmac');
require('@better-auth/utils/binary');
const cookies_index = require('../cookies/index.cjs');
require('better-call');
require('zod');
const account = require('../shared/better-auth.CM7smaHY.cjs');
require('../shared/better-auth.DcWKCjjf.cjs');
require('../shared/better-auth.B6zCUmP6.cjs');
require('../plugins/organization/access/index.cjs');
require('../shared/better-auth.CYeOI8C-.cjs');
require('../shared/better-auth.GpOOav9x.cjs');
require('defu');
require('@better-auth/utils/hash');
require('@noble/ciphers/chacha');
require('@noble/ciphers/utils');
require('@noble/ciphers/webcrypto');
require('jose');
require('@noble/hashes/scrypt');
require('@better-auth/utils');
require('@better-auth/utils/hex');
require('@noble/hashes/utils');
require('@better-auth/utils/otp');
require('../plugins/admin/access/index.cjs');
require('@better-fetch/fetch');
require('@better-auth/utils/random');
require('../shared/better-auth.BG6vHVNT.cjs');
require('kysely');
require('../shared/better-auth.ANpbi45u.cjs');
require('../shared/better-auth.C1hdVENX.cjs');
require('../shared/better-auth.D3mtHEZg.cjs');
require('../shared/better-auth.C-R0J0n1.cjs');
require('../shared/better-auth.CWJ7qc0w.cjs');
require('../social-providers/index.cjs');
require('../shared/better-auth.6XyKj7DG.cjs');
require('../shared/better-auth.Bg6iw3ig.cjs');
require('../shared/better-auth.BMYo0QR-.cjs');
require('jose/errors');
require('../shared/better-auth.DhsGZ30Q.cjs');
require('../shared/better-auth.DSVbLSt7.cjs');
require('../plugins/access/index.cjs');
const reactStartCookies = () => {
return {
id: "react-start-cookies",
hooks: {
after: [
{
matcher(ctx) {
return true;
},
handler: account.createAuthMiddleware(async (ctx) => {
const returned = ctx.context.responseHeaders;
if ("_flag" in ctx && ctx._flag === "router") {
return;
}
if (returned instanceof Headers) {
const setCookies = returned?.get("set-cookie");
if (!setCookies) return;
const parsed = cookies_index.parseSetCookieHeader(setCookies);
const { setCookie } = await import('@tanstack/react-start/server');
parsed.forEach((value, key) => {
if (!key) return;
const opts = {
sameSite: value.samesite,
secure: value.secure,
maxAge: value["max-age"],
httpOnly: value.httponly,
domain: value.domain,
path: value.path
};
try {
setCookie(key, decodeURIComponent(value.value), opts);
} catch (e) {
}
});
return;
}
})
}
]
}
};
};
exports.reactStartCookies = reactStartCookies;
;