check authenticated rpc signatures in separate threads

This commit is contained in:
ansuz
2020-03-24 14:31:40 -04:00
parent 0e09c73a60
commit 40251948d4
6 changed files with 131 additions and 107 deletions

View File

@@ -175,11 +175,13 @@ var rpc = function (Env, Server, userId, data, respond) {
if (isAuthenticatedCall(command)) {
// check the signature on the message
// refuse the command if it doesn't validate
if (Core.checkSignature(Env, serialized, signature, publicKey) === true) {
return void Env.checkSignature(serialized, signature, publicKey, function (err) {
if (err) {
return void respond("INVALID_SIGNATURE_OR_PUBLIC_KEY");
}
HK.authenticateNetfluxSession(Env, userId, publicKey);
return void handleAuthenticatedMessage(Env, publicKey, msg, respond, Server);
}
return void respond("INVALID_SIGNATURE_OR_PUBLIC_KEY");
});
}
Env.Log.warn('INVALID_RPC_CALL', command);
return void respond("INVALID_RPC_CALL");