GET requests end-to-end encryption fix

This commit is contained in:
emad-salah 2020-01-21 11:03:11 +01:00
parent 4126fd503a
commit 86348d0728
2 changed files with 6 additions and 11 deletions

View file

@ -225,6 +225,11 @@ module.exports = async (
return res.status(401).json(error);
}
if (req.method === "GET") {
console.log("Method:", req.method);
return next();
}
console.log("Body:", req.body)
console.log("Decrypt params:", { deviceId, message: req.body.encryptionKey })
const decryptedKey = Encryption.decryptKey({ deviceId, message: req.body.encryptionKey });

View file

@ -89,16 +89,6 @@ const Encryption = {
},
authorizeDevice: ({ deviceId, publicKey }) =>
new Promise((resolve, reject) => {
if (authorizedDevices.has(deviceId)) {
const devicePublicKey = APIKeyPair.get(deviceId).publicKey
const deviceExists = {
success: true,
APIPublicKey: devicePublicKey
}
resolve(deviceExists)
return deviceExists
}
authorizedDevices.set(deviceId, publicKey)
Crypto.generateKeyPair(
'rsa',