修正quickcomposer对称加密和非对称加密的声明文件

This commit is contained in:
fofolee 2025-02-15 13:31:26 +08:00
parent 02f4b2f132
commit d239953125
2 changed files with 62 additions and 27 deletions

View File

@ -54,7 +54,7 @@
<script>
import { defineAsyncComponent, ref, computed } from "vue";
import CommandConfig from "./editor/CommandConfig.vue";
import CommandConfig from "components/editor/CommandConfig.vue";
import CommandLanguageBar from "components/editor/CommandLanguageBar";
import EditorTools from "components/editor/EditorTools";
import CommandRunResult from "components/CommandRunResult";
@ -81,7 +81,6 @@ const CodeEditor = defineAsyncComponent({
timeout: 3000,
});
// TODO:
export default {
components: {
CodeEditor,

View File

@ -993,41 +993,77 @@ interface quickcomposerApi {
*
* @param config
* @param config.text
* @param config.key
* @param config.algorithm aes-128-cbc, aes-192-cbc, aes-256-cbc, des-cbc, des3-cbc
* @param config.mode encrypt-decrypt-
* @param config.encoding base64, hex
* @param config.algorithm AES, SM4
* @param config.mode CBC, ECB, GCM (GCM仅AES支持)
* @param config.padding AES填充方式Pkcs7, NoPadding, Iso97971, AnsiX923, Iso10126, ZeroPadding
* SM4填充方式Pkcs#7, None
* @param config.key
* @param config.key.value
* @param config.key.codec Utf8, Base64, Hex
* @param config.keyLength 128, 192, 256 (AES支持192/256)
* @param config.operation encrypt-decrypt-
* @param config.format Base64, Hex
* @param config.iv IV配置(ECB模式不需要)
* @param config.iv.value IV值
* @param config.iv.codec IV编码Utf8, Base64, Hex
*/
symmetricCrypto(config: {
text: string;
key: string;
algorithm:
| "aes-128-cbc"
| "aes-192-cbc"
| "aes-256-cbc"
| "des-cbc"
| "des3-cbc";
mode: "encrypt" | "decrypt";
encoding?: "base64" | "hex";
}): string;
algorithm: "AES" | "SM4";
mode?: "CBC" | "ECB" | "GCM";
padding?:
| "Pkcs7"
| "NoPadding"
| "Iso97971"
| "AnsiX923"
| "Iso10126"
| "ZeroPadding"
| "Pkcs#7"
| "None";
key: {
value: string;
codec: "Utf8" | "Base64" | "Hex";
};
keyLength?: 128 | 192 | 256;
operation?: "encrypt" | "decrypt";
format?: "Base64" | "Hex";
iv?: {
value: string;
codec: "Utf8" | "Base64" | "Hex";
};
}): string | { enc: string; tag: string }; // GCM模式返回包含tag的对象
/**
*
* @param config
* @param config.text
* @param config.key ()
* @param config.algorithm rsa, sm2
* @param config.mode encrypt-decrypt-sign-verify-
* @param config.encoding base64, hex
* @param config.padding pkcs1, pkcs1_oaep
* @param config.text /
* @param config.algorithm SM2, RSA
* @param config.operation encrypt-decrypt-
* @param config.format Base64, Hex
* @param config.publicKey ()
* @param config.publicKey.key
* @param config.publicKey.codec Pem, Hex (SM2仅支持HexRSA仅支持Pem)
* @param config.privateKey ()
* @param config.privateKey.key
* @param config.privateKey.codec Pem, Hex (SM2仅支持HexRSA仅支持Pem)
* @param config.padding RSA填充方式RSAES-PKCS1-V1_5 (RSA支持)
* @param config.cipherMode SM2加密模式0-C1C2C3, 1-C1C3C2 (SM2支持1)
*/
asymmetricCrypto(config: {
text: string;
algorithm: "SM2" | "RSA";
operation: "encrypt" | "decrypt";
format?: "Base64" | "Hex";
publicKey?: {
key: string;
algorithm: "rsa" | "sm2";
mode: "encrypt" | "decrypt" | "sign" | "verify";
encoding?: "base64" | "hex";
padding?: "pkcs1" | "pkcs1_oaep";
codec: "Pem" | "Hex";
};
privateKey?: {
key: string;
codec: "Pem" | "Hex";
};
padding?: "RSAES-PKCS1-V1_5";
cipherMode?: 0 | 1;
}): string;
/**