chatGpt-docker / chunks /crypto.post.mjs
zhang-wei-jian's picture
:rocket:
e6e3b33
raw
history blame contribute delete
563 Bytes
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