Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function main() {
const stringContent = fs.readFileSync(SOURCE, { encoding: 'utf8' })
const parsedContent = JSON.parse(stringContent)
removeEmptyMessages(parsedContent)
const serializedContent = stableStringify(parsedContent, { space: 2 }) + '\n'
fs.writeFileSync(DESTINATION, serializedContent)
console.log(chalk.green(`[normalize-messages.js] ${DESTINATION} written ✔`))
}
function compute_thp(jwk) {
var REQUIRED_ATTRS = {
RSA: ['kty', 'p', 'd', 'q', 'dp', 'dq', 'qi', 'oth'],
EC: ['kty', 'crv', 'x', 'y'],
oct: ['kty', 'k'],
};
if (!jwk.kty)
return "(no key type attribute=";
if (!REQUIRED_ATTRS[jwk.kty])
return cockpit.format("(unknown keytype $0)", jwk.kty);
var req = REQUIRED_ATTRS[jwk.kty];
var norm = { };
req.forEach(k => { if (k in jwk) norm[k] = jwk[k]; });
return jwk_b64_encode(sha1.digest(stable_stringify(norm)));
}
function updateStatsFile(filePath: string, currentBundleStats: any) {
const stats = fs.existsSync(filePath) ? require(filePath) : {}
stats[UNRELEASED_VERSION_STRING] = {
bundles: currentBundleStats,
}
fs.writeFileSync(
filePath,
stableStringify(stats, {
cmp: semverCmp,
space: 2,
}),
)
}