seckit/src/types/sm-crypto.d.ts
2026-04-23 14:18:39 +08:00

24 lines
1.0 KiB
TypeScript

declare module 'sm-crypto' {
export interface SM2KeyPair {
privateKey: string;
publicKey: string;
}
export const sm2: {
generateKeyPairHex: (privateKey?: string) => SM2KeyPair;
doEncrypt: (message: string, publicKey: string, cipherMode?: number) => string;
doDecrypt: (ciphertext: string, privateKey: string, cipherMode?: number, options?: { output?: string }) => string | Uint8Array;
doSignature: (message: string | Uint8Array, privateKey: string, options?: { hash?: boolean, der?: boolean, userId?: string, publicKey?: string, pointPool?: any[] }) => string;
doVerifySignature: (message: string | Uint8Array, signature: string, publicKey: string, options?: { hash?: boolean, der?: boolean, userId?: string }) => boolean;
getPublicKeyFromPrivateKey: (privateKey: string) => string;
};
export const sm3: {
digest: (message: string) => string;
};
export const sm4: {
encrypt: (message: string, key: string, options?: any) => string;
decrypt: (ciphertext: string, key: string, options?: any) => string;
};
}