From 5739c3d973f9194c784254c0f18aa3f880a7dcd2 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 4 May 2017 12:20:38 +0200 Subject: [PATCH] blow up if you ever run out of nonce-space --- www/file/file-crypto.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/file/file-crypto.js b/www/file/file-crypto.js index 4af79aa04..608b3bb6e 100644 --- a/www/file/file-crypto.js +++ b/www/file/file-crypto.js @@ -33,7 +33,9 @@ define([ // you don't need to worry about this running out. // you'd need a REAAAALLY big file - if (l === 0) { return true; } + if (l === 0) { + throw new Error('E_NONCE_TOO_LARGE'); + } } }; @@ -70,7 +72,6 @@ define([ // decrypt the chunk var plaintext = Nacl.secretbox.open(box, nonce, key); - // TODO handle nonce-too-large-error increment(nonce); return plaintext; };