Launcher/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerRuntimeConfig.java

30 lines
1.1 KiB
Java
Raw Normal View History

package pro.gravit.launchserver.config;
2019-04-12 00:58:45 +03:00
2021-05-10 10:34:27 +03:00
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import pro.gravit.utils.helper.SecurityHelper;
2019-04-12 00:58:45 +03:00
public class LaunchServerRuntimeConfig {
2021-05-25 12:17:29 +03:00
private transient final Logger logger = LogManager.getLogger();
public String passwordEncryptKey;
2021-04-26 18:21:28 +03:00
public String runtimeEncryptKey;
public String oemUnlockKey;
public String registerApiKey;
public String clientCheckSecret;
2019-05-15 14:11:22 +03:00
public void verify() {
2021-05-10 10:34:27 +03:00
if (passwordEncryptKey == null) logger.error("[RuntimeConfig] passwordEncryptKey must not be null");
2019-10-19 19:46:04 +03:00
if (clientCheckSecret == null) {
2021-05-10 10:34:27 +03:00
logger.warn("[RuntimeConfig] clientCheckSecret must not be null");
2019-10-19 19:46:04 +03:00
clientCheckSecret = SecurityHelper.randomStringToken();
}
2019-04-12 00:58:45 +03:00
}
2019-05-15 14:11:22 +03:00
public void reset() {
passwordEncryptKey = SecurityHelper.randomStringToken();
2021-04-26 18:21:28 +03:00
runtimeEncryptKey = SecurityHelper.randomStringAESKey();
registerApiKey = SecurityHelper.randomStringToken();
clientCheckSecret = SecurityHelper.randomStringToken();
2019-04-12 00:58:45 +03:00
}
}