log users out if they do not have curve keys. add curve keys to object on registration and login.

This commit is contained in:
ansuz
2017-07-05 17:19:28 +02:00
parent 4016a95540
commit e353627204
5 changed files with 22 additions and 3 deletions

View File

@@ -22,7 +22,12 @@ define([
// 16 bytes for a deterministic channel key
var channelSeed = dispense(16);
// 32 bytes for a curve key
opt.curveSeed = dispense(32);
var curveSeed = dispense(32);
var curvePair = Nacl.box.keyPair.fromSecretKey(new Uint8Array(curveSeed));
opt.curvePrivate = Nacl.util.encodeBase64(curvePair.secretKey);
opt.curvePublic = Nacl.util.encodeBase64(curvePair.publicKey);
// 32 more for a signing key
var edSeed = opt.edSeed = dispense(32);
@@ -109,6 +114,9 @@ define([
res.edPrivate = opt.edPrivate;
res.edPublic = opt.edPublic;
res.curvePrivate = opt.curvePrivate;
res.curvePublic = opt.curvePublic;
// they tried to just log in but there's no such user
if (!isRegister && isProxyEmpty(rt.proxy)) {
rt.network.disconnect(); // clean up after yourself