fix folder

deskripsi:
- ganti nama folder (user) ke (auth)
- hapus folder auth
This commit is contained in:
2025-02-05 15:34:06 +08:00
parent 6dc4e7afc3
commit d7252b9fb3
21 changed files with 30 additions and 102 deletions

View File

@@ -0,0 +1,25 @@
import { SignJWT } from "jose";
export async function encrypt({
user,
exp = "7 year",
encodedKey,
}: {
user: Record<string, any>;
exp?: string;
encodedKey: string;
}): Promise<string | null> {
try {
const enc = new TextEncoder().encode(encodedKey);
return new SignJWT({ user })
.setProtectedHeader({ alg: "HS256" })
.setIssuedAt()
.setExpirationTime(exp)
.sign(enc);
} catch (error) {
console.error("Gagal mengenkripsi", error);
return null;
}
}
// wibu:0.2.82