mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-24 08:03:53 +08:00
update:SM2非对称加密的优化
This commit is contained in:
@@ -256,19 +256,3 @@ export function sm2Decrypt(privateKey, cipherText) {
|
||||
return sm2.doDecrypt(dataWithoutPrefix, privateKey, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否为Base64编码
|
||||
* @param {string} str 待判断的字符串
|
||||
* @returns {boolean} 是否为Base64编码
|
||||
*/
|
||||
export function isBase64(str) {
|
||||
if (typeof str !== 'string' || str.trim() === '') {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return btoa(atob(str)) === str;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user