Initial commit

This commit is contained in:
Patrick Alvin Alcala 2026-02-10 19:45:22 +08:00
commit eb8731d039
90 changed files with 6380 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;
};