From ced82b18d7fdb72706ed4f7a82b35b1fe82f2d81 Mon Sep 17 00:00:00 2001 From: Luk Date: Thu, 10 Oct 2024 13:04:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=20secword.trim()=20=E5=8F=96=E4=BB=A3?= =?UTF-8?q?=20secword.replace(/^\s+/,=20'').replace(/\s+$/,=20'')?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticc.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ticc.js b/ticc.js index 4eee4c4..8886ef7 100644 --- a/ticc.js +++ b/ticc.js @@ -124,9 +124,7 @@ class TicCrypto { // return false //// for bip39. 注意,bip39对当前defaultWordlist之外其他语言的合法 mnemonic 也返回 false,这一点不如 bitcore-mnemonic. 所以不能直接 bip39.validateMnemonic(secword) - secword = secword - .replace(/^\s+/, '') // 删除开头的空格 - .replace(/\s+$/, '') // 删除末尾的空格 + secword = secword.trim() if (typeof secword === 'string' && [12, 15, 18, 21, 24].includes(secword.split(/\s+/).length)) { if (mode === 'easy') return true // easy模式不检查校验等等严格的合法性了,反正 secword_to_seed 是接受一切字符串的 if (my.langMap[lang?.toLowerCase?.()]) {