This commit is contained in:
Patrick Alvin Alcala 2025-11-20 13:03:40 +08:00
parent 4184942584
commit afb5f3a287
66 changed files with 550 additions and 57 deletions

View file

@ -0,0 +1,13 @@
import { JSEncrypt } from 'jsencrypt'
import { $rsaPublicKey } from '../../../../configs/config.security'
const enc = new JSEncrypt()
const PUBLIC_KEY = $rsaPublicKey.get()
export default async (message: string) => {
enc.setPublicKey(PUBLIC_KEY)
const encrypted = enc.encrypt(message).toString()
const fixedEncrypted = encrypted.replace(/\//g, '~')
return fixedEncrypted
}