add tests for signature without timeout

This commit is contained in:
Timo Hocker 2020-03-09 08:36:20 +01:00
parent cb9c142547
commit 8f227d8c0e

View File

@ -107,6 +107,16 @@ test ('verify_signature', (t) => {
t.deepEqual (obj, dec);
});
test ('do not fail verification if timeout unspecified', async (t) => {
const obj = { foo: 'bar' };
const str = crypto.sign_object (obj, 'baz');
await new Promise ((res) => {
setTimeout (res, 10);
});
const dec = crypto.verify_signature (str, 'baz');
t.deepEqual (obj, dec);
});
test ('reject tampered signatures', (t) => {
const obj = { foo: 'bar' };
const str = crypto.sign_object (obj, 'baz');