aboutsummaryrefslogtreecommitdiff
path: root/signing/sign.js
blob: 116a6a9079432ed575e750de7b5ad2775f9a9035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const fs = require('fs');
const crypto = require('crypto');
global.sdb = {};

function scan(start) {
    rt = fs.readdirSync(start);
    for (file of rt) {
        if (file !== ".git" && file !== "build" && file !== "signatures.json" && file !== "staging" && file !== "node_modules" && !file.endsWith(".staging") && !file.endsWith(".old") && file !== "_translate") {
            if (fs.lstatSync(start + "/" + file).isDirectory()) {
                scan(start + "/" + file);
            } else {
                sign = crypto.createHash('sha512').update(fs.readFileSync(start + "/" + file)).digest('base64')
                console.log("Signed: " + start + "/" + file + ": " + sign);
                sdb[(start + "/" + file).substr(1)] = sign;
            }
        }
    }
}

scan("..");
scan("../node_modules/electron");
scan("../node_modules/@electron");
fs.writeFileSync("../bin/signatures.json", JSON.stringify(sdb));