TokenEncryption
public class TokenEncryption
源码Source
io/agentscope/harness/coding/metadata/TokenEncryption.java:49–118令牌 Encryption,承载智能体的部署、调度与服务化运行。位于 io.agentscope.harness.coding.metadata 包。核心成员包括 encrypt、decrypt、TokenEncryption。
Token encryption/decryption using Google Tink AEAD.
Used to store GitHub tokens encrypted at rest in SqliteBaseStore.
Key management
The keyset JSON is loaded from:
-
TOKEN_ENC_KEYSET_PATHenv var (path to JSON file) -
TOKEN_ENC_KEYSETenv var (inline base64-encoded JSON)
Generate a new keyset with:
tinkey create-keyset --key-template AES256_GCM --out keyset.json
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public TokenEncryption() throws GeneralSecurityException | 初始化 `TokenEncryption` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String encrypt(String plaintext) throws GeneralSecurityException | 设置该参数。 Encrypts a plaintext token. |
public String decrypt(String ciphertext) throws GeneralSecurityException | 设置该参数。 Decrypts a ciphertext token. |
构造器详情Constructor Detail
TokenEncryption
public TokenEncryption() throws GeneralSecurityException
初始化 TokenEncryption 实例。
Creates a new instance.
GeneralSecurityException可能抛出 `GeneralSecurityException`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/harness/coding/metadata/TokenEncryption.java:53–56方法详情Method Detail
encrypt
public String encrypt(String plaintext) throws GeneralSecurityException
设置该参数。
Encrypts a plaintext token.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
plaintext | String | plaintext(类型 `String`)。token to encrypt |
String返回字符串结果。base64url-encoded ciphertext
GeneralSecurityException可能抛出 `GeneralSecurityException`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/harness/coding/metadata/TokenEncryption.java:64–67decrypt
public String decrypt(String ciphertext) throws GeneralSecurityException
设置该参数。
Decrypts a ciphertext token.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ciphertext | String | ciphertext(类型 `String`)。base64url-encoded ciphertext (from `#encrypt`) |
String返回字符串结果。plaintext token
GeneralSecurityException可能抛出 `GeneralSecurityException`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/harness/coding/metadata/TokenEncryption.java:75–78