24 lines
1.0 KiB
TypeScript
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;
|
|
};
|
|
} |