Open paradoxsugar opened 4 months ago
+1
hbe.js 里面加了下面的代码,凑合使用
let timeout
function delay(ms) {
return new Promise((resolve) => {
timeout = setTimeout(resolve, ms);
});
}
passwordElement.addEventListener("input", async () => {
clearTimeout(timeout);
await delay(1000);
const password = document.getElementById("hbePass").value;
const keyMaterial = await getKeyMaterial(password);
const hmacKey = await getHmacKey(keyMaterial);
const decryptKey = await getDecryptKey(keyMaterial);
const iv = await getIv(keyMaterial);
decrypt(decryptKey, iv, hmacKey).then((result) => {
console.log(`Decrypt result: ${result}`);
if (result) {
cryptoObj.subtle.exportKey("jwk", decryptKey).then((dk) => {
cryptoObj.subtle.exportKey("jwk", hmacKey).then((hmk) => {
const newStorageData = {
dk: dk,
iv: arrayBufferToHex(iv),
hmk: hmk,
};
storage.setItem(storageName, JSON.stringify(newStorageData));
});
});
}
});
});
Issue
移动端输入法经常没有回车键,回车键处由“下个”代替,点击后若开启评论则跳转到评论区而无法输入密码
Expected Behavior
添加类似于“encrypt again”的button,实现代替回车功能; 虽然#200存在修改方案,但是依然觉得有一个button更好,希望纳入更新计划