clientside implementation of block signing and encryption

This commit is contained in:
ansuz
2018-06-19 16:38:49 +02:00
parent 0365092aaf
commit 577dea4c75
6 changed files with 115 additions and 8 deletions

12
rpc.js
View File

@@ -1342,7 +1342,6 @@ var validateLoginBlock = function (Env, publicKey, signature, block, cb) {
try {
u8_block = Nacl.util.decodeBase64(block);
} catch (e) {
// TODO print to console
return void cb('E_INVALID_BLOCK');
}
@@ -1432,8 +1431,6 @@ var writeLoginBlock = function (Env, msg, cb) {
*/
var removeLoginBlock = function (Env, msg, cb) {
console.log(msg); // XXX
var publicKey = msg[0];
var signature = msg[1];
var block = Nacl.util.decodeUTF8('DELETE_BLOCK'); // clients and the server will have to agree on this constant
@@ -1854,9 +1851,12 @@ RPC.create = function (
Respond(e);
});
case 'WRITE_LOGIN_BLOCK':
return void writeLoginBlock(Env, msg, function (e) {
// TODO handle response
e = e;
return void writeLoginBlock(Env, msg[1], function (e) {
if (e) {
WARN(e, 'WRITE_LOGIN_BLOCK');
return void Respond(e);
}
Respond(e);
});
case 'REMOVE_LOGIN_BLOCK':
return void removeLoginBlock(Env, msg, function (e) {