Merge branch 'modern-users' of github.com:xwiki-labs/cryptpad into modern-users

pull/1/head
yflory 7 years ago
commit 5c87bcf94a

@ -30,9 +30,8 @@
"secure-fabric.js": "secure-v1.7.9", "secure-fabric.js": "secure-v1.7.9",
"hyperjson": "~1.4.0", "hyperjson": "~1.4.0",
"chainpad-crypto": "^0.2.0", "chainpad-crypto": "^0.2.0",
"chainpad-listmap": "^0.5.0", "chainpad-listmap": "^0.6.0",
"chainpad": "^5.1.0", "chainpad": "^5.1.0",
"chainpad-netflux": "^0.7.0",
"file-saver": "1.3.1", "file-saver": "1.3.1",
"alertifyjs": "1.0.11", "alertifyjs": "1.0.11",
"scrypt-async": "1.2.0", "scrypt-async": "1.2.0",

@ -13,11 +13,12 @@ define([
'/common/outer/local-store.js', '/common/outer/local-store.js',
'/customize/messages.js', '/customize/messages.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
'/common/outer/login-block.js',
'/bower_components/tweetnacl/nacl-fast.min.js', '/bower_components/tweetnacl/nacl-fast.min.js',
'/bower_components/scrypt-async/scrypt-async.min.js', // better load speed '/bower_components/scrypt-async/scrypt-async.min.js', // better load speed
], function ($, Listmap, Crypto, Util, NetConfig, Cred, ChainPad, Realtime, Constants, UI, ], function ($, Listmap, Crypto, Util, NetConfig, Cred, ChainPad, Realtime, Constants, UI,
Feedback, LocalStore, Messages, nThen) { Feedback, LocalStore, Messages, nThen, Block) {
var Exports = { var Exports = {
Cred: Cred, Cred: Cred,
}; };
@ -42,11 +43,11 @@ define([
// 32 more for a signing key // 32 more for a signing key
var edSeed = opt.edSeed = dispense(32); var edSeed = opt.edSeed = dispense(32);
// TODO
// 32 more bytes to seed an additional signing key // 32 more bytes to seed an additional signing key
opt.blockSignSeed = dispense(32);
// TODO
// 32 more bytes for a symmetric key for block encryption // 32 more bytes for a symmetric key for block encryption
opt.blockSymmetric = dispense(32);
// derive a private key from the ed seed // derive a private key from the ed seed
var signingKeypair = Nacl.sign.keyPair.fromSeed(new Uint8Array(edSeed)); var signingKeypair = Nacl.sign.keyPair.fromSeed(new Uint8Array(edSeed));
@ -124,6 +125,14 @@ define([
// run scrypt to derive the user's keys // run scrypt to derive the user's keys
res.opt = allocateBytes(bytes); res.opt = allocateBytes(bytes);
})); }));
// TODO consider checking the block here
}).nThen(function (/* waitFor */) {
// check for blocks
Block = Block; // jshint
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
var opt = res.opt; var opt = res.opt;
// use the derived key to generate an object // use the derived key to generate an object
@ -283,7 +292,9 @@ define([
proxy[Constants.displayNameKey] = uname; proxy[Constants.displayNameKey] = uname;
} }
LocalStore.eraseTempSessionValues(); LocalStore.eraseTempSessionValues();
proceed(result); LocalStore.login(result.userHash, result.userName, function () {
setTimeout(function () { proceed(result); });
});
}); });
}); });
break; break;

@ -4,13 +4,14 @@
"version": "2.3.0", "version": "2.3.0",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"chainpad-server": "^2.0.0", "chainpad-server": "~2.1.0",
"express": "~4.16.0", "express": "~4.16.0",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"nthen": "~0.1.0", "nthen": "~0.1.0",
"pull-stream": "^3.6.1", "pull-stream": "^3.6.1",
"replify": "^1.2.0", "replify": "^1.2.0",
"saferphore": "0.0.1", "saferphore": "0.0.1",
"socket.io": "^2.1.1",
"sortify": "^1.0.4", "sortify": "^1.0.4",
"stream-to-pull-stream": "^1.7.2", "stream-to-pull-stream": "^1.7.2",
"tweetnacl": "~0.12.2", "tweetnacl": "~0.12.2",

@ -5,7 +5,7 @@ var Express = require('express');
var Http = require('http'); var Http = require('http');
var Https = require('https'); var Https = require('https');
var Fs = require('fs'); var Fs = require('fs');
var WebSocketServer = require('ws').Server; var SocketIO = require('socket.io');
var NetfluxSrv = require('./node_modules/chainpad-server/NetfluxWebsocketSrv'); var NetfluxSrv = require('./node_modules/chainpad-server/NetfluxWebsocketSrv');
var Package = require('./package.json'); var Package = require('./package.json');
var Path = require("path"); var Path = require("path");
@ -249,7 +249,10 @@ var nt = nThen(function (w) {
console.log("setting up a new websocket server"); console.log("setting up a new websocket server");
wsConfig = { port: websocketPort}; wsConfig = { port: websocketPort};
} }
var wsSrv = new WebSocketServer(wsConfig); var wsSrv = new SocketIO(httpServer, {
path: config.websocketPath || '/cryptpad_websocket'
});
Storage.create(config, function (store) { Storage.create(config, function (store) {
NetfluxSrv.run(store, wsSrv, config, rpc); NetfluxSrv.run(store, wsSrv, config, rpc);
}); });

Loading…
Cancel
Save