Created
March 27, 2024 20:12
-
-
Save LiranCohen/9c93d27ae218f60042932eba271af75b to your computer and use it in GitHub Desktop.
AES-KW Rejection with `OperationError` in `electron`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { app } = require('electron'); | |
app.whenReady().then(() => { | |
(async () => { | |
const cek = crypto.getRandomValues(new Uint8Array(16)); | |
const cryptoKeyCek = await crypto.subtle.importKey( | |
"raw", | |
cek, | |
{ name: "HMAC", hash: "SHA-256" }, | |
true, | |
["sign"], | |
); | |
const cryptoKey = await crypto.subtle.generateKey( | |
{ name: "AES-KW", length: 128 }, | |
true, | |
["wrapKey", "unwrapKey"] | |
); | |
await crypto.subtle.wrapKey("raw", cryptoKeyCek, cryptoKey, "AES-KW"); | |
})(); | |
}) | |
app.on('window-all-closed', () => { | |
if (process.platform !== 'darwin') app.quit() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "my-electron-app", | |
"version": "1.0.0", | |
"main": "main.js", | |
"author": "example.com", | |
"description": "Example Electron", | |
"license": "MIT", | |
"scripts": { | |
"start": "electron ." | |
}, | |
"devDependencies": { | |
"electron": "^29.1.5" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment