mongodb-client-encryption
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,2 +5,6 @@ # Change Log | ||
## [1.0.1](https://github.com/mongodb/libmongocrypt/compare/node-v1.0.0...1.0.1) (2019-12-31) | ||
# [1.0.0](https://github.com/mongodb/libmongocrypt/compare/node-v1.0.0-rc3.0...1.0.0) (2019-12-10) | ||
@@ -7,0 +11,0 @@ |
@@ -94,3 +94,3 @@ 'use strict'; | ||
this._client = client; | ||
this._bson = client.topology.bson; | ||
this._bson = options.bson || client.topology.bson; | ||
this._mongocryptdManager = new MongocryptdManager(options.extraOptions); | ||
@@ -104,2 +104,4 @@ this._mongocryptdClient = new MongoClient(this._mongocryptdManager.uri, { | ||
this._keyVaultClient = options.keyVaultClient || client; | ||
this._bypassEncryption = | ||
typeof options.bypassAutoEncryption === 'boolean' ? options.bypassAutoEncryption : false; | ||
@@ -181,2 +183,8 @@ const mongoCryptOptions = {}; | ||
// If `bypassAutoEncryption` has been specified, don't encrypt | ||
if (this._bypassEncryption) { | ||
callback(undefined, cmd); | ||
return; | ||
} | ||
const bson = this._bson; | ||
@@ -198,3 +206,3 @@ const commandBuffer = Buffer.isBuffer(cmd) ? cmd : bson.serialize(cmd, options); | ||
const stateMachine = new StateMachine(options); | ||
const stateMachine = new StateMachine(Object.assign({ bson }, options)); | ||
stateMachine.execute(this, context, callback); | ||
@@ -230,3 +238,3 @@ } | ||
const stateMachine = new StateMachine(options); | ||
const stateMachine = new StateMachine(Object.assign({ bson }, options)); | ||
stateMachine.execute(this, context, callback); | ||
@@ -233,0 +241,0 @@ } |
@@ -95,3 +95,3 @@ 'use strict'; | ||
this._client = client; | ||
this._bson = client.topology.bson; | ||
this._bson = options.bson || client.topology.bson; | ||
@@ -135,3 +135,3 @@ if (options.keyVaultNamespace == null) { | ||
* // Using callbacks to create a local key | ||
* clientEncrypion.createDataKey('local', (err, dataKey) => { | ||
* clientEncryption.createDataKey('local', (err, dataKey) => { | ||
* if (err) { | ||
@@ -169,6 +169,7 @@ * // This means creating the key failed. | ||
if (typeof options === 'function') (callback = options), (options = {}); | ||
options = sanitizeDataKeyOptions(this._bson, options); | ||
const bson = this._bson; | ||
options = sanitizeDataKeyOptions(bson, options); | ||
const context = this._mongoCrypt.makeDataKeyContext(provider, options); | ||
const stateMachine = new StateMachine(); | ||
const stateMachine = new StateMachine({ bson }); | ||
@@ -265,3 +266,3 @@ return promiseOrCallback(callback, cb => { | ||
const stateMachine = new StateMachine(); | ||
const stateMachine = new StateMachine({ bson }); | ||
const context = this._mongoCrypt.makeExplicitEncryptionContext(valueBuffer, contextOptions); | ||
@@ -311,3 +312,3 @@ | ||
const stateMachine = new StateMachine(); | ||
const stateMachine = new StateMachine({ bson }); | ||
@@ -314,0 +315,0 @@ return promiseOrCallback(callback, cb => { |
@@ -73,2 +73,3 @@ 'use strict'; | ||
this.options = options || {}; | ||
this.bson = options.bson; | ||
} | ||
@@ -85,3 +86,3 @@ | ||
execute(autoEncrypter, context, callback) { | ||
const bson = autoEncrypter._bson; | ||
const bson = this.bson; | ||
const client = autoEncrypter._client; | ||
@@ -265,3 +266,3 @@ const keyVaultNamespace = autoEncrypter._keyVaultNamespace; | ||
fetchCollectionInfo(client, ns, filter, callback) { | ||
const bson = client.topology.bson; | ||
const bson = this.bson; | ||
const dbName = databaseNamespace(ns); | ||
@@ -294,3 +295,3 @@ | ||
markCommand(client, ns, command, callback) { | ||
const bson = client.topology.bson; | ||
const bson = this.bson; | ||
const dbName = databaseNamespace(ns); | ||
@@ -320,3 +321,3 @@ const rawCommand = bson.deserialize(command, { promoteLongs: false, promoteValues: false }); | ||
fetchKeys(client, keyVaultNamespace, filter, callback) { | ||
const bson = client.topology.bson; | ||
const bson = this.bson; | ||
const dbName = databaseNamespace(keyVaultNamespace); | ||
@@ -323,0 +324,0 @@ const collectionName = collectionNamespace(keyVaultNamespace); |
{ | ||
"name": "mongodb-client-encryption", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Official client encryption module for the MongoDB Node.js driver", | ||
@@ -48,7 +48,9 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"mongodb": "~3.4.0" | ||
"mongodb": "^3.4.0" | ||
}, | ||
"repository": { | ||
"url": "https://github.com/mongodb/libmongocrypt" | ||
"type": "git", | ||
"url": "https://github.com/mongodb/libmongocrypt", | ||
"directory": "bindings/node" | ||
} | ||
} |
@@ -247,3 +247,3 @@ MongoDB Client Encryption | ||
// Using callbacks to create a local key | ||
clientEncrypion.createDataKey('local', (err, dataKey) => { | ||
clientEncryption.createDataKey('local', (err, dataKey) => { | ||
if (err) { | ||
@@ -250,0 +250,0 @@ // This means creating the key failed. |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
125413
1061
0