aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Solya <csaba.solya@gmail.com>2018-02-23 18:03:53 +0800
committerCsaba Solya <csaba.solya@gmail.com>2018-02-23 18:03:53 +0800
commit8292dabed56b858fa2ccec7497627f5e5aa65181 (patch)
tree4ce3e9fc262e44ccd8e70abc120394fbeeedaccc
parentcd05d77c3fd9fe8e49d38b43728ff90b72b1ca9d (diff)
downloadtangerine-wallet-browser-8292dabed56b858fa2ccec7497627f5e5aa65181.tar
tangerine-wallet-browser-8292dabed56b858fa2ccec7497627f5e5aa65181.tar.gz
tangerine-wallet-browser-8292dabed56b858fa2ccec7497627f5e5aa65181.tar.bz2
tangerine-wallet-browser-8292dabed56b858fa2ccec7497627f5e5aa65181.tar.lz
tangerine-wallet-browser-8292dabed56b858fa2ccec7497627f5e5aa65181.tar.xz
tangerine-wallet-browser-8292dabed56b858fa2ccec7497627f5e5aa65181.tar.zst
tangerine-wallet-browser-8292dabed56b858fa2ccec7497627f5e5aa65181.zip
add negative decrypt test
-rw-r--r--test/unit/edge-encryptor-test.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/edge-encryptor-test.js b/test/unit/edge-encryptor-test.js
index ef733a494..1dad4b91e 100644
--- a/test/unit/edge-encryptor-test.js
+++ b/test/unit/edge-encryptor-test.js
@@ -76,5 +76,25 @@ describe('EdgeEncryptor', function () {
done(err)
})
})
+
+ it('cannot decrypt the encrypted data with wrong password.', function (done) {
+
+ edgeEncryptor.encrypt(password, data)
+ .then(function (encryptedData) {
+ edgeEncryptor.decrypt('wrong password', encryptedData)
+ .then(function (decryptedData) {
+ assert.fail('could decrypt with wrong password')
+ done()
+ })
+ .catch(function (err) {
+ assert.ok(err instanceof Error)
+ assert.equal(err.message, 'Incorrect password')
+ done()
+ })
+ })
+ .catch(function (err) {
+ done(err)
+ })
+ })
})
})