wip: configurator

This commit is contained in:
mbaharip
2025-01-21 21:58:44 +07:00
parent 599988968e
commit 3ce78a7278
+25
View File
@@ -0,0 +1,25 @@
"use server";
import { type ActionResponseSchema } from "~/types";
import { base64Decode, base64Encode } from "~/lib/utils.server";
export async function GenerateServiceAccountB64(serviceAccount: string): Promise<ActionResponseSchema<string>> {
const b64 = base64Encode(serviceAccount, "standard");
// Test
const decoded = base64Decode(b64, "standard");
if (decoded !== serviceAccount) {
return {
success: false,
message: "Encode failed to match the original string",
error: "Something went wrong while testing the encoding, please try again",
};
}
return {
success: true,
message: "Service account generated",
data: b64,
};
}