leaf-connect 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leaf-connect",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Node.js client library for the Nissan Leaf API",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -23,7 +23,8 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "axios": "1.4.0"
26
+ "axios": "1.4.0",
27
+ "blowfish-node": "1.1.4"
27
28
  },
28
29
  "devDependencies": {
29
30
  "standard": "17.1.0"
@@ -1,8 +1,6 @@
1
- const crypto = require('crypto')
1
+ const Blowfish = require('blowfish-node')
2
2
 
3
3
  module.exports = (password, passwordEncryptionKey) => {
4
- const cipher = crypto.createCipheriv('bf-ecb', Buffer.from(passwordEncryptionKey), Buffer.from(''))
5
- let encrypted = cipher.update(password, 'utf8', 'base64')
6
- encrypted += cipher.final('base64')
7
- return encrypted
4
+ const bf = new Blowfish(passwordEncryptionKey, Blowfish.MODE.ECB);
5
+ return bf.encodeToBase64(password)
8
6
  }