diff --git a/lib/load_gen/signup.js b/lib/load_gen/signup.js index 1589f3ec9f1b96a0eb18caedecd4f3c4a79bc48b..6dd123e40c86714082d229f47b4d5c563dcf88d5 100644 --- a/lib/load_gen/signup.js +++ b/lib/load_gen/signup.js @@ -88,14 +88,11 @@ exports.startFunc = function(cfg, cb) { // only one at this point var email = userdb.any(user.emails); - // add a key for the specified email to their device context var keypair = userdb.addKeyToUserCtx(context, email); // stage them wcli.post(cfg, '/wsapi/stage_user', context, { email: email, - pass: user.password, - pubkey: keypair.pub, site: userdb.any(user.sites) }, function (r) { if (r.code !== 200) return cb(false); @@ -105,13 +102,18 @@ exports.startFunc = function(cfg, cb) { }, function (r) { if (r.code !== 200) return cb(false); // and simulate clickthrough - wcli.get(cfg, '/wsapi/prove_email_ownership', context, { - token: r.body + wcli.post(cfg, '/wsapi/complete_user_creation', context, { + token: r.body, + pass: user.password }, function (r) { - if (r.code !== 200 || r.body !== 'true') return cb(false); + r.body = JSON.parse(r.body); + if (r.code !== 200 || r.body.success !== true) return cb(false); + // and now we should call registration status to complete the // process - wcli.get(cfg, '/wsapi/registration_status', context, { + wcli.post(cfg, '/wsapi/cert_key', context, { + email: email, + pubkey: keypair.publicKey.toSimpleObject() }, function(r) { var rv = (r.code === 200 && r.body === '"complete"'); if (!rv) winston.error("registration_status failed during signup: " + JSON.stringify(r)); diff --git a/lib/load_gen/test_keys.js b/lib/load_gen/test_keys.js index 3ea88185555211557896663cd1413fdc3a8e1fb9..7fac6dbab9b377948d659c1d947112a2d88432dd 100644 --- a/lib/load_gen/test_keys.js +++ b/lib/load_gen/test_keys.js @@ -5,11 +5,12 @@ const NUM_KEYPAIRS = 10; process.stdout.write("generating " + NUM_KEYPAIRS + " keypairs to be (re)used in load generation: "); -var keyPairs = []; +exports.keyPairs = []; -while (keyPairs.length < NUM_KEYPAIRS) +while (exports.keyPairs.length < NUM_KEYPAIRS) { - keyPairs.push(jwk.KeyPair.generate("DS", 256)); + exports.keyPairs.push(jwk.KeyPair.generate("DS", 256)); process.stdout.write("."); } + process.stdout.write("\n"); diff --git a/lib/load_gen/user_db.js b/lib/load_gen/user_db.js index 1664983554a3ae16eecece2cd8fe3d1ae265c631..6b97f3902b3abb5e1747bc6bd668000023f2fc94 100644 --- a/lib/load_gen/user_db.js +++ b/lib/load_gen/user_db.js @@ -38,7 +38,9 @@ * purposes of performance testing. */ -var secrets = require('../secrets.js'); +const +secrets = require('../secrets.js'), +keys = require("./test_keys.js"); // the grandiose database var users = [ ]; @@ -126,9 +128,7 @@ exports.addKeyToUserCtx = function(ctx, email) { // this is simulated. it will need to be real to apply load to // the verifier, but that in turn will drastically increase the // cost of the application of load. ho hum. - var pub = secrets.generate(128); - var priv = secrets.generate(128); - var k = {pub: pub, priv: priv} + var k = exports.any(keys.keyPairs); ctx.keys[email] = k; return k; -} \ No newline at end of file +}