该接口用于数据加解密,详细定义及用法参见MDN官方文档 encrypt 、decrypt。
async function encrypt_handle(key, plain) {
var algorithm = {name: "AES-CBC"};
return await crypto.subtle.encrypt(algorithm, key, plain);
}
async function decrypt_handle(key, cipher) {
var algorithm = {name: "AES-CBC"};
return await crypto.subtle.decrypt(algorithm, key, cipher);
}