Skip to content
Snippets Groups Projects
Commit 11740ec2 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

actually discharging key for signatures

parent c3bf3be7
No related branches found
No related tags found
No related merge requests found
......@@ -227,7 +227,7 @@ router.post(
res.status(422).json(errors);
return;
}
let key = await Key.GET_KEY(req.body.key, false);
let date = dayjs(
req.body.date,
config.get("crypto.private_key.date_format")
......@@ -235,10 +235,14 @@ router.post(
let blinded_tokens = req.body.blinded_tokens;
let signed_tokens = {};
let key = await Key.GET_KEY(req.body.key, true);
if (key.get_charge() < blinded_tokens.length) {
res.status(422).json({
message: "Invalid Key",
});
} else {
key.discharge_key(blinded_tokens.length);
await key.save();
}
// Make signing requests always the same duration to prevent timing attacks on the private key
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment