Added encryption

This commit is contained in:
Patrick Alvin Alcala 2025-11-10 13:40:46 +08:00
parent 0fba045794
commit 91a8f03749

View file

@ -0,0 +1,12 @@
const PUBLIC_KEY = import.meta.env.VITE_PUBLIC_KEY
import { JSEncrypt } from 'jsencrypt'
const enc = new JSEncrypt()
export default async (message: string) => {
enc.setPublicKey(PUBLIC_KEY)
const encrypted = enc.encrypt(message).toString()
const fixedEncrypted = encrypted.replace(/\//g, '~')
return fixedEncrypted
}