Skip to content

Commit e7183c0

Browse files
feat(lit-node-client-nodejs): LIT-4124 - Remove now-unused shareIndex usage
- Also send `nodeSet` to `sign_session_key` endpoint as it is required - Fixed typo on name of wasm method for `ecdsaCombineAndVerify` (was previously unused)
1 parent 06f6fad commit e7183c0

File tree

8 files changed

+16
-46
lines changed

8 files changed

+16
-46
lines changed

packages/lit-node-client-nodejs/src/lib/helpers/get-bls-signatures.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ describe('getBlsSignatures', () => {
99
ProofOfPossession:
1010
'01b191b1d281857a95d2fd189683db366ab1088723338c1805daa4650459e9fcaebaa57b58108c284d233404dd5f2e58f208aafb87d981098aba3fe850980184a4b29643a21107b03f1d928646245b57af3745a81418989e0b6aad9bd1f192723c',
1111
},
12-
shareIndex: 0,
1312
curveType: 'BLS',
1413
siweMessage:
1514
"litprotocol.com wants you to sign in with your Ethereum account:\n0x7f2e96c99F9551915DA9e9F828F512330f130acB\n\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\n\nURI: lit:session:73e09d1ad1faa329bef12ebaf9b982d2925746e3677cabd4b6b7196096a6ee02\nVersion: 1\nChain ID: 1\nNonce: 0xa5f18dbc0fa2080649042ab8cb6cef3b246c20c15b62482ba43fb4ca2a4642cb\nIssued At: 2024-04-25T02:09:35Z\nExpiration Time: 2024-04-26T02:09:50.822Z\nResources:\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1ZM3F1bjlxWDNmVUJIVmZyQTlmM3Y5UnB5eVBvOFJIRXVFTjFYWVBxMVByQSJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTQwOTczODYsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4NzA5OTc5NzBDNTE4MTJkYzNBMDEwQzdkMDFiNTBlMGQxN2RjNzlDOCJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0",
@@ -24,7 +23,6 @@ describe('getBlsSignatures', () => {
2423
ProofOfPossession:
2524
'038178034edcd5b48da4e2af6eb0891ece41389aa6119c80546d3fa00b5d2ba87eaec327b18d8013714b486246807498c8198e70cf8e917b1a5f1d8d0846787172521d41994de95bd641bdc1d9ccee9b459ceeb03f156cf357a4ff8faf5d2e167d',
2625
},
27-
shareIndex: 2,
2826
curveType: 'BLS',
2927
siweMessage:
3028
"litprotocol.com wants you to sign in with your Ethereum account:\n0x7f2e96c99F9551915DA9e9F828F512330f130acB\n\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\n\nURI: lit:session:73e09d1ad1faa329bef12ebaf9b982d2925746e3677cabd4b6b7196096a6ee02\nVersion: 1\nChain ID: 1\nNonce: 0xa5f18dbc0fa2080649042ab8cb6cef3b246c20c15b62482ba43fb4ca2a4642cb\nIssued At: 2024-04-25T02:09:35Z\nExpiration Time: 2024-04-26T02:09:50.822Z\nResources:\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1ZM3F1bjlxWDNmVUJIVmZyQTlmM3Y5UnB5eVBvOFJIRXVFTjFYWVBxMVByQSJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTQwOTczODYsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4NzA5OTc5NzBDNTE4MTJkYzNBMDEwQzdkMDFiNTBlMGQxN2RjNzlDOCJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0",
@@ -39,7 +37,6 @@ describe('getBlsSignatures', () => {
3937
ProofOfPossession:
4038
'0292a026325a166398b85b53f3a7a34d147c5337e189d75c33c0f227f7926c839b408dfcc5d242a8685a81c68e0ccedc080c051219161dbc37f06627259b19d15120ab2f710075a44b1dcef18d511bb99b6625c8f575d2688c6b5b01ba6bf448c9',
4139
},
42-
shareIndex: 1,
4340
curveType: 'BLS',
4441
siweMessage:
4542
"litprotocol.com wants you to sign in with your Ethereum account:\n0x7f2e96c99F9551915DA9e9F828F512330f130acB\n\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\n\nURI: lit:session:73e09d1ad1faa329bef12ebaf9b982d2925746e3677cabd4b6b7196096a6ee02\nVersion: 1\nChain ID: 1\nNonce: 0xa5f18dbc0fa2080649042ab8cb6cef3b246c20c15b62482ba43fb4ca2a4642cb\nIssued At: 2024-04-25T02:09:35Z\nExpiration Time: 2024-04-26T02:09:50.822Z\nResources:\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1ZM3F1bjlxWDNmVUJIVmZyQTlmM3Y5UnB5eVBvOFJIRXVFTjFYWVBxMVByQSJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTQwOTczODYsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4NzA5OTc5NzBDNTE4MTJkYzNBMDEwQzdkMDFiNTBlMGQxN2RjNzlDOCJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0",

packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ describe('getSignatures', () => {
1212
sigType: 'K256',
1313
dataSigned: 'fail',
1414
signatureShare: '',
15-
shareIndex: 0,
1615
bigR: '',
1716
publicKey: '',
1817
sigName: 'sig',
@@ -25,7 +24,6 @@ describe('getSignatures', () => {
2524
'7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4',
2625
signatureShare:
2726
'1301BE04CF3A269709C2BDC29F7EFD1FBB3FC037C00AD2B5BDA8726B74CB5AF4',
28-
shareIndex: 0,
2927
bigR: '0290947D801A421D4A347FFFD386703C97BEF8E8AC83C3AB256ACE09255C37C521',
3028
publicKey:
3129
'04423427A87DEE9420BAC5C38355FE4A8C30EA796D87950C0143B49422D88C8FC70C381CB45300D8AD8A95139FFEEA5F265EFE00B65481BBB97B311C6833B69AE3',
@@ -39,7 +37,6 @@ describe('getSignatures', () => {
3937
'7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4',
4038
signatureShare:
4139
'F649B4CEAEE015877161AC8F062270200F65EC166C9BD7BF6F877EBB345F2F8F',
42-
shareIndex: 0,
4340
bigR: '0290947D801A421D4A347FFFD386703C97BEF8E8AC83C3AB256ACE09255C37C521',
4441
publicKey:
4542
'04423427A87DEE9420BAC5C38355FE4A8C30EA796D87950C0143B49422D88C8FC70C381CB45300D8AD8A95139FFEEA5F265EFE00B65481BBB97B311C6833B69AE3',

packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export const getFlattenShare = (share: any): SigShare => {
2828
'sigType',
2929
'dataSigned',
3030
'signatureShare',
31-
'shareIndex',
3231
'bigR',
3332
'publicKey',
3433
];
@@ -125,7 +124,6 @@ export const getSignatures = async <T>(params: {
125124
share = {
126125
sigType: share.sigType,
127126
signatureShare: share.signatureShare,
128-
shareIndex: share.shareIndex,
129127
bigR: share.bigR,
130128
publicKey: share.publicKey,
131129
dataSigned: share.dataSigned,
@@ -166,9 +164,7 @@ export const getSignatures = async <T>(params: {
166164
.map((r) => r[key])
167165
.filter((r) => r !== undefined);
168166

169-
shares.sort((a, b) => a.shareIndex - b.shareIndex);
170-
171-
let sigName = shares[0].sigName;
167+
const sigName = shares[0].sigName;
172168

173169
logWithRequestId(
174170
requestId,
@@ -234,7 +230,7 @@ export const getSignatures = async <T>(params: {
234230
sigType !== LIT_CURVE.EcdsaCaitSith &&
235231
sigType !== LIT_CURVE.EcdsaK256 &&
236232
sigType !== LIT_CURVE.EcdsaCAITSITHP256 &&
237-
sigType! == LIT_CURVE.EcdsaK256Sha256
233+
sigType !== LIT_CURVE.EcdsaK256Sha256
238234
) {
239235
throw new UnknownSignatureType(
240236
{

packages/lit-node-client-nodejs/src/lib/helpers/parse-pkp-sign-response.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ describe('parsePkpSignResponse', () => {
7373
{
7474
signature: {
7575
digest: 'fail',
76-
shareIndex: 0,
7776
signatureShare: '',
7877
bigR: '',
7978
publicKey: '',
@@ -85,7 +84,6 @@ describe('parsePkpSignResponse', () => {
8584
signature: {
8685
digest:
8786
'7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4',
88-
shareIndex: 0,
8987
signatureShare:
9088
'3ED0A844FAE40DF6210A6B2EACB9426E52E8339E243E697E33CF14E0CDE2B827',
9189
bigR: '0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B',
@@ -100,7 +98,6 @@ describe('parsePkpSignResponse', () => {
10098
signature: {
10199
digest:
102100
'7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4',
103-
shareIndex: 0,
104101
signatureShare:
105102
'B1AA643E88F8937B71CE2D43DCB73E0180AC96D1E39ECC579F0EC9635F37D4CB',
106103
bigR: '0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B',

packages/lit-node-client-nodejs/src/lib/helpers/pocess-lit-action-response-strategy.spec.ts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { assert } from 'console';
2+
13
import { NodeShare } from '@lit-protocol/types';
4+
25
import { processLitActionResponseStrategy } from './process-lit-action-response-strategy';
3-
import { assert } from 'console';
46

57
describe('processLitActionResponseStrategy', () => {
68
const litActionResponses: any[] = [
@@ -11,7 +13,6 @@ describe('processLitActionResponseStrategy', () => {
1113
sigType: 'K256',
1214
dataSigned: 'fail',
1315
signatureShare: '',
14-
shareIndex: 0,
1516
bigR: '',
1617
publicKey: '',
1718
sigName: 'sig',
@@ -29,7 +30,6 @@ describe('processLitActionResponseStrategy', () => {
2930
sigType: 'K256',
3031
dataSigned: 'fail',
3132
signatureShare: '',
32-
shareIndex: 0,
3333
bigR: '',
3434
publicKey: '',
3535
sigName: 'sig',
@@ -49,7 +49,6 @@ describe('processLitActionResponseStrategy', () => {
4949
'"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"',
5050
signatureShare:
5151
'"E90BAE64AFA7C571CE41BEF25FF771CA2F1BC20FC09A7762200552B30ACC0CDC"',
52-
shareIndex: 0,
5352
bigR: '"02330092EBF809B05EA0A032A42AD2FE32579D997A739D7BB4CF40EBA83B4355D3"',
5453
publicKey:
5554
'"047E3AC46588256338E62D8763592B8AA9BD13C31C9326D51CE82254A1839759A4FE7C1281AA1A9F8E810DA52B72046731CB3EE4D213799F7CE26C55A63783DB78"',
@@ -70,7 +69,6 @@ describe('processLitActionResponseStrategy', () => {
7069
'"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"',
7170
signatureShare:
7271
'"31977D4BE7F49C0CD97CC0756CCA3244A949EA7D591F79B64F324846507448CD"',
73-
shareIndex: 0,
7472
bigR: '"02330092EBF809B05EA0A032A42AD2FE32579D997A739D7BB4CF40EBA83B4355D3"',
7573
publicKey:
7674
'"047E3AC46588256338E62D8763592B8AA9BD13C31C9326D51CE82254A1839759A4FE7C1281AA1A9F8E810DA52B72046731CB3EE4D213799F7CE26C55A63783DB78"',
@@ -91,7 +89,6 @@ describe('processLitActionResponseStrategy', () => {
9189
'"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"',
9290
signatureShare:
9391
'"F21798A1A37CC86566EA0D751F37CC144774A1A8A4FCD5E6E64287690FB60119"',
94-
shareIndex: 0,
9592
bigR: '"02330092EBF809B05EA0A032A42AD2FE32579D997A739D7BB4CF40EBA83B4355D3"',
9693
publicKey:
9794
'"047E3AC46588256338E62D8763592B8AA9BD13C31C9326D51CE82254A1839759A4FE7C1281AA1A9F8E810DA52B72046731CB3EE4D213799F7CE26C55A63783DB78"',
@@ -112,7 +109,6 @@ describe('processLitActionResponseStrategy', () => {
112109
'"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"',
113110
signatureShare:
114111
'"7ECB0E020BED801905D3FE941751E4313086603BBBF21F1756832F02A6FBE567"',
115-
shareIndex: 0,
116112
bigR: '"02330092EBF809B05EA0A032A42AD2FE32579D997A739D7BB4CF40EBA83B4355D3"',
117113
publicKey:
118114
'"047E3AC46588256338E62D8763592B8AA9BD13C31C9326D51CE82254A1839759A4FE7C1281AA1A9F8E810DA52B72046731CB3EE4D213799F7CE26C55A63783DB78"',
@@ -134,7 +130,6 @@ describe('processLitActionResponseStrategy', () => {
134130
sigType: 'K256',
135131
dataSigned: 'fail',
136132
signatureShare: '',
137-
shareIndex: 0,
138133
bigR: '',
139134
publicKey: '',
140135
sigName: 'sig',
@@ -152,7 +147,6 @@ describe('processLitActionResponseStrategy', () => {
152147
sigType: 'K256',
153148
dataSigned: 'fail',
154149
signatureShare: '',
155-
shareIndex: 0,
156150
bigR: '',
157151
publicKey: '',
158152
sigName: 'sig',
@@ -172,7 +166,6 @@ describe('processLitActionResponseStrategy', () => {
172166
'"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"',
173167
signatureShare:
174168
'"E90BAE64AFA7C571CE41BEF25FF771CA2F1BC20FC09A7762200552B30ACC0CDC"',
175-
shareIndex: 0,
176169
bigR: '"02330092EBF809B05EA0A032A42AD2FE32579D997A739D7BB4CF40EBA83B4355D3"',
177170
publicKey:
178171
'"047E3AC46588256338E62D8763592B8AA9BD13C31C9326D51CE82254A1839759A4FE7C1281AA1A9F8E810DA52B72046731CB3EE4D213799F7CE26C55A63783DB78"',
@@ -193,7 +186,6 @@ describe('processLitActionResponseStrategy', () => {
193186
'"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"',
194187
signatureShare:
195188
'"31977D4BE7F49C0CD97CC0756CCA3244A949EA7D591F79B64F324846507448CD"',
196-
shareIndex: 0,
197189
bigR: '"02330092EBF809B05EA0A032A42AD2FE32579D997A739D7BB4CF40EBA83B4355D3"',
198190
publicKey:
199191
'"047E3AC46588256338E62D8763592B8AA9BD13C31C9326D51CE82254A1839759A4FE7C1281AA1A9F8E810DA52B72046731CB3EE4D213799F7CE26C55A63783DB78"',
@@ -214,7 +206,6 @@ describe('processLitActionResponseStrategy', () => {
214206
'"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"',
215207
signatureShare:
216208
'"F21798A1A37CC86566EA0D751F37CC144774A1A8A4FCD5E6E64287690FB60119"',
217-
shareIndex: 0,
218209
bigR: '"02330092EBF809B05EA0A032A42AD2FE32579D997A739D7BB4CF40EBA83B4355D3"',
219210
publicKey:
220211
'"047E3AC46588256338E62D8763592B8AA9BD13C31C9326D51CE82254A1839759A4FE7C1281AA1A9F8E810DA52B72046731CB3EE4D213799F7CE26C55A63783DB78"',
@@ -235,7 +226,6 @@ describe('processLitActionResponseStrategy', () => {
235226
'"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"',
236227
signatureShare:
237228
'"7ECB0E020BED801905D3FE941751E4313086603BBBF21F1756832F02A6FBE567"',
238-
shareIndex: 0,
239229
bigR: '"02330092EBF809B05EA0A032A42AD2FE32579D997A739D7BB4CF40EBA83B4355D3"',
240230
publicKey:
241231
'"047E3AC46588256338E62D8763592B8AA9BD13C31C9326D51CE82254A1839759A4FE7C1281AA1A9F8E810DA52B72046731CB3EE4D213799F7CE26C55A63783DB78"',
@@ -249,21 +239,21 @@ describe('processLitActionResponseStrategy', () => {
249239
},
250240
];
251241
it('should find least common response', () => {
252-
let resp = processLitActionResponseStrategy(litActionResponses, {
242+
const resp = processLitActionResponseStrategy(litActionResponses, {
253243
strategy: 'leastCommon',
254244
});
255245
expect(resp).toBe('{"hello":"world","res": "71"}');
256246
});
257247

258248
it('should find most common response', () => {
259-
let resp = processLitActionResponseStrategy(litActionResponses, {
249+
const resp = processLitActionResponseStrategy(litActionResponses, {
260250
strategy: 'mostCommon',
261251
});
262252
expect(resp).toBe('{"hello":"world","res":{}}');
263253
});
264254

265255
it('should find most common response', () => {
266-
let resp = processLitActionResponseStrategy(litActionResponses, {
256+
const resp = processLitActionResponseStrategy(litActionResponses, {
267257
strategy: 'custom',
268258
customFilter: (responses) => {
269259
return responses[0];
@@ -274,15 +264,15 @@ describe('processLitActionResponseStrategy', () => {
274264
});
275265

276266
it('should find most common response non json', () => {
277-
let resp = processLitActionResponseStrategy(litActionResponsesNonJson, {
267+
const resp = processLitActionResponseStrategy(litActionResponsesNonJson, {
278268
strategy: 'mostCommon',
279269
});
280270
expect(resp).toBeDefined();
281271
expect(resp).toBe('Hello World');
282272
});
283273

284274
it('should find least common response non json', () => {
285-
let resp = processLitActionResponseStrategy(litActionResponsesNonJson, {
275+
const resp = processLitActionResponseStrategy(litActionResponsesNonJson, {
286276
strategy: 'leastCommon',
287277
});
288278
expect(resp).toBeDefined();

packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
UnsupportedMethodError,
3535
WalletSignatureNotFoundError,
3636
} from '@lit-protocol/constants';
37+
import { LitContracts } from '@lit-protocol/contracts-sdk';
3738
import { LitCore, composeLitUrl } from '@lit-protocol/core';
3839
import {
3940
combineSignatureShares,
@@ -133,7 +134,6 @@ import type {
133134
Signature,
134135
SuccessNodePromises,
135136
} from '@lit-protocol/types';
136-
import { LitContracts } from '@lit-protocol/contracts-sdk';
137137

138138
export class LitNodeClientNodeJs
139139
extends LitCore
@@ -621,10 +621,6 @@ export class LitNodeClientNodeJs
621621
logErrorWithRequestId(requestId, msg);
622622
}
623623

624-
// ========== Sorting ==========
625-
// -- sort the sig shares by share index. this is important when combining the shares.
626-
signatureShares.sort((a, b) => a.shareIndex - b.shareIndex);
627-
628624
// ========== Combine Shares ==========
629625
const signature = await combineSignatureShares(
630626
signatureShares.map((s) => s.signatureShare)
@@ -1610,9 +1606,12 @@ export class LitNodeClientNodeJs
16101606
siweMessage = await createSiweMessage(siweParams);
16111607
}
16121608

1609+
const nodeSet = await this._getNodeSet();
1610+
16131611
// ========== Get Node Promises ==========
16141612
// -- fetch shares from nodes
16151613
const body: JsonSignSessionKeyRequestV1 = {
1614+
nodeSet,
16161615
sessionKey: sessionKeyUri,
16171616
authMethods: params.authMethods,
16181617
...(params?.pkpPublicKey && { pkpPublicKey: params.pkpPublicKey }),
@@ -1681,7 +1680,7 @@ export class LitNodeClientNodeJs
16811680

16821681
// ========== Extract shares from response data ==========
16831682
// -- 1. combine signed data as a list, and get the signatures from it
1684-
let curveType = responseData[0]?.curveType;
1683+
const curveType = responseData[0]?.curveType;
16851684

16861685
if (curveType === 'ECDSA') {
16871686
throw new Error(
@@ -1721,7 +1720,6 @@ export class LitNodeClientNodeJs
17211720
const requiredFields = [
17221721
'signatureShare',
17231722
'curveType',
1724-
'shareIndex',
17251723
'siweMessage',
17261724
'dataSigned',
17271725
'blsRootPubkey',

packages/types/src/lib/interfaces.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ export interface BlsResponseData {
352352
value: string;
353353
};
354354
};
355-
shareIndex: number;
356355
curveType: string;
357356
siweMessage: string;
358357
dataSigned: string;
@@ -678,7 +677,6 @@ export interface SigShare {
678677
| 'EcdsaK256Sha256';
679678

680679
signatureShare: string;
681-
shareIndex?: number;
682680
bigr?: string; // backward compatibility
683681
bigR?: string;
684682
publicKey: string;
@@ -689,7 +687,6 @@ export interface SigShare {
689687

690688
export interface PkpSignedData {
691689
digest: string;
692-
shareIndex: number;
693690
signatureShare: string;
694691
bigR: string;
695692
publicKey: string;
@@ -698,7 +695,6 @@ export interface PkpSignedData {
698695
}
699696
export interface NodeShare {
700697
claimData: any;
701-
shareIndex: any;
702698

703699
// I think this is deprecated
704700
unsignedJwt: any;
@@ -716,7 +712,6 @@ export interface PKPSignShare {
716712
}
717713

718714
export interface NodeBlsSigningShare {
719-
shareIndex: any;
720715
unsignedJwt?: any;
721716
signatureShare: BlsSignatureShare;
722717
response?: any;

packages/wasm/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export async function ecdsaVerify(
208208
* @param {Uint8Array} public_key
209209
* @param {[Uint8Array, Uint8Array, number]} signature
210210
*/
211-
export async function ecdsaCombnieAndVerify(
211+
export async function ecdsaCombineAndVerify(
212212
variant: EcdsaVariant,
213213
pre_signature: Uint8Array,
214214
signature_shares: Uint8Array[],

0 commit comments

Comments
 (0)