Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert.equal(domain.length, 8, 'domain must be 8 bytes long')
const xReal = keccak256(Buffer.concat([
messageHash,
domain,
Buffer.from([1]),
]))
const xRealFp = new mcl.Fp()
xRealFp.setLittleEndian(xReal)
const xImag = keccak256(Buffer.concat([
messageHash,
domain,
Buffer.from([2]),
]))
const xImagFp = new mcl.Fp()
xImagFp.setLittleEndian(xImag)
const xCoordinate = new mcl.Fp2()
xCoordinate.set_a(xRealFp)
xCoordinate.set_b(xImagFp)
return xCoordinate.mapToG2()
}