From bbd762a1fe3fd582b7a620b4f792b1de162a5aee Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 1 Sep 2014 23:49:13 -0300 Subject: [PATCH] rm encrypted to storage --- copay.js | 2 +- .../{storage/Encrypted.js => Storage.js} | 0 js/models/core/WalletFactory.js | 7 ++-- test/{test.Encrypted.js => test.Storage.js} | 32 +++++++++---------- util/build.js | 1 - 5 files changed, 21 insertions(+), 21 deletions(-) rename js/models/{storage/Encrypted.js => Storage.js} (100%) rename test/{test.Encrypted.js => test.Storage.js} (92%) diff --git a/copay.js b/copay.js index 2f0107816..6bba1b613 100644 --- a/copay.js +++ b/copay.js @@ -11,7 +11,7 @@ module.exports.HDParams = require('./js/models/core/HDParams'); // components var Async = module.exports.Async = require('./js/models/network/Async'); var Insight = module.exports.Insight = require('./js/models/blockchain/Insight'); -var StorageEncrypted = module.exports.StorageEncrypted = require('./js/models/storage/Encrypted'); +var Storage = module.exports.Storage = require('./js/models/Storage'); module.exports.WalletFactory = require('./js/models/core/WalletFactory'); module.exports.Wallet = require('./js/models/core/Wallet'); diff --git a/js/models/storage/Encrypted.js b/js/models/Storage.js similarity index 100% rename from js/models/storage/Encrypted.js rename to js/models/Storage.js diff --git a/js/models/core/WalletFactory.js b/js/models/core/WalletFactory.js index ef88b6a52..2efea81de 100644 --- a/js/models/core/WalletFactory.js +++ b/js/models/core/WalletFactory.js @@ -6,10 +6,11 @@ var PrivateKey = require('./PrivateKey'); var Wallet = require('./Wallet'); var _ = require('underscore'); var log = require('../../log'); +var PluginManager = require('./PluginManager'); var Async = module.exports.Async = require('../network/Async'); var Insight = module.exports.Insight = require('../blockchain/Insight'); -var StorageEncrypted = module.exports.StorageEncrypted = require('../storage/Encrypted'); var preconditions = require('preconditions').singleton(); +var Storage = module.exports.Storage = require('../Storage'); /** * @desc @@ -36,9 +37,9 @@ function WalletFactory(config, version) { var self = this; config = config || {}; - this.pluginManager = new copay.PluginManager(config); + this.pluginManager = new PluginManager(config); - this.Storage = config.Storage || StorageEncrypted; + this.Storage = config.Storage || Storage; this.Network = config.Network || Async; this.Blockchain = config.Blockchain || Insight; this.storage = new this.Storage({storage: this.pluginManager.get('STORAGE')}); diff --git a/test/test.Encrypted.js b/test/test.Storage.js similarity index 92% rename from test/test.Encrypted.js rename to test/test.Storage.js index bfe2fcd18..0ad668bff 100644 --- a/test/test.Encrypted.js +++ b/test/test.Storage.js @@ -3,7 +3,7 @@ var chai = chai || require('chai'); var should = chai.should(); var is_browser = typeof process == 'undefined' || typeof process.versions === 'undefined'; var copay = copay || require('../copay'); -var Encrypted = copay.StorageEncrypted; +var Storage = copay.Storage; var fakeWallet = 'fake-wallet-id'; var timeStamp = Date.now(); @@ -11,22 +11,22 @@ var localMock = require('./mocks/FakeLocalStorage'); var sessionMock = require('./mocks/FakeLocalStorage'); -describe('Storage/Encrypted model', function() { - var s = new Encrypted({ +describe('Storage model', function() { + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, }); s._setPassphrase('mysupercoolpassword'); it('should create an instance', function() { - var s2 = new Encrypted({ + var s2 = new Storage({ storage: localMock, sessionStorage: sessionMock, }); should.exist(s2); }); it('should fail when encrypting without a password', function() { - var s2 = new Encrypted({ + var s2 = new Storage({ storage: localMock, sessionStorage: sessionMock, }); @@ -71,7 +71,7 @@ describe('Storage/Encrypted model', function() { describe('#export', function() { it('should export the encrypted wallet', function() { - var storage = new Encrypted({ + var storage = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password', @@ -89,7 +89,7 @@ describe('Storage/Encrypted model', function() { describe('#remove', function() { it('should remove an item', function() { - var s = new Encrypted({ + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password' @@ -105,7 +105,7 @@ describe('Storage/Encrypted model', function() { describe('#getWalletIds', function() { it('should get wallet ids', function() { - var s = new Encrypted({ + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password' @@ -118,7 +118,7 @@ describe('Storage/Encrypted model', function() { describe('#getName #setName', function() { it('should get/set names', function() { - var s = new Encrypted({ + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password' @@ -130,7 +130,7 @@ describe('Storage/Encrypted model', function() { describe('#getLastOpened #setLastOpened', function() { it('should get/set names', function() { - var s = new Encrypted({ + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password' @@ -143,7 +143,7 @@ describe('Storage/Encrypted model', function() { if (is_browser) { describe('#getSessionId', function() { it('should get SessionId', function() { - var s = new Encrypted({ + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password' @@ -158,7 +158,7 @@ describe('Storage/Encrypted model', function() { describe('#getWallets', function() { it('should retreive wallets from storage', function() { - var s = new Encrypted({ + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password' @@ -178,7 +178,7 @@ describe('Storage/Encrypted model', function() { }); describe('#deleteWallet', function() { it('should delete a wallet', function() { - var s = new Encrypted({ + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password' @@ -198,7 +198,7 @@ describe('Storage/Encrypted model', function() { describe('#setFromObj', function() { it('set localstorage from an object', function() { - var s = new Encrypted({ + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password' @@ -218,7 +218,7 @@ describe('Storage/Encrypted model', function() { describe('#globals', function() { it('should set, get and remove keys', function() { - var s = new Encrypted({ + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password' @@ -237,7 +237,7 @@ describe('Storage/Encrypted model', function() { describe('session storage', function() { it('should get a session ID', function() { - var s = new Encrypted({ + var s = new Storage({ storage: localMock, sessionStorage: sessionMock, password: 'password' diff --git a/util/build.js b/util/build.js index 080c1e47e..2c078f458 100644 --- a/util/build.js +++ b/util/build.js @@ -94,7 +94,6 @@ var createBundle = function(opts) { b.require('./plugins/LocalStorage', { expose: '../plugins/LocalStorage' }); - } b.require('./config', {