diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-12-20 13:55:02 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-12-20 13:55:02 +0800 |
commit | 26f1e6cbd2af9d6bb0c58871635466c459cc87d8 (patch) | |
tree | 929b446d53ae811e7105aaa7ceb6e4d18579fcd6 /test | |
parent | ead8329877c5441f32ab389adb41689086a38608 (diff) | |
download | tangerine-wallet-browser-26f1e6cbd2af9d6bb0c58871635466c459cc87d8.tar tangerine-wallet-browser-26f1e6cbd2af9d6bb0c58871635466c459cc87d8.tar.gz tangerine-wallet-browser-26f1e6cbd2af9d6bb0c58871635466c459cc87d8.tar.bz2 tangerine-wallet-browser-26f1e6cbd2af9d6bb0c58871635466c459cc87d8.tar.lz tangerine-wallet-browser-26f1e6cbd2af9d6bb0c58871635466c459cc87d8.tar.xz tangerine-wallet-browser-26f1e6cbd2af9d6bb0c58871635466c459cc87d8.tar.zst tangerine-wallet-browser-26f1e6cbd2af9d6bb0c58871635466c459cc87d8.zip |
Remove encryptor in favor of external browser-passworder
I broke out the encryptor lib into its own module on npm called browser-passworder.
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/lib/encryptor-test.js | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/test/integration/lib/encryptor-test.js b/test/integration/lib/encryptor-test.js deleted file mode 100644 index 897d22740..000000000 --- a/test/integration/lib/encryptor-test.js +++ /dev/null @@ -1,71 +0,0 @@ -var encryptor = require('../../../app/scripts/lib/encryptor') - -QUnit.module('encryptor') - -QUnit.test('encryptor:serializeBufferForStorage', function (assert) { - assert.expect(1) - var buf = new Buffer(2) - buf[0] = 16 - buf[1] = 1 - - var output = encryptor.serializeBufferForStorage(buf) - - var expect = '0x1001' - assert.equal(expect, output) -}) - -QUnit.test('encryptor:serializeBufferFromStorage', function (assert) { - assert.expect(2) - var input = '0x1001' - var output = encryptor.serializeBufferFromStorage(input) - - assert.equal(output[0], 16) - assert.equal(output[1], 1) -}) - -QUnit.test('encryptor:encrypt & decrypt', function(assert) { - var done = assert.async(); - var password, data, encrypted - - password = 'a sample passw0rd' - data = { foo: 'data to encrypt' } - - encryptor.encrypt(password, data) - .then(function(encryptedStr) { - assert.equal(typeof encryptedStr, 'string', 'returns a string') - return encryptor.decrypt(password, encryptedStr) - }) - .then(function (decryptedObj) { - assert.deepEqual(decryptedObj, data, 'decrypted what was encrypted') - done() - }) - .catch(function(reason) { - assert.ifError(reason, 'threw an error') - done(reason) - }) - -}) - -QUnit.test('encryptor:encrypt & decrypt with wrong password', function(assert) { - var done = assert.async(); - var password, data, encrypted, wrongPassword - - password = 'a sample passw0rd' - wrongPassword = 'a wrong password' - data = { foo: 'data to encrypt' } - - encryptor.encrypt(password, data) - .then(function(encryptedStr) { - assert.equal(typeof encryptedStr, 'string', 'returns a string') - return encryptor.decrypt(wrongPassword, encryptedStr) - }) - .then(function (decryptedObj) { - assert.equal(!decryptedObj, true, 'Wrong password should not decrypt') - done() - }) - .catch(function(reason) { - done() - }) -}) - - |