Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
assert(Buffer.isBuffer(expect));
assert(expect.length === 32);
const {subproof, subindex} = this;
const {proof, index} = this;
const leaf = blake2b.digest(this.key);
if (this.isAddress()) {
const root = merkle.deriveRoot(blake2b, leaf, proof, index);
return root.equals(expect);
}
const subroot = merkle.deriveRoot(blake2b, leaf, subproof, subindex);
const root = merkle.deriveRoot(blake2b, subroot, proof, index);
return root.equals(expect);
}
}
assert(Buffer.isBuffer(expect));
assert(expect.length === 32);
const {subproof, subindex} = this;
const {proof, index} = this;
const leaf = blake2b.digest(this.key);
if (this.isAddress()) {
const root = merkle.deriveRoot(blake2b, leaf, proof, index);
return root.equals(expect);
}
const subroot = merkle.deriveRoot(blake2b, leaf, subproof, subindex);
const root = merkle.deriveRoot(blake2b, subroot, proof, index);
return root.equals(expect);
}
assert(Buffer.isBuffer(expect));
assert(expect.length === 32);
const {subproof, subindex} = this;
const {proof, index} = this;
const leaf = blake2b.digest(this.key);
if (this.isAddress()) {
const root = merkle.deriveRoot(blake2b, leaf, proof, index);
return root.equals(expect);
}
const subroot = merkle.deriveRoot(blake2b, leaf, subproof, subindex);
const root = merkle.deriveRoot(blake2b, subroot, proof, index);
return root.equals(expect);
}
verifyMerkle(expect) {
if (expect == null) {
expect = this.isAddress()
? FAUCET_ROOT
: AIRDROP_ROOT;
}
assert(Buffer.isBuffer(expect));
assert(expect.length === 32);
const {subproof, subindex} = this;
const {proof, index} = this;
const leaf = blake2b.digest(this.key);
if (this.isAddress()) {
const root = merkle.deriveRoot(blake2b, leaf, proof, index);
return root.equals(expect);
}
const subroot = merkle.deriveRoot(blake2b, leaf, subproof, subindex);
const root = merkle.deriveRoot(blake2b, subroot, proof, index);
return root.equals(expect);
}
verifyMerkle(expect) {
if (expect == null) {
expect = this.isAddress()
? FAUCET_ROOT
: AIRDROP_ROOT;
}
assert(Buffer.isBuffer(expect));
assert(expect.length === 32);
const {subproof, subindex} = this;
const {proof, index} = this;
const leaf = blake2b.digest(this.key);
if (this.isAddress()) {
const root = merkle.deriveRoot(blake2b, leaf, proof, index);
return root.equals(expect);
}
const subroot = merkle.deriveRoot(blake2b, leaf, subproof, subindex);
const root = merkle.deriveRoot(blake2b, subroot, proof, index);
return root.equals(expect);
}
assert(Buffer.isBuffer(expect));
assert(expect.length === 32);
const {subproof, subindex} = this;
const {proof, index} = this;
const leaf = blake2b.digest(this.key);
if (this.isAddress()) {
const root = merkle.deriveRoot(blake2b, leaf, proof, index);
return root.equals(expect);
}
const subroot = merkle.deriveRoot(blake2b, leaf, subproof, subindex);
const root = merkle.deriveRoot(blake2b, subroot, proof, index);
return root.equals(expect);
}