refactored backend to use new naming convention for modules

This commit is contained in:
azivner
2018-04-01 21:27:46 -04:00
parent c765dbc5cf
commit e2921a648d
44 changed files with 305 additions and 310 deletions

View File

@@ -1,23 +1,23 @@
"use strict";
const options = require('../../services/options');
const optionService = require('../../services/options');
const sql = require('../../services/sql');
const utils = require('../../services/utils');
const my_scrypt = require('../../services/my_scrypt');
const password_encryption = require('../../services/password_encryption');
const myScryptService = require('../../services/my_scrypt');
const passwordEncryptionService = require('../../services/password_encryption');
async function setup(req) {
const { username, password } = req.body;
await options.setOption('username', username);
await optionService.setOption('username', username);
await options.setOption('password_verification_salt', utils.randomSecureToken(32));
await options.setOption('password_derived_key_salt', utils.randomSecureToken(32));
await optionService.setOption('password_verification_salt', utils.randomSecureToken(32));
await optionService.setOption('password_derived_key_salt', utils.randomSecureToken(32));
const passwordVerificationKey = utils.toBase64(await my_scrypt.getVerificationHash(password));
await options.setOption('password_verification_hash', passwordVerificationKey);
const passwordVerificationKey = utils.toBase64(await myScryptService.getVerificationHash(password));
await optionService.setOption('password_verification_hash', passwordVerificationKey);
await password_encryption.setDataKey(password, utils.randomSecureToken(16));
await passwordEncryptionService.setDataKey(password, utils.randomSecureToken(16));
sql.setDbReadyAsResolved();
}