Skip to content

Instantly share code, notes, and snippets.

@panva

panva/main.js Secret

Last active November 4, 2022 22:21
Show Gist options
  • Save panva/0a69f62d5d1257956d9556a7451889b5 to your computer and use it in GitHub Desktop.
Save panva/0a69f62d5d1257956d9556a7451889b5 to your computer and use it in GitHub Desktop.
aeskwcrash
// Modules to control application life and create native browser window
const {app} = require('electron')
const crypto = require('node:crypto')
app.on('ready', () => {
(async () => {
const bogusWebCrypto = [{ hash: "SHA-256", name: "HMAC" }, true, ["sign"]];
const cek = crypto.randomBytes(16);
const cryptoKeyCek = await crypto.webcrypto.subtle.importKey(
"raw",
cek,
...bogusWebCrypto
);
const cryptoKey = await crypto.webcrypto.subtle.generateKey(
{ name: "AES-KW", length: 128 },
false,
["wrapKey", "unwrapKey"]
);
await crypto.webcrypto.subtle.wrapKey("raw", cryptoKeyCek, cryptoKey, "AES-KW")
})()
})
{
"name": "unlikely-property-correlate-48cek",
"productName": "unlikely-property-correlate-48cek",
"description": "My Electron application description",
"keywords": [],
"main": "./main.js",
"version": "1.0.0",
"author": "panva",
"scripts": {
"start": "electron ."
},
"dependencies": {},
"devDependencies": {
"electron": "20.1.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment