leaf-connect 1.1.4 → 1.1.5

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,8 +1,12 @@
1
1
  {
2
2
  "name": "leaf-connect",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Node.js client library for the Nissan Leaf API",
5
5
  "main": "src/index.js",
6
+ "scripts": {
7
+ "lint": "standard src/**/*.js",
8
+ "lint-fix": "standard --fix src/**/*.js"
9
+ },
6
10
  "files": [
7
11
  "src/*"
8
12
  ],
@@ -19,14 +23,9 @@
19
23
  },
20
24
  "license": "MIT",
21
25
  "dependencies": {
22
- "axios": "1.4.0",
23
- "blowfish-node": "1.1.4"
26
+ "axios": "1.4.0"
24
27
  },
25
28
  "devDependencies": {
26
29
  "standard": "17.1.0"
27
- },
28
- "scripts": {
29
- "lint": "standard src/**/*.js",
30
- "lint-fix": "standard --fix src/**/*.js"
31
30
  }
32
- }
31
+ }
package/src/index.js CHANGED
@@ -5,8 +5,12 @@ const extractData = require('./lib/extract-data')
5
5
  const retryUntilSuccess = require('./lib/retry-until-success')
6
6
  const logger = require('./lib/logger')
7
7
 
8
- const API_ENDPOINT = 'https://gdcportalgw.its-mo.com/api_v230317_NE/gdc'
8
+ const API_ENDPOINT = 'https://gdcportalgw.its-mo.com/api_v250205_NE/gdc'
9
+
9
10
  const INITIAL_APP_STR = '9s5rfKVuMrT03RtzajWNcA'
11
+ const IV = "xaX4ui2PLnwqcc74";
12
+ const PS = "H9YsaE6mr3jBEsAaLC4EJRjn9VXEtTzV";
13
+
10
14
  const RESULT_POLLING_INTERVAL = 20000
11
15
  const REGION_CODES = ['NE', 'NCI', 'NNA', 'NMA', 'NML']
12
16
 
@@ -82,7 +86,7 @@ module.exports = async ({
82
86
  RegionCode: regionCode,
83
87
  lg: locale,
84
88
  UserId: username,
85
- Password: encryptPassword(password, sessionState.baseprm)
89
+ Password: encryptPassword(password, PS, IV)
86
90
  }
87
91
  })
88
92
 
@@ -1,6 +1,12 @@
1
- const Blowfish = require('blowfish-node')
1
+ const crypto = require('crypto');
2
2
 
3
- module.exports = (password, passwordEncryptionKey) => {
4
- const bf = new Blowfish(passwordEncryptionKey, Blowfish.MODE.ECB);
5
- return bf.encodeToBase64(password)
3
+ module.exports = (password, key, iv) => {
4
+ const keyBuffer = Buffer.from(key, 'utf8');
5
+ const ivBuffer = Buffer.from(iv, 'utf8');
6
+
7
+ const cipher = crypto.createCipheriv('aes-256-cbc', keyBuffer, ivBuffer);
8
+ let encrypted = cipher.update(password, 'utf8', 'base64');
9
+ encrypted += cipher.final('base64');
10
+
11
+ return encrypted;
6
12
  }