From 8a18698c0323a2b83b79aeb680e571ca1bd7e9ff Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 16 Jul 2018 17:08:35 +0200 Subject: [PATCH] initialize newly registered users with a v2 drive hash --- customize.dist/login.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/customize.dist/login.js b/customize.dist/login.js index ed8487ba5..f41422d86 100644 --- a/customize.dist/login.js +++ b/customize.dist/login.js @@ -72,7 +72,9 @@ define([ opt.channel64 = Util.hexToBase64(channelHex); - // XXX why don't we generate a v2 ? + // 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('/') + '/'; return opt; @@ -278,7 +280,8 @@ define([ } else { console.log("allocating random bytes for a new user object"); opt = allocateBytes(Nacl.randomBytes(Exports.requiredBytes)); - userHash = opt.userHash; + // create a random v2 hash, since we don't need backwards compatibility + userHash = '/drive/#' + Hash.createRandomHash('drive'); } // according to the location derived from the credentials which you entered