Standardized encryption adapter parameters. Fixes issue96
This commit is contained in:
parent
073fe45223
commit
e5779df03a
|
@ -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 });
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue