From 8f227d8c0e32960951b787354d13a4534edfe07f Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Mon, 9 Mar 2020 08:36:20 +0100 Subject: [PATCH] add tests for signature without timeout --- test/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/index.js b/test/index.js index 2f0985f..4d5c8bb 100644 --- a/test/index.js +++ b/test/index.js @@ -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');