* @param {string} mnemonic - Mnemonic phrase to validate\r
* @returns {boolean} True if the mnemonic phrase is valid\r
*/\r
- static async validate (mnemonic: string): Promise<boolean> {\r
+ static async validate (mnemonic: string): Promise<boolean>\r
+ static async validate (mnemonic: unknown): Promise<boolean> {\r
+ if (typeof mnemonic !== 'string') {\r
+ return false\r
+ }\r
+ if (!/^(?:[a-z]{3,8} ){11,23}[a-z]{3,8}$/i.test(mnemonic)) {\r
+ return false\r
+ }\r
const words = mnemonic.normalize('NFKD').split(' ')\r
if (words.length % 3 !== 0) {\r
return false\r