homebridge-tsvesync 1.0.97 → 1.0.98

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.98 (2025-08-17)
4
+
5
+ ### Fixed
6
+ - **Authentication Stability**: Updated to tsvesync v1.0.98 with enhanced authentication flow fixes
7
+ - Resolved bizToken handling issues in VeSync authentication requests
8
+ - Improved reliability of new two-step authentication flow with better error handling
9
+ - Enhanced terminalId generation consistency across authentication steps
10
+ - Fixed authentication payload structure to better match VeSync API requirements
11
+ - **Testing Infrastructure**: Updated authentication testing script for better reliability
12
+ - Enhanced test script to properly handle null bizToken scenarios
13
+ - Improved authentication flow validation and error reporting
14
+
3
15
  ## 1.0.97 (2025-08-16)
4
16
 
5
17
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-tsvesync",
3
- "version": "1.0.97",
3
+ "version": "1.0.98",
4
4
  "description": "Homebridge plugin for VeSync devices including Levoit air purifiers, humidifiers, and Etekcity smart outlets",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -98,7 +98,7 @@
98
98
  "axios": "^1.6.5",
99
99
  "dotenv": "^16.3.1",
100
100
  "js-yaml": "^4.1.0",
101
- "tsvesync": "1.0.97"
101
+ "tsvesync": "1.0.98"
102
102
  },
103
103
  "devDependencies": {
104
104
  "@types/jest": "^29.5.11",
@@ -308,7 +308,18 @@ test_new_authentication() {
308
308
 
309
309
  local timestamp2=$(date +%s)
310
310
  local biz_token=$(extract_json_value "$auth_response" "result.bizToken")
311
- local token_payload="{\"method\":\"loginByAuthorizeCode4Vesync\",\"authorizeCode\":\"$authorize_code\",\"acceptLanguage\":\"en\",\"accountID\":\"\",\"clientInfo\":\"SM N9005\",\"clientType\":\"vesyncApp\",\"clientVersion\":\"VeSync 5.6.60\",\"debugMode\":false,\"emailSubscriptions\":false,\"osInfo\":\"Android\",\"terminalId\":\"$TERMINAL_ID\",\"timeZone\":\"America/New_York\",\"token\":\"\",\"bizToken\":\"$biz_token\",\"regionChange\":\"\",\"userCountryCode\":\"$region\",\"traceId\":\"APP${APP_ID}${timestamp2}\"}"
311
+
312
+ # Build token payload - omit bizToken if null/empty
313
+ local token_payload="{\"method\":\"loginByAuthorizeCode4Vesync\",\"authorizeCode\":\"$authorize_code\",\"acceptLanguage\":\"en\",\"clientInfo\":\"SM N9005\",\"clientType\":\"vesyncApp\",\"clientVersion\":\"VeSync 5.6.60\",\"debugMode\":false,\"emailSubscriptions\":false,\"osInfo\":\"Android\",\"terminalId\":\"$TERMINAL_ID\",\"timeZone\":\"America/New_York\",\"userCountryCode\":\"$region\",\"traceId\":\"APP${APP_ID}${timestamp2}\"}"
314
+
315
+ # Only add bizToken if it exists and is not "null"
316
+ if [[ -n "$biz_token" && "$biz_token" != "null" ]]; then
317
+ # Insert bizToken before userCountryCode
318
+ token_payload="${token_payload/\"userCountryCode\"/\"bizToken\":\"$biz_token\",\"userCountryCode\"}"
319
+ fi
320
+
321
+ log "DEBUG" "Token exchange payload: $token_payload"
322
+ log "DEBUG" "Token exchange endpoint: $base_url/user/api/accountManage/v1/loginByAuthorizeCode4Vesync"
312
323
 
313
324
  local token_response=$(curl -s --connect-timeout $DEFAULT_TIMEOUT --max-time $DEFAULT_TIMEOUT \
314
325
  -X POST \