Skip to content

Commit e5fa843

Browse files
authored
Merge pull request #8470 from BitGo/fix/wal-376-dkls-dsg-signaturer-authentication
fix(sdk-lib-mpc): authenticate signatureR in DKLS DSG round 4 messages
2 parents 114093c + 905a4ae commit e5fa843

16 files changed

Lines changed: 361 additions & 137 deletions

File tree

modules/abstract-lightning/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
]
4040
},
4141
"dependencies": {
42-
"@bitgo/public-types": "5.76.1",
42+
"@bitgo/public-types": "5.92.0",
4343
"@bitgo/sdk-core": "^36.40.0",
4444
"@bitgo/statics": "^58.35.0",
4545
"@bitgo/utxo-lib": "^11.22.0",

modules/bitgo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
"superagent": "^9.0.1"
139139
},
140140
"devDependencies": {
141-
"@bitgo/public-types": "5.76.1",
141+
"@bitgo/public-types": "5.92.0",
142142
"@bitgo/sdk-opensslbytes": "^2.1.0",
143143
"@bitgo/sdk-test": "^9.1.38",
144144
"@openpgp/web-stream-tools": "0.0.14",

modules/express/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"superagent": "^9.0.1"
6161
},
6262
"devDependencies": {
63-
"@bitgo/public-types": "5.76.1",
63+
"@bitgo/public-types": "5.92.0",
6464
"@bitgo/sdk-lib-mpc": "^10.10.2",
6565
"@bitgo/sdk-test": "^9.1.38",
6666
"@types/argparse": "^1.0.36",

modules/express/src/typedRoutes/api/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ import { GetResourceDelegations } from './v2/resourceDelegations';
5959
//
6060
// > error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.
6161
//
62-
// As a workaround, only construct expressApi with a single key and add it to the type union at the end
62+
// Workarounds: (1) export heavy httpRoute handlers as `HttpRoute<'post'>` (etc.) in their modules so apiSpec
63+
// inference stays small; (2) only construct expressApi with a single key and add it to the type union at the end.
6364

6465
export const ExpressPingApiSpec = apiSpec({
6566
'express.ping': {

modules/express/src/typedRoutes/api/v2/sendCoins.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as t from 'io-ts';
2-
import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
2+
import { httpRoute, httpRequest, optional, type HttpRoute } from '@api-ts/io-ts-http';
33
import { BitgoExpressError } from '../../schemas/error';
44
import { SendManyResponse, EIP1559Params, MemoParams, TokenEnablement } from './sendmany';
55

@@ -412,7 +412,7 @@ export const SendCoinsRequestBody = {
412412
* @operationId express.wallet.sendcoins
413413
* @tag express
414414
*/
415-
export const PostSendCoins = httpRoute({
415+
export const PostSendCoins: HttpRoute<'post'> = httpRoute({
416416
path: '/api/v2/{coin}/wallet/{id}/sendcoins',
417417
method: 'POST',
418418
request: httpRequest({

modules/express/src/typedRoutes/api/v2/sendmany.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as t from 'io-ts';
22
import { DateFromISOString } from 'io-ts-types';
3-
import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
3+
import { httpRoute, httpRequest, optional, type HttpRoute } from '@api-ts/io-ts-http';
44
import { TransactionRequest as TxRequestResponse } from '@bitgo/public-types';
55
import { BitgoExpressError } from '../../schemas/error';
66

@@ -790,7 +790,7 @@ export const SendManyResponse = t.intersection([
790790
* @operationId express.wallet.sendmany
791791
* @tag Express
792792
*/
793-
export const PostSendMany = httpRoute({
793+
export const PostSendMany: HttpRoute<'post'> = httpRoute({
794794
path: '/api/v2/{coin}/wallet/{id}/sendmany',
795795
method: 'POST',
796796
request: httpRequest({

modules/express/src/typedRoutes/api/v2/walletSignTx.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as t from 'io-ts';
2-
import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
2+
import { httpRoute, httpRequest, optional, type HttpRoute } from '@api-ts/io-ts-http';
33
import { TransactionRequest as TxRequestResponse, TransactionRequestApiVersion } from '@bitgo/public-types';
44
import { BitgoExpressError } from '../../schemas/error';
55
import { Recipient } from './coinSignTx';
@@ -147,7 +147,7 @@ export const WalletSignTxResponse = {
147147
* @operationId express.v2.wallet.signtx
148148
* @tag Express
149149
*/
150-
export const PostWalletSignTx = httpRoute({
150+
export const PostWalletSignTx: HttpRoute<'post'> = httpRoute({
151151
path: '/api/v2/{coin}/wallet/{id}/signtx',
152152
method: 'POST',
153153
request: httpRequest({

modules/express/src/typedRoutes/api/v2/walletTxSignTSS.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as t from 'io-ts';
2-
import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
2+
import { httpRoute, httpRequest, optional, type HttpRoute } from '@api-ts/io-ts-http';
33
import { TransactionRequest as TxRequestResponse, TransactionRequestApiVersion } from '@bitgo/public-types';
44
import { BitgoExpressError } from '../../schemas/error';
55
import { Recipient } from './coinSignTx';
@@ -161,7 +161,7 @@ export const WalletTxSignTSSResponse = {
161161
* @tag express
162162
* @operationId express.v2.wallet.signtxtss
163163
*/
164-
export const PostWalletTxSignTSS = httpRoute({
164+
export const PostWalletTxSignTSS: HttpRoute<'post'> = httpRoute({
165165
path: '/api/v2/{coin}/wallet/{id}/signtxtss',
166166
method: 'POST',
167167
request: httpRequest({

modules/express/test/unit/clientRoutes/externalSign.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,16 +1046,22 @@ async function signBitgoMPCv2Round3(
10461046
userGPGPubKey: string
10471047
): Promise<{ userMsg4: MPCv2SignatureShareRound3Input }> {
10481048
const parsedSignatureShare = JSON.parse(userShare.share) as MPCv2SignatureShareRound3Input;
1049+
const msg4 = parsedSignatureShare.data.msg4;
1050+
const signatureRAuthMessage =
1051+
msg4.signatureR && msg4.signatureRSignature
1052+
? { message: msg4.signatureR, signature: msg4.signatureRSignature }
1053+
: undefined;
10491054
const serializedMessages = await DklsComms.decryptAndVerifyIncomingMessages(
10501055
{
10511056
p2pMessages: [],
10521057
broadcastMessages: [
10531058
{
1054-
from: parsedSignatureShare.data.msg4.from,
1059+
from: msg4.from,
10551060
payload: {
1056-
message: parsedSignatureShare.data.msg4.message,
1057-
signature: parsedSignatureShare.data.msg4.signature,
1061+
message: msg4.message,
1062+
signature: msg4.signature,
10581063
},
1064+
signatureR: signatureRAuthMessage,
10591065
},
10601066
],
10611067
},

modules/sdk-coin-flrp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@bitgo/sdk-test": "^9.1.38"
4848
},
4949
"dependencies": {
50-
"@bitgo/public-types": "5.76.1",
50+
"@bitgo/public-types": "5.92.0",
5151
"@bitgo/sdk-core": "^36.40.0",
5252
"@bitgo/secp256k1": "^1.11.0",
5353
"@bitgo/statics": "^58.35.0",

0 commit comments

Comments
 (0)