Skip to content

Commit 8da680b

Browse files
committed
test: add ecdsaMPCv2 offline signing tests
TICKET: HSM-1513
1 parent e3bc07c commit 8da680b

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

modules/sdk-core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"@openpgp/web-stream-tools": "0.0.14",
7777
"@types/keccak": "^3.0.5",
7878
"@types/lodash": "^4.14.151",
79+
"bitgo": "^50.32.0",
7980
"nyc": "^15.0.0"
8081
},
8182
"gitHead": "18e460ddf02de2dbf13c2aa243478188fb539f0c"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import * as assert from 'assert';
2+
import { DklsUtils } from '@bitgo/sdk-lib-mpc';
3+
import { BitGo } from 'bitgo';
4+
import { EcdsaMPCv2Utils } from 'modules/sdk-core/src';
5+
6+
describe('ECDSA MPC v2', () => {
7+
it('should sign a message hash using ECDSA MPC v2 offline rounds', async () => {
8+
const [userShare, backupShare, bitgoShare] = await DklsUtils.generateDKGKeyShares();
9+
10+
assert.ok(userShare);
11+
assert.ok(backupShare);
12+
assert.ok(bitgoShare);
13+
14+
const bg = new BitGo({ env: 'test' });
15+
const coin = bg.coin('hteth');
16+
const ecdsaMPCv2Utils = new EcdsaMPCv2Utils(bg, coin);
17+
18+
const walletID = '62fe536a6b4cf70007acb48c0e7bb0b0';
19+
const tMessage = 'testMessage';
20+
const derivationPath = 'm/0';
21+
const walletPassphrase = 'testPass';
22+
23+
const reqMPCv2SigningRound1 = {
24+
txRequest: {
25+
txRequestId: '123456',
26+
apiVersion: 'full',
27+
walletId: walletID,
28+
transactions: [
29+
{
30+
unsignedTx: {
31+
derivationPath,
32+
signableHex: tMessage,
33+
},
34+
signatureShares: [],
35+
},
36+
],
37+
},
38+
prv: userShare.getKeyShare().toString('base64'),
39+
walletPassphrase,
40+
};
41+
42+
const resMPCv2SigningRound1 = await ecdsaMPCv2Utils.createOfflineRound1Share(reqMPCv2SigningRound1);
43+
assert.ok(resMPCv2SigningRound1.signatureShareRound1);
44+
});
45+
});

0 commit comments

Comments
 (0)