move turn secret generation

This commit is contained in:
Girish Ramakrishnan
2021-11-16 22:37:42 -08:00
parent 132c1872f4
commit b7c5c99301
2 changed files with 6 additions and 6 deletions
-4
View File
@@ -23,7 +23,6 @@ exports = module.exports = {
const assert = require('assert'),
BoxError = require('./boxerror.js'),
crypto = require('crypto'),
database = require('./database.js'),
debug = require('debug')('box:blobs'),
paths = require('./paths.js'),
@@ -59,9 +58,6 @@ async function generateSecrets() {
if (!acmeAccountKey) throw new BoxError(BoxError.OPENSSL_ERROR, `Could not generate acme account key: ${safe.error.message}`);
await set(exports.ACME_ACCOUNT_KEY, acmeAccountKey);
const turnSecret = 'a' + crypto.randomBytes(15).toString('hex'); // prefix with a to ensure string starts with a letter
await set(exports.ADDON_TURN_SECRET, Buffer.from(turnSecret));
debug('generateSecrets: generating dhparams.pem');
// https://security.stackexchange.com/questions/95178/diffie-hellman-parameters-still-calculating-after-24-hours
const dhparams = safe.child_process.execSync('openssl dhparam -dsaparam 2048');