test: verify lingxing track key vector

This commit is contained in:
2026-09-22 13:33:43 +08:00
parent ab68334af3
commit 2813be3581
2 changed files with 24 additions and 3 deletions
@@ -0,0 +1,18 @@
package com.baiyue.firstleg.lingxing;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
class LingxingTrackKeyVectorTest {
@Test
void matchesNodeTrackKeyV2VectorWhenSecretIsProvided() {
String secret = System.getenv("LINGXING_TRACK_KEY_V2_SECRET_BASE64");
assumeTrue(secret != null && !secret.isBlank(),
"Set LINGXING_TRACK_KEY_V2_SECRET_BASE64 to run the protected vector test");
String body = "{\"businessType\":\"oms\",\"deviceFingerprint\":\"12345678\",\"deviceInfo\":\"UA | 1920x1080 | Asia/Shanghai\",\"loginAccount\":\"demo\",\"loginFlowId\":\"00112233445566778899aabbccddeeff\",\"password\":\"secret\"}";
assertThat(LingxingDirectClient.buildTrackKey("POST", body, secret))
.isEqualTo("v2:IbVx50WEXAxeGsc/66LjqC0WSxT2ZF0K4V4JYU/LkYw=");
}
}