can-can-word-bug
Version:
can-can-word-bug 是一个 TS 编写的工具库
40 lines (39 loc) • 970 B
TypeScript
/**
* 加密字符串
* @param key 密钥
* @param str 需要加密的字符串
*/
export declare const encrypt: (key: string, str: string) => string;
/**
* 解密字符串
* @param key 密钥
* @param str 需要解密的字符串
*/
export declare const decrypt: (key: string, str: string) => string;
/**
* 获取加密解密的方法
* @param key 密钥
* @example
* const cpt = getCrypt('your-key')
* const rawStr = Math.random().toString()
* const encryptedStr = cpt.encrypt(rawStr)
* const decryptedStr = cpt.decrypt(encryptedStr)
* console.log(`
* rawStr : ${rawStr}
* encryptedStr : ${encryptedStr}
* decryptedStr : ${decryptedStr}
* `)
*/
declare const getCrypt: (key: string) => {
/**
* 加密
* @param str 需要加密的字符串
*/
encrypt: (str: string) => string;
/**
* 解密
* @param str 需要解密的字符串
*/
decrypt: (str: string) => string;
};
export default getCrypt;