hoodie-plugin-store-crypto
Advanced tools
Comparing version 3.0.0 to 3.0.1
'use strict' | ||
var pbkdf2 = require('native-crypto/pbkdf2') | ||
var pbkdf2 = require('pbkdf2') | ||
var Promise = require('lie') | ||
var randomBytes = require('randombytes') | ||
@@ -13,10 +14,16 @@ | ||
return pbkdf2(password, Buffer.from(salt, 'hex'), iterations, 256 / 8, digest) | ||
return new Promise(function (resolve, reject) { | ||
var saltyBuffy = Buffer.from(salt, 'hex') | ||
.then(function (key) { | ||
return { | ||
key: key, | ||
salt: salt | ||
pbkdf2.pbkdf2(password, saltyBuffy, iterations, 256 / 8, digest, function (err, key) { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve({ | ||
key: key, | ||
salt: salt | ||
}) | ||
} | ||
}) | ||
}) | ||
} |
@@ -6,3 +6,2 @@ 'use strict' | ||
var uuid = require('uuid').v4 | ||
var keys = require('lodash/keys') | ||
var includes = require('lodash/includes') | ||
@@ -32,3 +31,3 @@ | ||
keys(doc).forEach(function (key) { | ||
Object.getOwnPropertyNames(doc).forEach(function (key) { | ||
if (doc[key] === undefined || key === '__cy_ignore') return | ||
@@ -35,0 +34,0 @@ |
@@ -43,3 +43,3 @@ 'use strict' | ||
if (obj[0].status !== 404 && !obj[0]._deleted) { | ||
throw pouchdbErrors.UNAUTHORIZED | ||
throw pouchdbErrors.createError(pouchdbErrors.UNAUTHORIZED, 'salt doc already exist!') | ||
} | ||
@@ -56,5 +56,8 @@ | ||
.then(function (obj) { | ||
// // check if a salt doc already exists on remoteDb | ||
// check if a salt doc already exists on remoteDb | ||
if (obj.length > 0 && (obj[0].status !== 404 && !obj[0]._deleted)) { | ||
throw pouchdbErrors.UNAUTHORIZED | ||
throw pouchdbErrors.createError( | ||
pouchdbErrors.UNAUTHORIZED, | ||
'salt doc already exist on the remote DB!' | ||
) | ||
} | ||
@@ -61,0 +64,0 @@ |
@@ -106,4 +106,9 @@ 'use strict' | ||
.catch(function () { | ||
throw pouchdbErrors.UNAUTHORIZED | ||
.catch(function (err) { | ||
// attach PouchDBs UNAUTHORIZED error to the error | ||
err.status = pouchdbErrors.UNAUTHORIZED.status | ||
err.name = pouchdbErrors.UNAUTHORIZED.name | ||
err.reason = pouchdbErrors.UNAUTHORIZED.reason | ||
err.error = true | ||
throw err | ||
}) | ||
@@ -110,0 +115,0 @@ }) |
{ | ||
"name": "hoodie-plugin-store-crypto", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "End-to-end crypto plugin for the Hoodie client store.", | ||
@@ -49,11 +49,11 @@ "main": "index.js", | ||
"devDependencies": { | ||
"hoodie": "^28.2.9", | ||
"hoodie": "^28.2.10", | ||
"pouchdb-adapter-memory": "^7.1.1", | ||
"pouchdb-core": "^7.1.1", | ||
"pouchdb-replication": "^7.1.1", | ||
"semantic-release": "^15.13.28", | ||
"semantic-release": "^15.13.31", | ||
"standard": "^14.3.1", | ||
"tap-spec": "^5.0.0", | ||
"tape": "^4.11.0", | ||
"textlint": "^11.4.0", | ||
"textlint": "^11.5.0", | ||
"textlint-rule-alex": "^1.3.1", | ||
@@ -70,2 +70,3 @@ "textlint-rule-common-misspellings": "^1.0.1", | ||
"native-crypto": "^1.8.1", | ||
"pbkdf2": "^3.0.17", | ||
"pouchdb-errors": "^7.1.1", | ||
@@ -72,0 +73,0 @@ "randombytes": "^2.1.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87619
1810
8
+ Addedpbkdf2@^3.0.17