Skip to content

Commit e67a898

Browse files
refactor(utxo-core): changed toString for message to hex
TICKET: BTC-2246 refactor(utxo-core): keep message as a buffer TICKET: BTC-2246
1 parent a1d5eea commit e67a898

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/utxo-core/src/paygo/psbt/payGoAddressProof.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
* @param psbt - PSBT that we need to encode our paygo address into
2020
* @param outputIndex - the index of the address in our output
2121
* @param sig - the signature that we want to encode
22+
* @param entropy - the arbitrary entropy bytes from our vasp proof
2223
*/
2324
export function addPayGoAddressProof(
2425
psbt: utxolib.bitgo.UtxoPsbt,
@@ -40,7 +41,7 @@ export function addPayGoAddressProof(
4041
*
4142
* @param psbt - PSBT we want to verify that the paygo address is in
4243
* @param outputIndex - we have the output index that address is in
43-
* @param uuid
44+
* @param verificationPubkey - the pubkey signed by the HSM to verify our message
4445
* @returns
4546
*/
4647
export function verifyPayGoAddressProof(
@@ -76,7 +77,8 @@ export function verifyPayGoAddressProof(
7677
// We construct our message <ENTROPY><ADDRESS><UUID>
7778
const message = createPayGoAttestationBuffer(addressFromOutput, entropy, psbt.network);
7879

79-
if (!verifyMessage(message.toString(), verificationPubkey, signature, utxolib.networks.bitcoin)) {
80+
// bip32utils.verifyMessage now takes in message as a Buffer
81+
if (!verifyMessage(message, verificationPubkey, signature, utxolib.networks.bitcoin)) {
8082
throw new ErrorPayGoAddressProofFailedVerification();
8183
}
8284
}

0 commit comments

Comments
 (0)