blow up if you ever run out of nonce-space

pull/1/head
ansuz 8 years ago
parent 2232518c64
commit 5739c3d973

@ -33,7 +33,9 @@ define([
// you don't need to worry about this running out. // you don't need to worry about this running out.
// you'd need a REAAAALLY big file // 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 // decrypt the chunk
var plaintext = Nacl.secretbox.open(box, nonce, key); var plaintext = Nacl.secretbox.open(box, nonce, key);
// TODO handle nonce-too-large-error
increment(nonce); increment(nonce);
return plaintext; return plaintext;
}; };

Loading…
Cancel
Save