From 3ce78a7278780296fe16b9e22dbe4e3ed65b1a40 Mon Sep 17 00:00:00 2001 From: mbaharip <62494292+mbahArip@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:58:44 +0700 Subject: [PATCH] wip: configurator --- src/actions/configuration.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/actions/configuration.ts diff --git a/src/actions/configuration.ts b/src/actions/configuration.ts new file mode 100644 index 0000000..0fca0b2 --- /dev/null +++ b/src/actions/configuration.ts @@ -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> { + 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, + }; +}