Skip to content

Commit 2cda75e

Browse files
chore(utxo-lib): added exports for bufferutils bitcoinjs-lib
TICKET: BTC-2150
1 parent b1793e1 commit 2cda75e

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

modules/utxo-core/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@
5454
"@bitgo/unspents": "^0.47.21",
5555
"@bitgo/utxo-lib": "^11.3.0",
5656
"@bitgo/wasm-miniscript": "2.0.0-beta.7",
57-
"bip174": "npm:@bitgo-forks/[email protected]",
58-
"bitcoinjs-lib": "npm:@bitgo-forks/[email protected]"
57+
"bip174": "npm:@bitgo-forks/[email protected]"
5958
},
6059
"gitHead": "18e460ddf02de2dbf13c2aa243478188fb539f0c"
6160
}

modules/utxo-core/src/paygo/ExtractAddressPayGoAttestation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import assert from 'assert';
22

3-
import { varuint } from 'bitcoinjs-lib/src/bufferutils';
3+
import { bufferutils } from '@bitgo/utxo-lib';
44

55
// The signed address will always have the following structure:
66
// 0x18Bitcoin Signed Message:\n<varint_length><ENTROPY><ADDRESS><UUID>
@@ -32,7 +32,7 @@ export function extractAddressBufferFromPayGoAttestationProof(message: Buffer):
3232

3333
// we decode the varint of the message which is uint32
3434
// https://en.bitcoin.it/wiki/Protocol_documentation
35-
const varInt = varuint.decode(message, offset);
35+
const varInt = bufferutils.varuint.decode(message, offset);
3636
assert(varInt);
3737
offset += 1;
3838

modules/utxo-core/src/testutil/generatePayGoAttestationProof.utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import crypto from 'crypto';
22

3-
import { varuint } from 'bitcoinjs-lib/src/bufferutils';
3+
import { bufferutils } from '@bitgo/utxo-lib';
44
/** We have a mirrored function similar to our hsm that generates our Bitcoin signed
55
* message so that we can use for testing. This creates a random entropy as well using
66
* the nilUUID structure to construct our uuid buffer and given our address we can
@@ -30,7 +30,7 @@ export function generatePayGoAttestationProof(uuid: string, address: Buffer): Bu
3030

3131
// <VARINT_LENGTH>
3232
const msgLength = entropyLength + addressBufferLength + uuidBufferLength;
33-
const msgLengthBuffer = varuint.encode(msgLength);
33+
const msgLengthBuffer = bufferutils.varuint.encode(msgLength);
3434

3535
// <0x18Bitcoin Signed Message:\n<LENGTH><ENTROPY><ADDRESS><UUID>
3636
const proofMessage = Buffer.concat([prefixBuffer, msgLengthBuffer, entropy, address, uuidBuffer]);

modules/utxo-lib/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export * from 'bitcoinjs-lib';
22

3+
export * as bufferutils from 'bitcoinjs-lib/src/bufferutils';
4+
35
export * as bitgo from './bitgo';
46

57
export * as address from './address';

0 commit comments

Comments
 (0)