Initial commit

This commit is contained in:
Patrick Alvin Alcala 2026-01-30 10:23:26 +08:00
commit 51161808ae
88 changed files with 6460 additions and 0 deletions

View file

@ -0,0 +1,17 @@
import { JSEncrypt } from "jsencrypt";
import * as fs from "node:fs";
import * as toml from "toml";
const config = toml.parse(
fs.readFileSync("configs/config.security.toml", "utf-8"),
);
const enc = new JSEncrypt();
const PUBLIC_KEY = config.rsa.public_key;
export default (message: string) => {
enc.setPublicKey(PUBLIC_KEY);
const encrypted = enc.encrypt(message).toString();
const fixedEncrypted = encrypted.replace(/\//g, "~");
return fixedEncrypted;
};