throw new Error('Unlock request to Safe failed')\r
}\r
clearTimeout(this.#lockTimer)\r
- this.#lockTimer = setTimeout(() => this.lock(), 120000)\r
+ this.#lockTimer = setTimeout(() => this.lock(), 300000)\r
return isUnlocked\r
} catch (err) {\r
throw new Error('Failed to unlock wallet', { cause: err })\r
async verify (mnemonic: string): Promise<boolean>\r
async verify (secret: string): Promise<boolean> {\r
try {\r
- const data: NamedData<string> = {\r
+ clearTimeout(this.#lockTimer)\r
+ const data: NamedData = {\r
action: 'verify'\r
}\r
if (/^[A-Fa-f0-9]+$/.test(secret)) {\r
- data.seed = secret\r
+ data.seed = hex.toBuffer(secret)\r
} else {\r
data.mnemonicPhrase = secret\r
}\r
const result = await this.#safe.request<boolean>(data)\r
- const { isUnlocked } = result\r
- if (!isUnlocked) {\r
- throw new Error('Unlock request to Safe failed')\r
- }\r
- clearTimeout(this.#lockTimer)\r
- this.#lockTimer = setTimeout(() => this.lock(), 120)\r
- return isUnlocked\r
+ const { isVerified } = result\r
+ return isVerified\r
} catch (err) {\r
- throw new Error('Failed to unlock wallet', { cause: err })\r
+ throw new Error('Failed to verify wallet', { cause: err })\r
+ } finally {\r
+ this.#lockTimer = setTimeout(() => this.lock(), 300000)\r
}\r
}\r
}\r