[🚀] mysql

This commit is contained in:
2026-02-07 15:38:01 +08:00
parent 3005002379
commit 616abd2364
8 changed files with 576 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
/**
* 加密器接口
*/
export interface IEncryptor {
encrypt(plaintext: Uint8Array): Promise<Uint8Array>;
decrypt(ciphertext: Uint8Array): Promise<Uint8Array>;
name(): string;
}
/**
* 签名器接口
*/
export interface ISigner {
sign(data: Uint8Array): Promise<Uint8Array>;
verify(data: Uint8Array, signature: Uint8Array): Promise<boolean>;
}
/**
* 配置选项
*/
export interface CryptoConfig {
secretKey?: string; // 对称加密密钥
signKey?: string; // 签名密钥
publicKey?: string; // RSA公钥PEM格式
privateKey?: string; // RSA私钥PEM格式
timestampWindow?: number; // 时间戳窗口(毫秒)
enableTimestamp?: boolean; // 是否启用时间戳验证
enableSignature?: boolean; // 是否启用签名
}
/**
* 加密请求体
*/
export interface EncryptedRequest {
data: string; // Base64编码的加密数据
signature?: string; // Base64编码的签名
timestamp: number; // 时间戳
request_id: string; // 请求ID
algorithm: string; // 加密算法名称
}
/**
* 加密响应体
*/
export interface EncryptedResponse {
data: string; // Base64编码的加密数据
signature?: string; // Base64编码的签名
timestamp: number; // 时间戳
request_id: string; // 请求ID
}