dexie-encrypted
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -16,4 +16,5 @@ 'use strict'; | ||
const cryptoOptions = { | ||
DATA: 'DATA', | ||
const tableEncryptionOptions = { | ||
DATA: 'NON_INDEXED_FIELDS', | ||
NON_INDEXED_FIELDS: 'NON_INDEXED_FIELDS', | ||
// DATA_AND_INDICES: 'DATA_AND_INDICES', // not implemented. | ||
@@ -23,6 +24,7 @@ WHITELIST: 'WHITELIST', | ||
}; | ||
const cryptoOptions = tableEncryptionOptions; | ||
/* options example: | ||
{ | ||
table1: cryptoOptions.DATA, | ||
table1: cryptoOptions.NON_INDEXED_FIELDS, | ||
table2: { | ||
@@ -220,1 +222,2 @@ type: cryptoOptions.WHITELIST, | ||
exports.default = encrypt; | ||
exports.tableEncryptionOptions = tableEncryptionOptions; |
{ | ||
"name": "dexie-encrypted", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Encryption middleware for Dexie", | ||
"main": "dist/index.js", | ||
"license": "MIT", | ||
"files": ["dist/index.js"], | ||
"files": [ | ||
"dist/index.js" | ||
], | ||
"repository": { | ||
@@ -9,0 +11,0 @@ "type": "git", |
@@ -19,3 +19,3 @@ # Dexie-encrypted | ||
encrypt(db, symmetricKey, { | ||
friends: cryptoOptions.DATA, | ||
friends: cryptoOptions.NON_INDEXED_FIELDS, | ||
}); | ||
@@ -50,3 +50,3 @@ | ||
- `key` - a Uint8Array of length 32 that will be used for both encryption and decryption. | ||
- `config` - a configuration that determines how dexie-encrypted will encrypt the data of each table. | ||
- `config` - a table level configuration that determines how dexie-encrypted will encrypt. | ||
@@ -57,3 +57,3 @@ ## Configuration | ||
- `cryptoOptions.DATA` - all data other than indices will be encrypted. | ||
- `cryptoOptions.NON_INDEXED_FIELDS` - all data other than indices will be encrypted. | ||
- `cryptoOptions.WHITELIST` - all data other than indices and whitelisted fields will be encrypted. | ||
@@ -64,10 +64,10 @@ - `cryptoOptions.BLACKLIST` - listed fields will be encrypted. | ||
encrypt(db, symmetricKey, { | ||
tableName: cryptoOptions.DATA, | ||
tableWithWhitelist: { | ||
users: cryptoOptions.NON_INDEXED_FIELDS, | ||
friends: { | ||
type: cryptoOptions.WHITELIST, | ||
fields: ['street', 'picture'], | ||
fields: ['street', 'picture'], // note: these cannot be indices | ||
}, | ||
tableWithBlacklist: { | ||
enemies: { | ||
type: cryptoOptions.BLACKLIST, | ||
fields: ['picture'], | ||
fields: ['picture', 'isMortalEnemy'], | ||
}, | ||
@@ -74,0 +74,0 @@ }); |
14516
197