From 32d84e8f36f1ebb4469463915fada56d05f984f4 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 17 Jul 2018 14:49:03 +0200 Subject: [PATCH] initialize new registrations with a v2 hash --- customize.dist/login.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/customize.dist/login.js b/customize.dist/login.js index 3094370e0..ab9fabfa8 100644 --- a/customize.dist/login.js +++ b/customize.dist/login.js @@ -68,12 +68,12 @@ define([ // should never happen if (channelHex.length !== 32) { throw new Error('invalid channel id'); } - opt.channel64 = Util.hexToBase64(channelHex); + var channel64 = Util.hexToBase64(channelHex); // we still generate a v1 hash because this function needs to deterministically // derive the same values as it always has. New accounts will generate their own // userHash values - opt.userHash = '/1/edit/' + [opt.channel64, opt.keys.editKeyStr].join('/') + '/'; + opt.userHash = '/1/edit/' + [channel64, opt.keys.editKeyStr].join('/') + '/'; return opt; }; @@ -275,8 +275,10 @@ define([ console.log("allocating random bytes for a new user object"); opt = allocateBytes(Nacl.randomBytes(Exports.requiredBytes)); // create a random v2 hash, since we don't need backwards compatibility - //userHash = opt.userHash = Hash.createRandomHash('drive'); // TODO - userHash = opt.userHash; + userHash = opt.userHash = Hash.createRandomHash('drive'); + var secret = Hash.getSecrets('drive', userHash); + opt.keys = secret.keys; + opt.channelHex = secret.channel; } // according to the location derived from the credentials which you entered