@@ -3,9 +3,8 @@ import assert from 'assert';
33import { bufferutils } from '@bitgo/utxo-lib' ;
44
55// The signed address will always have the following structure:
6- // 0x18Bitcoin Signed Message:\n <varint_length><ENTROPY><ADDRESS><UUID>
6+ // <varint_length><ENTROPY><ADDRESS><UUID>
77
8- const PrefixLength = Buffer . from ( [ 0x18 ] ) . length + Buffer . from ( 'Bitcoin Signed Message:\n' ) . length ;
98// UUID has the structure 00000000-0000-0000-0000-000000000000, and after
109// we Buffer.from and get it's length its 36.
1110const UuidBufferLength = 36 ;
@@ -14,7 +13,7 @@ const EntropyLen = 64;
1413
1514/**
1615 * This function takes in the attestation proof of a PayGo address of the from
17- * 0x18Bitcoin Signed Message:\n <varint_length><ENTROPY><ADDRESS><UUID> and returns
16+ * <varint_length><ENTROPY><ADDRESS><UUID> and returns
1817 * the address given its length. It is assumed that the ENTROPY is 64 bytes in the Buffer
1918 * so if not given an address proof length we can still extract the address from the proof.
2019 *
@@ -26,13 +25,13 @@ export function parsePayGoAttestation(message: Buffer): {
2625 address : Buffer ;
2726 uuid : Buffer ;
2827} {
29- if ( message . length <= PrefixLength + EntropyLen + UuidBufferLength ) {
28+ if ( message . length <= EntropyLen + UuidBufferLength ) {
3029 throw new Error ( 'PayGo attestation proof is too short to contain a valid address' ) ;
3130 }
3231
3332 // This generates the first part before the varint length so that we can
3433 // determine how many bytes this is and iterate through the Buffer.
35- let offset = PrefixLength ;
34+ let offset = 0 ;
3635
3736 // we decode the varint of the message which is uint32
3837 // https://en.bitcoin.it/wiki/Protocol_documentation
0 commit comments