diff --git a/README.md b/README.md index 5aee862..b3e67eb 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ adapters can be used together in order to compose complex functionality on top o There are currently 2 adapters available: * `FileSystem.adapters.Compression(provider)` - a compression adapter that uses [Zlib](https://github.com/imaya/zlib.js) -* `FileSystem.adapters.Encryption(passphrase, provider)` - an encryption adapter that uses [AES encryption](http://code.google.com/p/crypto-js/#AES) +* `FileSystem.adapters.Encryption(provider, passphrase)` - an encryption adapter that uses [AES encryption](http://code.google.com/p/crypto-js/#AES) ```javascript var FileSystem = Filer.FileSystem; @@ -180,7 +180,7 @@ var adapters = FileSystem.adapters; // Create a WebSQL-based, Encrypted, Compressed File System by // composing a provider and adatpers. var webSQLProvider = new providers.WebSQL(); -var encryptionAdatper = new adapters.Encryption('super-secret-passphrase', webSQLProvider); +var encryptionAdatper = new adapters.Encryption(webSQLProvider, 'super-secret-passphrase'); var compressionAdatper = new adatpers.Compression(encryptionAdapter); var fs = new FileSystem({ provider: compressionAdapter }); ``` diff --git a/src/adapters/crypto.js b/src/adapters/crypto.js index f0bd3f6..f8f1bd3 100644 --- a/src/adapters/crypto.js +++ b/src/adapters/crypto.js @@ -70,7 +70,7 @@ define(function(require) { // It is up to the app using this wrapper how the passphrase is acquired, probably by // prompting the user to enter it when the file system is being opened. - function CryptoAdapter(passphrase, provider) { + function CryptoAdapter(provider, passphrase) { this.provider = provider; // Cache cipher algorithm we'll use in encrypt/decrypt diff --git a/tests/spec/adapters/adapters.general.spec.js b/tests/spec/adapters/adapters.general.spec.js index 068457f..8f23a1c 100644 --- a/tests/spec/adapters/adapters.general.spec.js +++ b/tests/spec/adapters/adapters.general.spec.js @@ -156,7 +156,7 @@ define(["Filer", "util"], function(Filer, util) { // Encryption buildTestsFor('Encryption', function buildAdapter(provider) { var passphrase = '' + Date.now(); - return new Filer.FileSystem.adapters.Encryption(passphrase, provider); + return new Filer.FileSystem.adapters.Encryption(provider, passphrase); }); // Compression @@ -168,7 +168,7 @@ define(["Filer", "util"], function(Filer, util) { buildTestsFor('Encryption+Compression', function buildAdapter(provider) { var passphrase = '' + Date.now(); var compression = new Filer.FileSystem.adapters.Compression(provider); - var encryptionWithCompression = new Filer.FileSystem.adapters.Encryption(passphrase, compression); + var encryptionWithCompression = new Filer.FileSystem.adapters.Encryption(compression, passphrase); return encryptionWithCompression; });