}
let isVerified = false
if (seed != null) {
- if (seed.byteLength === this.#seed.byteLength) {
- const userSeed = new Uint8Array(seed)
- const thisSeed = new Uint8Array(this.#seed)
- for (let i = 0; i < seed.byteLength; i++) {
- if (userSeed[i] === thisSeed[i]) {
- isVerified = true
- } else {
- isVerified = false
- break
- }
- }
+ let diff = 0
+ const userSeed = new Uint8Array(seed)
+ const thisSeed = new Uint8Array(this.#seed)
+ for (let i = 0; i < seed.byteLength; i++) {
+ diff |= userSeed[i] ^ thisSeed[i]
}
+ isVerified = diff === 0
}
- if (mnemonicPhrase != null) {
- if (mnemonicPhrase === this.#mnemonic) {
- isVerified = true
- }
+ if (mnemonicPhrase != null && mnemonicPhrase === this.#mnemonic) {
+ isVerified = true
}
return { isVerified }
} catch (err) {