Skip to content

Commit 54cced0

Browse files
chore(utxo-core): updated test and verify
TICKET: BTC-2047
1 parent ef541d8 commit 54cced0

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,8 @@ export class ErrorOutputIndexOutOfBounds extends Error {
2222
}
2323
}
2424

25-
export class ErrorProofAddressMismatchOutputAdress extends Error {
26-
constructor(public addressFromProof: string, public addressFromOutput: string) {
27-
super(
28-
`The address from the output (${addressFromOutput}) does not match the address that is in the proof (${addressFromProof}).`
29-
);
30-
}
31-
}
32-
3325
export class ErrorMultiplePayGoProofAtPsbtIndex extends Error {
3426
constructor(public outputIndex: number) {
3527
super(`There are multiple PayGo addresses in the PSBT output ${outputIndex}.`);
3628
}
3729
}
38-
39-
export class ErrorPublicKeyMismatch extends Error {
40-
constructor() {
41-
super('The public key in the PSBT does not match the provided public key.');
42-
}
43-
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from './Errors';
1313

1414
/** This function adds the entropy and signature into the PSBT output unknown key vals.
15-
* We store the entropy so that we reconstruct the message <varint_len><entropy><address><uuid>
15+
* We store the entropy so that we reconstruct the message <ENTROPY><ADDRESS><UUID>
1616
* to later verify.
1717
*
1818
* @param psbt - PSBT that we need to encode our paygo address into
@@ -35,7 +35,7 @@ export function addPayGoAddressProof(
3535
});
3636
}
3737

38-
/** Verify the paygo address signature is valid using BitGoJs statics
38+
/** Verify the paygo address signature is valid using verification pub key.
3939
*
4040
* @param psbt - PSBT we want to verify that the paygo address is in
4141
* @param outputIndex - we have the output index that address is in

modules/utxo-core/test/paygo/psbt/PayGoUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ describe('getPaygoAddressProofIndex', () => {
138138
it('should return an error and fail if we have multiple PayGo address in the PSBT in the same output index', () => {
139139
const psbt = getTestPsbt();
140140
const outputIndex = 0;
141-
addPayGoAddressProof(psbt, outputIndex, sig, Buffer.from(attestationPubKey));
142-
addPayGoAddressProof(psbt, outputIndex, sig, Buffer.from('xpub12345abcdef29a028510d3b2d4'));
141+
addPayGoAddressProof(psbt, outputIndex, sig, addressProofEntropy);
142+
addPayGoAddressProof(psbt, outputIndex, sig, crypto.randomBytes(64));
143143
assert.throws(
144144
() => getPayGoAddressProofOutputIndex(psbt),
145145
(e: any) => e.message === 'There are multiple PayGo addresses in the PSBT output 0.'

0 commit comments

Comments
 (0)