调整项目结构
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package tech.easyflow.manuagent;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import tech.easyflow.manuagent.config.AppProperties;
|
||||
import tech.easyflow.manuagent.model.KeyCipher;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Duration;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* 验证模型密钥保护。
|
||||
*/
|
||||
class KeyCipherAndShellTest {
|
||||
|
||||
/**
|
||||
* 验证密钥可恢复且相同明文每次产生不同密文。
|
||||
*/
|
||||
@Test
|
||||
void shouldEncryptModelKeyWithRandomIv() {
|
||||
KeyCipher cipher = new KeyCipher(properties());
|
||||
byte[] first = cipher.encrypt("local-test-key");
|
||||
byte[] second = cipher.encrypt("local-test-key");
|
||||
|
||||
assertThat(first).isNotEqualTo(second);
|
||||
assertThat(cipher.decrypt(first)).isEqualTo("local-test-key");
|
||||
}
|
||||
|
||||
private AppProperties properties() {
|
||||
return new AppProperties(
|
||||
Path.of("data"), Path.of("deepseek"), Path.of("dashscope"),
|
||||
"unit-test-master", "admin", "admin123", "https://api.example.test", "model",
|
||||
131_072, "smart-factory-agent-runtime:test", "bridge", Duration.ofMinutes(1));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user