added comments for fraudulent checksum test case

This commit is contained in:
Abhinav Adduri 2017-07-13 12:14:27 -07:00
parent 6379a360fe
commit b07671719c

View File

@ -273,9 +273,9 @@ describe('File Receiver', function() {
}) })
}) })
it('Should catch tampered checksums', function(done) { it('Should catch fraudulent checksums', function(done) {
// use the secret key and file hash of the previous file to encrypt, // Use the secret key and file hash of the previous file to encrypt,
// which has a different hash than this one (different strings) // which has a different hash than this one (different strings).
const newFile = new FakeFile('hello_world.txt', const newFile = new FakeFile('hello_world.txt',
['This is some data, with a changed hash.']) ['This is some data, with a changed hash.'])
const readRaw = new FileReader(); const readRaw = new FileReader();
@ -297,6 +297,8 @@ describe('File Receiver', function() {
['encrypt', 'decrypt'] ['encrypt', 'decrypt']
) )
.then(key => { .then(key => {
// The file hash used here is the hash of the fake
// file from the previous test; it's a phony checksum.
return window.crypto.subtle.encrypt( return window.crypto.subtle.encrypt(
{ {
name: 'AES-GCM', name: 'AES-GCM',