initial commit with imported utils from old github project
This commit is contained in:
commit
66bb463e23
39 files changed
+1944
No files matched your search
@@ -0,0 +1,17 @@
|
||||
"use server";
|
||||
import { privateEncrypt } from "crypto";
|
||||
import { decryptPrivateKey } from "@/utils/security/decrypt_private_key";
|
||||
export async function encryptMessage(message: string) {
|
||||
const privateKey = await decryptPrivateKey();
|
||||
if (privateKey == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const message_buffer = Buffer.from(message, "utf-8");
|
||||
const message_encrypted = privateEncrypt(privateKey, message_buffer);
|
||||
|
||||
return message_encrypted;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
"use server";
|
||||
import { privateEncrypt } from "crypto";
|
||||
import { decryptPrivateKey } from "@/utils/security/decrypt_private_key";
|
||||
export async function encryptMessage(message: string) {
|
||||
const privateKey = await decryptPrivateKey();
|
||||
if (privateKey == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const message_buffer = Buffer.from(message, "utf-8");
|
||||
const message_encrypted = privateEncrypt(privateKey, message_buffer);
|
||||
|
||||
return message_encrypted;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user