[6.2.9] extends the crtfile

This commit is contained in:
EmArrow
2024-01-23 18:22:07 +08:00
parent 79c208e87e
commit b5431c3685
6 changed files with 36 additions and 8 deletions

View File

@@ -228,7 +228,7 @@ ext {
log_runtime : "com.mogo.eagle.core.log.record:runtime:1.0.30",
// 安全证书
passport_secret : "com.zhidaoauto:sdk-java:1.0.5-SNAPSHOT",
passport_secret : "com.zhidaoauto:sdk-java:1.0.6-SNAPSHOT",
// 主线程卡顿监测
block_detector : "com.mogo.eagle.core.block:runtime:10.90.60",

View File

@@ -280,9 +280,9 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
linkChainLog = CHAIN_TYPE_STATUS,
linkCode = CHAIN_SOURCE_CLOUD,
nodeAliasCode = CHAIN_CODE_CLOUD_PASSPORT_AUTH_OK,
paramIndexes = [0]
paramIndexes = [0,1]
)
override fun onSuccess(securityKey: String) {
override fun onSuccess(securityKey: String, rootKey: String) {
CallerLogger.d(
"$M_MAIN$TAG",
"onSuccess securityKey:$securityKey , thread:${Thread.currentThread().name}"
@@ -295,6 +295,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
)
SharedPrefsMgr.getInstance()
.putBoolean("securityKey-${DebugConfig.getNetMode()}", true)
CallerCloudListenerManager.invokeCloudCrtFile(securityKey, rootKey)
}
@ChainLog(

View File

@@ -2,7 +2,7 @@ package com.mogo.eagle.core.function.startup.stageone.secret;
public interface IPassportSecret {
void onSuccess(String secretKey);
void onSuccess(String secretKey, String rootKey);
void onFailed(int errorCode, String errorMsg);
}

View File

@@ -5,6 +5,7 @@ import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import java.io.UnsupportedEncodingException;
import java.util.List;
import constant.ErrorCode;
import domain.Passport;
@@ -42,14 +43,15 @@ public class PassPortSecret {
secretCB.onFailed(r.getCode(), r.getMsg());
}
Passport passport = (Passport) r.getData();
domain.R<String> res = passportService.deviceActive(passport);
domain.R<List<String>> res = passportService.deviceActive(passport);
if (res.getCode() != ErrorCode.OK.getCode()) {
secretCB.onFailed(res.getCode(), res.getMsg());
} else {
String secretKey = res.getData();
List<String> secretKey = res.getData();
try {
String result = new String(Base64.encode(secretKey.getBytes("utf-8"), Base64.NO_WRAP), "utf-8");
secretCB.onSuccess(result);
String result = new String(Base64.encode(secretKey.get(0).getBytes("utf-8"), Base64.NO_WRAP), "utf-8");
String root = new String(Base64.encode(secretKey.get(1).getBytes("utf-8"), Base64.NO_WRAP), "utf-8");
secretCB.onSuccess(result, root);
} catch (UnsupportedEncodingException e) {
secretCB.onFailed(5000, "url encode error :" + secretKey);
}

View File

@@ -4,6 +4,8 @@ import com.mogo.eagle.core.data.v2x.V2XEvent
interface IMoGoCloudListener{
fun authCrtFile(device:String, root:String)
fun tokenGot(token: String, sn: String){}
/**

View File

@@ -12,6 +12,12 @@ object CallerCloudListenerManager : CallerBase<IMoGoCloudListener>() {
@Volatile
private var sn: String? = null
@Volatile
private var deviceCrtFile: String? = null
@Volatile
private var rootCrtFile: String? = null
override fun doSomeAfterAddListener(tag: String, listener: IMoGoCloudListener) {
super.doSomeAfterAddListener(tag, listener)
if (!token.isNullOrEmpty() && !sn.isNullOrEmpty()) {
@@ -19,6 +25,23 @@ object CallerCloudListenerManager : CallerBase<IMoGoCloudListener>() {
}
}
fun getRootCrtF(): String? {
return rootCrtFile
}
fun getDeviceCrtF(): String? {
return deviceCrtFile
}
fun invokeCloudCrtFile(deviceCrtFile: String, rootCrtFile: String) {
this.deviceCrtFile = deviceCrtFile
this.rootCrtFile = rootCrtFile
M_LISTENERS.forEach {
val listener = it.value
listener.authCrtFile(deviceCrtFile, rootCrtFile)
}
}
/**
* 分发获取到的设备sn
*/