Spaces:
Runtime error
Runtime error
import { defineEventHandler, readBody } from 'h3'; | |
import CryptoJS from 'crypto-js'; | |
const key = "lianginx"; | |
const crypto_post = defineEventHandler(async (event) => { | |
const crypto = await readBody(event); | |
return aesCrypto(crypto); | |
}); | |
function aesCrypto(crypto) { | |
if (crypto.type === "en") { | |
return CryptoJS.AES.encrypt(crypto.message, key).toString(); | |
} else { | |
return CryptoJS.AES.decrypt(crypto.message, key).toString( | |
CryptoJS.enc.Utf8 | |
); | |
} | |
} | |
export { aesCrypto, crypto_post as default }; | |
//# sourceMappingURL=crypto.post.mjs.map | |