Skip to content

Commit

Permalink
unbase64
Browse files Browse the repository at this point in the history
  • Loading branch information
Flaque committed Nov 20, 2024
1 parent 6176bf8 commit d98897c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/clusters/keys.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as crypto from "node:crypto";
import * as path from "node:path";
import * as os from "node:os";
import { Buffer } from "node:buffer";

export async function getKeys(): Promise<{ publicKey: string; privateKey: string }> {
const keys = await loadKeys();
Expand Down Expand Up @@ -40,8 +41,8 @@ export function decryptSecret(secret: string, privateKey: string) {
const decrypted = crypto.privateDecrypt({
key: privateKey,
padding: crypto.constants.RSA_PKCS1_PADDING,
}, secret);
return decrypted;
}, Buffer.from(secret, 'base64'));
return decrypted.toString('utf8');
}

async function saveKeys(keys: { publicKey: string; privateKey: string }) {
Expand Down

0 comments on commit d98897c

Please sign in to comment.