@aztec/node-keystore 2.0.0-nightly.20250829 → 2.0.0-nightly.20250830

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"keystore_manager.d.ts","sourceRoot":"","sources":["../src/keystore_manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAKjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAIhD,OAAO,KAAK,EAEV,WAAW,EAKX,qBAAqB,EACrB,QAAQ,EACR,cAAc,EACd,iBAAiB,IAAI,uBAAuB,EAC7C,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IAGpB,KAAK,CAAC,EAAE,KAAK;gBAD7B,OAAO,EAAE,MAAM,EACC,KAAK,CAAC,EAAE,KAAK,YAAA;CAKhC;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IAEpC;;;;OAIG;gBACS,QAAQ,EAAE,QAAQ;IAK9B;;;;;OAKG;IACH,OAAO,CAAC,+BAA+B;IAkBvC;;;OAGG;IACH,OAAO,CAAC,0CAA0C;IAiElD;;OAEG;IACH,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,EAAE;IAK1D;;OAEG;IACH,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,EAAE;IAc3D,kCAAkC,IAAI,SAAS,EAAE;IAWjD;;OAEG;IACH,oBAAoB,IAAI,SAAS,EAAE;IAQnC;;OAEG;IACH,mBAAmB,I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AAW,GAAG,SAAS;IAI7C;;;OAGG;IACH,eAAe,IAAI,cAAc,GAAG,SAAS;IAI7C;;;OAGG;IACH,uCAAuC,IAAI,IAAI;IAqB/C;;OAEG;IACH,OAAO,CAAC,4BAA4B;IA+BpC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA+ClC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAkD9B;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAwBxC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA8BjC;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAI3E;;OAEG;IACG,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IAI1F;;;OAGG;IACH,8BAA8B,CAC5B,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,UAAU,GAC1B,qBAAqB,GAAG,SAAS;CAiIrC"}
@@ -155,15 +155,10 @@ import { LocalSigner, RemoteSigner } from './signer.js';
155
155
  signers
156
156
  };
157
157
  }
158
- // Handle complex prover case with id and publishers
159
- const proverConfig = this.keystore.prover;
160
- const signers = [];
161
- for (const publisherAccounts of proverConfig.publisher){
162
- const publisherSigners = this.createSignersFromEthAccounts(publisherAccounts, this.keystore.remoteSigner);
163
- signers.push(...publisherSigners);
164
- }
158
+ const id = EthAddress.fromString(this.keystore.prover.id);
159
+ const signers = this.createSignersFromEthAccounts(this.keystore.prover.publisher, this.keystore.remoteSigner);
165
160
  return {
166
- id: EthAddress.fromString(proverConfig.id),
161
+ id,
167
162
  signers
168
163
  };
169
164
  }
package/dest/schemas.d.ts CHANGED
@@ -26,6 +26,24 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
26
26
  }, {
27
27
  path: string;
28
28
  password?: string | undefined;
29
+ }>, z.ZodObject<{
30
+ mnemonic: z.ZodString;
31
+ addressIndex: z.ZodOptional<z.ZodNumber>;
32
+ accountIndex: z.ZodOptional<z.ZodNumber>;
33
+ addressCount: z.ZodOptional<z.ZodNumber>;
34
+ accountCount: z.ZodOptional<z.ZodNumber>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ mnemonic: string;
37
+ addressIndex?: number | undefined;
38
+ accountIndex?: number | undefined;
39
+ addressCount?: number | undefined;
40
+ accountCount?: number | undefined;
41
+ }, {
42
+ mnemonic: string;
43
+ addressIndex?: number | undefined;
44
+ accountIndex?: number | undefined;
45
+ addressCount?: number | undefined;
46
+ accountCount?: number | undefined;
29
47
  }>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodObject<{
30
48
  address: z.ZodEffects<z.ZodString, string, string>;
31
49
  remoteSignerUrl: z.ZodOptional<z.ZodString>;
@@ -50,7 +68,7 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
50
68
  }, {
51
69
  path: string;
52
70
  password?: string | undefined;
53
- }>]>, "many">, z.ZodObject<{
71
+ }>, z.ZodObject<{
54
72
  mnemonic: z.ZodString;
55
73
  addressIndex: z.ZodOptional<z.ZodNumber>;
56
74
  accountIndex: z.ZodOptional<z.ZodNumber>;
@@ -68,7 +86,7 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
68
86
  accountIndex?: number | undefined;
69
87
  addressCount?: number | undefined;
70
88
  accountCount?: number | undefined;
71
- }>]>;
89
+ }>]>, "many">]>;
72
90
  coinbase: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
73
91
  publisher: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodObject<{
74
92
  address: z.ZodEffects<z.ZodString, string, string>;
@@ -94,6 +112,24 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
94
112
  }, {
95
113
  path: string;
96
114
  password?: string | undefined;
115
+ }>, z.ZodObject<{
116
+ mnemonic: z.ZodString;
117
+ addressIndex: z.ZodOptional<z.ZodNumber>;
118
+ accountIndex: z.ZodOptional<z.ZodNumber>;
119
+ addressCount: z.ZodOptional<z.ZodNumber>;
120
+ accountCount: z.ZodOptional<z.ZodNumber>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ mnemonic: string;
123
+ addressIndex?: number | undefined;
124
+ accountIndex?: number | undefined;
125
+ addressCount?: number | undefined;
126
+ accountCount?: number | undefined;
127
+ }, {
128
+ mnemonic: string;
129
+ addressIndex?: number | undefined;
130
+ accountIndex?: number | undefined;
131
+ addressCount?: number | undefined;
132
+ accountCount?: number | undefined;
97
133
  }>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodObject<{
98
134
  address: z.ZodEffects<z.ZodString, string, string>;
99
135
  remoteSignerUrl: z.ZodOptional<z.ZodString>;
@@ -118,7 +154,7 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
118
154
  }, {
119
155
  path: string;
120
156
  password?: string | undefined;
121
- }>]>, "many">, z.ZodObject<{
157
+ }>, z.ZodObject<{
122
158
  mnemonic: z.ZodString;
123
159
  addressIndex: z.ZodOptional<z.ZodNumber>;
124
160
  accountIndex: z.ZodOptional<z.ZodNumber>;
@@ -136,7 +172,7 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
136
172
  accountIndex?: number | undefined;
137
173
  addressCount?: number | undefined;
138
174
  accountCount?: number | undefined;
139
- }>]>>;
175
+ }>]>, "many">]>>;
140
176
  feeRecipient: z.ZodEffects<z.ZodString, string, string>;
141
177
  remoteSigner: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodObject<{
142
178
  remoteSignerUrl: z.ZodString;
@@ -174,6 +210,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
174
210
  } | {
175
211
  path: string;
176
212
  password?: string | undefined;
213
+ } | {
214
+ mnemonic: string;
215
+ addressIndex?: number | undefined;
216
+ accountIndex?: number | undefined;
217
+ addressCount?: number | undefined;
218
+ accountCount?: number | undefined;
177
219
  })[];
178
220
  feeRecipient: string;
179
221
  publisher?: string | {
@@ -198,6 +240,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
198
240
  } | {
199
241
  path: string;
200
242
  password?: string | undefined;
243
+ } | {
244
+ mnemonic: string;
245
+ addressIndex?: number | undefined;
246
+ accountIndex?: number | undefined;
247
+ addressCount?: number | undefined;
248
+ accountCount?: number | undefined;
201
249
  })[] | undefined;
202
250
  coinbase?: string | undefined;
203
251
  remoteSigner?: string | {
@@ -228,6 +276,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
228
276
  } | {
229
277
  path: string;
230
278
  password?: string | undefined;
279
+ } | {
280
+ mnemonic: string;
281
+ addressIndex?: number | undefined;
282
+ accountIndex?: number | undefined;
283
+ addressCount?: number | undefined;
284
+ accountCount?: number | undefined;
231
285
  })[];
232
286
  feeRecipient: string;
233
287
  publisher?: string | {
@@ -252,6 +306,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
252
306
  } | {
253
307
  path: string;
254
308
  password?: string | undefined;
309
+ } | {
310
+ mnemonic: string;
311
+ addressIndex?: number | undefined;
312
+ accountIndex?: number | undefined;
313
+ addressCount?: number | undefined;
314
+ accountCount?: number | undefined;
255
315
  })[] | undefined;
256
316
  coinbase?: string | undefined;
257
317
  remoteSigner?: string | {
@@ -284,6 +344,24 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
284
344
  }, {
285
345
  path: string;
286
346
  password?: string | undefined;
347
+ }>, z.ZodObject<{
348
+ mnemonic: z.ZodString;
349
+ addressIndex: z.ZodOptional<z.ZodNumber>;
350
+ accountIndex: z.ZodOptional<z.ZodNumber>;
351
+ addressCount: z.ZodOptional<z.ZodNumber>;
352
+ accountCount: z.ZodOptional<z.ZodNumber>;
353
+ }, "strip", z.ZodTypeAny, {
354
+ mnemonic: string;
355
+ addressIndex?: number | undefined;
356
+ accountIndex?: number | undefined;
357
+ addressCount?: number | undefined;
358
+ accountCount?: number | undefined;
359
+ }, {
360
+ mnemonic: string;
361
+ addressIndex?: number | undefined;
362
+ accountIndex?: number | undefined;
363
+ addressCount?: number | undefined;
364
+ accountCount?: number | undefined;
287
365
  }>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodObject<{
288
366
  address: z.ZodEffects<z.ZodString, string, string>;
289
367
  remoteSignerUrl: z.ZodOptional<z.ZodString>;
@@ -308,7 +386,7 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
308
386
  }, {
309
387
  path: string;
310
388
  password?: string | undefined;
311
- }>]>, "many">, z.ZodObject<{
389
+ }>, z.ZodObject<{
312
390
  mnemonic: z.ZodString;
313
391
  addressIndex: z.ZodOptional<z.ZodNumber>;
314
392
  accountIndex: z.ZodOptional<z.ZodNumber>;
@@ -326,7 +404,7 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
326
404
  accountIndex?: number | undefined;
327
405
  addressCount?: number | undefined;
328
406
  accountCount?: number | undefined;
329
- }>]>>;
407
+ }>]>, "many">]>>;
330
408
  remoteSigner: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodObject<{
331
409
  remoteSignerUrl: z.ZodString;
332
410
  certPath: z.ZodOptional<z.ZodString>;
@@ -364,9 +442,27 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
364
442
  }, {
365
443
  path: string;
366
444
  password?: string | undefined;
445
+ }>, z.ZodObject<{
446
+ mnemonic: z.ZodString;
447
+ addressIndex: z.ZodOptional<z.ZodNumber>;
448
+ accountIndex: z.ZodOptional<z.ZodNumber>;
449
+ addressCount: z.ZodOptional<z.ZodNumber>;
450
+ accountCount: z.ZodOptional<z.ZodNumber>;
451
+ }, "strip", z.ZodTypeAny, {
452
+ mnemonic: string;
453
+ addressIndex?: number | undefined;
454
+ accountIndex?: number | undefined;
455
+ addressCount?: number | undefined;
456
+ accountCount?: number | undefined;
457
+ }, {
458
+ mnemonic: string;
459
+ addressIndex?: number | undefined;
460
+ accountIndex?: number | undefined;
461
+ addressCount?: number | undefined;
462
+ accountCount?: number | undefined;
367
463
  }>]>, z.ZodObject<{
368
464
  id: z.ZodEffects<z.ZodString, string, string>;
369
- publisher: z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodObject<{
465
+ publisher: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodObject<{
370
466
  address: z.ZodEffects<z.ZodString, string, string>;
371
467
  remoteSignerUrl: z.ZodOptional<z.ZodString>;
372
468
  certPath: z.ZodOptional<z.ZodString>;
@@ -390,6 +486,24 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
390
486
  }, {
391
487
  path: string;
392
488
  password?: string | undefined;
489
+ }>, z.ZodObject<{
490
+ mnemonic: z.ZodString;
491
+ addressIndex: z.ZodOptional<z.ZodNumber>;
492
+ accountIndex: z.ZodOptional<z.ZodNumber>;
493
+ addressCount: z.ZodOptional<z.ZodNumber>;
494
+ accountCount: z.ZodOptional<z.ZodNumber>;
495
+ }, "strip", z.ZodTypeAny, {
496
+ mnemonic: string;
497
+ addressIndex?: number | undefined;
498
+ accountIndex?: number | undefined;
499
+ addressCount?: number | undefined;
500
+ accountCount?: number | undefined;
501
+ }, {
502
+ mnemonic: string;
503
+ addressIndex?: number | undefined;
504
+ accountIndex?: number | undefined;
505
+ addressCount?: number | undefined;
506
+ accountCount?: number | undefined;
393
507
  }>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodObject<{
394
508
  address: z.ZodEffects<z.ZodString, string, string>;
395
509
  remoteSignerUrl: z.ZodOptional<z.ZodString>;
@@ -414,7 +528,7 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
414
528
  }, {
415
529
  path: string;
416
530
  password?: string | undefined;
417
- }>]>, "many">, z.ZodObject<{
531
+ }>, z.ZodObject<{
418
532
  mnemonic: z.ZodString;
419
533
  addressIndex: z.ZodOptional<z.ZodNumber>;
420
534
  accountIndex: z.ZodOptional<z.ZodNumber>;
@@ -432,10 +546,10 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
432
546
  accountIndex?: number | undefined;
433
547
  addressCount?: number | undefined;
434
548
  accountCount?: number | undefined;
435
- }>]>, "many">;
549
+ }>]>, "many">]>;
436
550
  }, "strip", z.ZodTypeAny, {
437
551
  id: string;
438
- publisher: (string | {
552
+ publisher: string | {
439
553
  address: string;
440
554
  remoteSignerUrl?: string | undefined;
441
555
  certPath?: string | undefined;
@@ -457,10 +571,16 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
457
571
  } | {
458
572
  path: string;
459
573
  password?: string | undefined;
460
- })[])[];
574
+ } | {
575
+ mnemonic: string;
576
+ addressIndex?: number | undefined;
577
+ accountIndex?: number | undefined;
578
+ addressCount?: number | undefined;
579
+ accountCount?: number | undefined;
580
+ })[];
461
581
  }, {
462
582
  id: string;
463
- publisher: (string | {
583
+ publisher: string | {
464
584
  address: string;
465
585
  remoteSignerUrl?: string | undefined;
466
586
  certPath?: string | undefined;
@@ -482,7 +602,13 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
482
602
  } | {
483
603
  path: string;
484
604
  password?: string | undefined;
485
- })[])[];
605
+ } | {
606
+ mnemonic: string;
607
+ addressIndex?: number | undefined;
608
+ accountIndex?: number | undefined;
609
+ addressCount?: number | undefined;
610
+ accountCount?: number | undefined;
611
+ })[];
486
612
  }>]>>;
487
613
  }, "strip", z.ZodTypeAny, {
488
614
  schemaVersion: 1;
@@ -514,6 +640,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
514
640
  } | {
515
641
  path: string;
516
642
  password?: string | undefined;
643
+ } | {
644
+ mnemonic: string;
645
+ addressIndex?: number | undefined;
646
+ accountIndex?: number | undefined;
647
+ addressCount?: number | undefined;
648
+ accountCount?: number | undefined;
517
649
  })[];
518
650
  feeRecipient: string;
519
651
  publisher?: string | {
@@ -538,6 +670,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
538
670
  } | {
539
671
  path: string;
540
672
  password?: string | undefined;
673
+ } | {
674
+ mnemonic: string;
675
+ addressIndex?: number | undefined;
676
+ accountIndex?: number | undefined;
677
+ addressCount?: number | undefined;
678
+ accountCount?: number | undefined;
541
679
  })[] | undefined;
542
680
  coinbase?: string | undefined;
543
681
  remoteSigner?: string | {
@@ -568,6 +706,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
568
706
  } | {
569
707
  path: string;
570
708
  password?: string | undefined;
709
+ } | {
710
+ mnemonic: string;
711
+ addressIndex?: number | undefined;
712
+ accountIndex?: number | undefined;
713
+ addressCount?: number | undefined;
714
+ accountCount?: number | undefined;
571
715
  })[] | undefined;
572
716
  prover?: string | {
573
717
  address: string;
@@ -577,9 +721,15 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
577
721
  } | {
578
722
  path: string;
579
723
  password?: string | undefined;
724
+ } | {
725
+ mnemonic: string;
726
+ addressIndex?: number | undefined;
727
+ accountIndex?: number | undefined;
728
+ addressCount?: number | undefined;
729
+ accountCount?: number | undefined;
580
730
  } | {
581
731
  id: string;
582
- publisher: (string | {
732
+ publisher: string | {
583
733
  address: string;
584
734
  remoteSignerUrl?: string | undefined;
585
735
  certPath?: string | undefined;
@@ -601,7 +751,13 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
601
751
  } | {
602
752
  path: string;
603
753
  password?: string | undefined;
604
- })[])[];
754
+ } | {
755
+ mnemonic: string;
756
+ addressIndex?: number | undefined;
757
+ accountIndex?: number | undefined;
758
+ addressCount?: number | undefined;
759
+ accountCount?: number | undefined;
760
+ })[];
605
761
  } | undefined;
606
762
  }, {
607
763
  schemaVersion: 1;
@@ -633,6 +789,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
633
789
  } | {
634
790
  path: string;
635
791
  password?: string | undefined;
792
+ } | {
793
+ mnemonic: string;
794
+ addressIndex?: number | undefined;
795
+ accountIndex?: number | undefined;
796
+ addressCount?: number | undefined;
797
+ accountCount?: number | undefined;
636
798
  })[];
637
799
  feeRecipient: string;
638
800
  publisher?: string | {
@@ -657,6 +819,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
657
819
  } | {
658
820
  path: string;
659
821
  password?: string | undefined;
822
+ } | {
823
+ mnemonic: string;
824
+ addressIndex?: number | undefined;
825
+ accountIndex?: number | undefined;
826
+ addressCount?: number | undefined;
827
+ accountCount?: number | undefined;
660
828
  })[] | undefined;
661
829
  coinbase?: string | undefined;
662
830
  remoteSigner?: string | {
@@ -687,6 +855,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
687
855
  } | {
688
856
  path: string;
689
857
  password?: string | undefined;
858
+ } | {
859
+ mnemonic: string;
860
+ addressIndex?: number | undefined;
861
+ accountIndex?: number | undefined;
862
+ addressCount?: number | undefined;
863
+ accountCount?: number | undefined;
690
864
  })[] | undefined;
691
865
  prover?: string | {
692
866
  address: string;
@@ -696,9 +870,15 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
696
870
  } | {
697
871
  path: string;
698
872
  password?: string | undefined;
873
+ } | {
874
+ mnemonic: string;
875
+ addressIndex?: number | undefined;
876
+ accountIndex?: number | undefined;
877
+ addressCount?: number | undefined;
878
+ accountCount?: number | undefined;
699
879
  } | {
700
880
  id: string;
701
- publisher: (string | {
881
+ publisher: string | {
702
882
  address: string;
703
883
  remoteSignerUrl?: string | undefined;
704
884
  certPath?: string | undefined;
@@ -720,7 +900,13 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
720
900
  } | {
721
901
  path: string;
722
902
  password?: string | undefined;
723
- })[])[];
903
+ } | {
904
+ mnemonic: string;
905
+ addressIndex?: number | undefined;
906
+ accountIndex?: number | undefined;
907
+ addressCount?: number | undefined;
908
+ accountCount?: number | undefined;
909
+ })[];
724
910
  } | undefined;
725
911
  }>, {
726
912
  schemaVersion: 1;
@@ -752,6 +938,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
752
938
  } | {
753
939
  path: string;
754
940
  password?: string | undefined;
941
+ } | {
942
+ mnemonic: string;
943
+ addressIndex?: number | undefined;
944
+ accountIndex?: number | undefined;
945
+ addressCount?: number | undefined;
946
+ accountCount?: number | undefined;
755
947
  })[];
756
948
  feeRecipient: string;
757
949
  publisher?: string | {
@@ -776,6 +968,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
776
968
  } | {
777
969
  path: string;
778
970
  password?: string | undefined;
971
+ } | {
972
+ mnemonic: string;
973
+ addressIndex?: number | undefined;
974
+ accountIndex?: number | undefined;
975
+ addressCount?: number | undefined;
976
+ accountCount?: number | undefined;
779
977
  })[] | undefined;
780
978
  coinbase?: string | undefined;
781
979
  remoteSigner?: string | {
@@ -806,6 +1004,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
806
1004
  } | {
807
1005
  path: string;
808
1006
  password?: string | undefined;
1007
+ } | {
1008
+ mnemonic: string;
1009
+ addressIndex?: number | undefined;
1010
+ accountIndex?: number | undefined;
1011
+ addressCount?: number | undefined;
1012
+ accountCount?: number | undefined;
809
1013
  })[] | undefined;
810
1014
  prover?: string | {
811
1015
  address: string;
@@ -815,9 +1019,15 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
815
1019
  } | {
816
1020
  path: string;
817
1021
  password?: string | undefined;
1022
+ } | {
1023
+ mnemonic: string;
1024
+ addressIndex?: number | undefined;
1025
+ accountIndex?: number | undefined;
1026
+ addressCount?: number | undefined;
1027
+ accountCount?: number | undefined;
818
1028
  } | {
819
1029
  id: string;
820
- publisher: (string | {
1030
+ publisher: string | {
821
1031
  address: string;
822
1032
  remoteSignerUrl?: string | undefined;
823
1033
  certPath?: string | undefined;
@@ -839,7 +1049,13 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
839
1049
  } | {
840
1050
  path: string;
841
1051
  password?: string | undefined;
842
- })[])[];
1052
+ } | {
1053
+ mnemonic: string;
1054
+ addressIndex?: number | undefined;
1055
+ accountIndex?: number | undefined;
1056
+ addressCount?: number | undefined;
1057
+ accountCount?: number | undefined;
1058
+ })[];
843
1059
  } | undefined;
844
1060
  }, {
845
1061
  schemaVersion: 1;
@@ -871,6 +1087,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
871
1087
  } | {
872
1088
  path: string;
873
1089
  password?: string | undefined;
1090
+ } | {
1091
+ mnemonic: string;
1092
+ addressIndex?: number | undefined;
1093
+ accountIndex?: number | undefined;
1094
+ addressCount?: number | undefined;
1095
+ accountCount?: number | undefined;
874
1096
  })[];
875
1097
  feeRecipient: string;
876
1098
  publisher?: string | {
@@ -895,6 +1117,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
895
1117
  } | {
896
1118
  path: string;
897
1119
  password?: string | undefined;
1120
+ } | {
1121
+ mnemonic: string;
1122
+ addressIndex?: number | undefined;
1123
+ accountIndex?: number | undefined;
1124
+ addressCount?: number | undefined;
1125
+ accountCount?: number | undefined;
898
1126
  })[] | undefined;
899
1127
  coinbase?: string | undefined;
900
1128
  remoteSigner?: string | {
@@ -925,6 +1153,12 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
925
1153
  } | {
926
1154
  path: string;
927
1155
  password?: string | undefined;
1156
+ } | {
1157
+ mnemonic: string;
1158
+ addressIndex?: number | undefined;
1159
+ accountIndex?: number | undefined;
1160
+ addressCount?: number | undefined;
1161
+ accountCount?: number | undefined;
928
1162
  })[] | undefined;
929
1163
  prover?: string | {
930
1164
  address: string;
@@ -934,9 +1168,15 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
934
1168
  } | {
935
1169
  path: string;
936
1170
  password?: string | undefined;
1171
+ } | {
1172
+ mnemonic: string;
1173
+ addressIndex?: number | undefined;
1174
+ accountIndex?: number | undefined;
1175
+ addressCount?: number | undefined;
1176
+ accountCount?: number | undefined;
937
1177
  } | {
938
1178
  id: string;
939
- publisher: (string | {
1179
+ publisher: string | {
940
1180
  address: string;
941
1181
  remoteSignerUrl?: string | undefined;
942
1182
  certPath?: string | undefined;
@@ -958,7 +1198,13 @@ export declare const keystoreSchema: z.ZodEffects<z.ZodObject<{
958
1198
  } | {
959
1199
  path: string;
960
1200
  password?: string | undefined;
961
- })[])[];
1201
+ } | {
1202
+ mnemonic: string;
1203
+ addressIndex?: number | undefined;
1204
+ accountIndex?: number | undefined;
1205
+ addressCount?: number | undefined;
1206
+ accountCount?: number | undefined;
1207
+ })[];
962
1208
  } | undefined;
963
1209
  }>;
964
1210
  export type KeyStoreSchema = z.infer<typeof keystoreSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuExB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ED
@@ -44,20 +44,20 @@ const mnemonicConfigSchema = z.object({
44
44
  const ethAccountSchema = z.union([
45
45
  ethPrivateKeySchema,
46
46
  remoteSignerAccountSchema,
47
- jsonKeyFileV3Schema
47
+ jsonKeyFileV3Schema,
48
+ mnemonicConfigSchema
48
49
  ]);
49
50
  // EthAccounts schema
50
51
  const ethAccountsSchema = z.union([
51
52
  ethAccountSchema,
52
- z.array(ethAccountSchema),
53
- mnemonicConfigSchema
53
+ z.array(ethAccountSchema)
54
54
  ]);
55
55
  // Prover keystore schema
56
56
  const proverKeyStoreSchema = z.union([
57
57
  ethAccountSchema,
58
58
  z.object({
59
59
  id: ethAddressSchema,
60
- publisher: z.array(ethAccountsSchema)
60
+ publisher: ethAccountsSchema
61
61
  })
62
62
  ]);
63
63
  // Validator keystore schema
package/dest/signer.d.ts CHANGED
@@ -13,11 +13,11 @@ import type { EthRemoteSignerConfig } from './types.js';
13
13
  * Error thrown for remote signer HTTP or JSON-RPC failures
14
14
  */
15
15
  export declare class SignerError extends Error {
16
- method: 'eth_sign' | 'eth_signTransaction' | 'eth_signTypedData_v4';
16
+ method: string;
17
17
  url: string;
18
18
  statusCode?: number | undefined;
19
19
  errorCode?: number | undefined;
20
- constructor(message: string, method: 'eth_sign' | 'eth_signTransaction' | 'eth_signTypedData_v4', url: string, statusCode?: number | undefined, errorCode?: number | undefined);
20
+ constructor(message: string, method: string, url: string, statusCode?: number | undefined, errorCode?: number | undefined);
21
21
  }
22
22
  /**
23
23
  * Local signer that holds an in-memory Secp256k1 private key.
@@ -63,9 +63,17 @@ export declare class RemoteSigner implements EthSigner {
63
63
  * Make a JSON-RPC eth_signTransaction request.
64
64
  */
65
65
  private makeJsonRpcSignTransactionRequest;
66
+ /**
67
+ * Sends a JSON-RPC request and returns its result
68
+ */
69
+ private makeJsonRpcRequest;
66
70
  /**
67
71
  * Resolve the effective remote signer URL from config.
68
72
  */
69
73
  private getSignerUrl;
74
+ /**
75
+ * Generate an id to use for a JSON-RPC call
76
+ */
77
+ private generateId;
70
78
  }
71
79
  //# sourceMappingURL=signer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAiC,MAAM,iCAAiC,CAAC;AAG3F,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EAKzB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IAG3B,MAAM,EAAE,UAAU,GAAG,qBAAqB,GAAG,sBAAsB;IACnE,GAAG,EAAE,MAAM;IACX,UAAU,CAAC,EAAE,MAAM;IACnB,SAAS,CAAC,EAAE,MAAM;gBAJzB,OAAO,EAAE,MAAM,EACR,MAAM,EAAE,UAAU,GAAG,qBAAqB,GAAG,sBAAsB,EACnE,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,SAAS,CAAC,EAAE,MAAM,YAAA;CAK5B;AAED;;GAEG;AACH,qBAAa,WAAY,YAAW,SAAS;IAG/B,OAAO,CAAC,UAAU;IAF9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;gBAErB,UAAU,EAAE,QAAQ;IAIxC,IAAI,OAAO,IAAI,UAAU,CAExB;IAED,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAIlD,aAAa,CAAC,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IAKjE,eAAe,CAAC,WAAW,EAAE,uBAAuB,GAAG,OAAO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
3
  *
4
4
  * Common interface for different signing backends (local, remote, encrypted)
5
5
  */ import { Buffer32 } from '@aztec/foundation/buffer';
6
- import { Secp256k1Signer, toRecoveryBit } from '@aztec/foundation/crypto';
6
+ import { Secp256k1Signer, randomBytes, toRecoveryBit } from '@aztec/foundation/crypto';
7
7
  import { Signature } from '@aztec/foundation/eth-signature';
8
+ import { jsonStringify } from '@aztec/foundation/json-rpc';
8
9
  import { withHexPrefix } from '@aztec/foundation/string';
9
10
  import { hashTypedData, keccak256, parseTransaction, serializeTransaction } from 'viem';
10
11
  /**
@@ -79,35 +80,10 @@ import { hashTypedData, keccak256, parseTransaction, serializeTransaction } from
79
80
  */ /**
80
81
  * Make a JSON-RPC eth_sign request.
81
82
  */ async makeJsonRpcSignRequest(data) {
82
- const url = this.getSignerUrl();
83
- const body = {
84
- jsonrpc: '2.0',
85
- method: 'eth_sign',
86
- params: [
87
- this.address.toString(),
88
- data.toString()
89
- ],
90
- id: 1
91
- };
92
- const response = await this.fetch(url, {
93
- method: 'POST',
94
- headers: {
95
- 'Content-Type': 'application/json'
96
- },
97
- body: JSON.stringify(body)
98
- });
99
- if (!response.ok) {
100
- const errorText = await response.text();
101
- throw new SignerError(`Web3Signer request failed for eth_sign at ${url}: ${response.status} ${response.statusText} - ${errorText}`, 'eth_sign', url, response.status);
83
+ let signatureHex = await this.makeJsonRpcRequest('eth_sign', this.address.toString(), data.toString());
84
+ if (typeof signatureHex !== 'string') {
85
+ throw new Error('Invalid signature');
102
86
  }
103
- const result = await response.json();
104
- if (result.error) {
105
- throw new SignerError(`Web3Signer JSON-RPC error for eth_sign at ${url}: ${result.error.code} - ${result.error.message}`, 'eth_sign', url, undefined, result.error.code);
106
- }
107
- if (!result.result) {
108
- throw new Error('Invalid response from Web3Signer: no result found');
109
- }
110
- let signatureHex = result.result;
111
87
  if (!signatureHex.startsWith('0x')) {
112
88
  signatureHex = '0x' + signatureHex;
113
89
  }
@@ -116,35 +92,10 @@ import { hashTypedData, keccak256, parseTransaction, serializeTransaction } from
116
92
  /**
117
93
  * Make a JSON-RPC eth_signTypedData_v4 request.
118
94
  */ async makeJsonRpcSignTypedDataRequest(typedData) {
119
- const url = this.getSignerUrl();
120
- const body = {
121
- jsonrpc: '2.0',
122
- method: 'eth_signTypedData_v4',
123
- params: [
124
- this.address.toString(),
125
- typedData
126
- ],
127
- id: 1
128
- };
129
- const response = await this.fetch(url, {
130
- method: 'POST',
131
- headers: {
132
- 'Content-Type': 'application/json'
133
- },
134
- body: JSON.stringify(body)
135
- });
136
- if (!response.ok) {
137
- const errorText = await response.text();
138
- throw new SignerError(`Web3Signer request failed for eth_signTypedData_v4 at ${url}: ${response.status} ${response.statusText} - ${errorText}`, 'eth_signTypedData_v4', url, response.status);
139
- }
140
- const result = await response.json();
141
- if (result.error) {
142
- throw new SignerError(`Web3Signer JSON-RPC error for eth_signTypedData_v4 at ${url}: ${result.error.code} - ${result.error.message}`, 'eth_signTypedData_v4', url, undefined, result.error.code);
95
+ let signatureHex = await this.makeJsonRpcRequest('eth_signTypedData', this.address.toString(), jsonStringify(typedData));
96
+ if (typeof signatureHex !== 'string') {
97
+ throw new Error('Invalid signature');
143
98
  }
144
- if (!result.result) {
145
- throw new Error('Invalid response from Web3Signer: no result found');
146
- }
147
- let signatureHex = result.result;
148
99
  if (!signatureHex.startsWith('0x')) {
149
100
  signatureHex = '0x' + signatureHex;
150
101
  }
@@ -156,7 +107,6 @@ import { hashTypedData, keccak256, parseTransaction, serializeTransaction } from
156
107
  if (tx.type !== 'eip1559') {
157
108
  throw new Error('This signer does not support tx type: ' + tx.type);
158
109
  }
159
- const url = this.getSignerUrl();
160
110
  const txObject = {
161
111
  from: this.address.toString(),
162
112
  to: tx.to ?? null,
@@ -167,42 +117,49 @@ import { hashTypedData, keccak256, parseTransaction, serializeTransaction } from
167
117
  maxFeePerGas: typeof tx.maxFeePerGas !== 'undefined' ? withHexPrefix(tx.maxFeePerGas.toString(16)) : undefined,
168
118
  maxPriorityFeePerGas: typeof tx.maxPriorityFeePerGas !== 'undefined' ? withHexPrefix(tx.maxPriorityFeePerGas.toString(16)) : undefined
169
119
  };
170
- const body = {
171
- jsonrpc: '2.0',
172
- method: 'eth_signTransaction',
173
- params: [
174
- txObject
175
- ],
176
- id: 1
177
- };
120
+ let rawTxHex = await this.makeJsonRpcRequest('eth_signTransaction', txObject);
121
+ if (typeof rawTxHex !== 'string') {
122
+ throw new Error('Invalid signed tx');
123
+ }
124
+ if (!rawTxHex.startsWith('0x')) {
125
+ rawTxHex = '0x' + rawTxHex;
126
+ }
127
+ // we get back to whole signed tx. Deserialize it in order to read the signature
128
+ const parsedTxWithSignature = parseTransaction(rawTxHex);
129
+ if (parsedTxWithSignature.r === undefined || parsedTxWithSignature.s === undefined || parsedTxWithSignature.v === undefined) {
130
+ throw new Error('Tx not signed by Web3Signer');
131
+ }
132
+ return Signature.fromViemTransactionSignature(parsedTxWithSignature);
133
+ }
134
+ /**
135
+ * Sends a JSON-RPC request and returns its result
136
+ */ async makeJsonRpcRequest(method, ...params) {
137
+ const url = this.getSignerUrl();
138
+ const id = this.generateId();
178
139
  const response = await this.fetch(url, {
179
140
  method: 'POST',
180
141
  headers: {
181
142
  'Content-Type': 'application/json'
182
143
  },
183
- body: JSON.stringify(body)
144
+ body: jsonStringify({
145
+ jsonrpc: '2.0',
146
+ method,
147
+ params,
148
+ id
149
+ })
184
150
  });
185
151
  if (!response.ok) {
186
152
  const errorText = await response.text();
187
- throw new SignerError(`Web3Signer request failed for eth_signTransaction at ${url}: ${response.status} ${response.statusText} - ${errorText}`, 'eth_signTransaction', url, response.status);
153
+ throw new SignerError(`Web3Signer request failed for ${method} at ${url}: ${response.status} ${response.statusText} - ${errorText}`, method, url, response.status);
188
154
  }
189
155
  const result = await response.json();
190
156
  if (result.error) {
191
- throw new SignerError(`Web3Signer JSON-RPC error for eth_signTransaction at ${url}: ${result.error.code} - ${result.error.message}`, 'eth_signTransaction', url, undefined, result.error.code);
157
+ throw new SignerError(`Web3Signer JSON-RPC error for ${method} at ${url}: ${result.error.code} - ${result.error.message}`, method, url, response.status, result.error.code);
192
158
  }
193
159
  if (!result.result) {
194
160
  throw new Error('Invalid response from Web3Signer: no result found');
195
161
  }
196
- let rawTxHex = result.result;
197
- if (!rawTxHex.startsWith('0x')) {
198
- rawTxHex = '0x' + rawTxHex;
199
- }
200
- // we get back to whole signed tx. Deserialize it in order to read the signature
201
- const parsedTxWithSignature = parseTransaction(rawTxHex);
202
- if (parsedTxWithSignature.r === undefined || parsedTxWithSignature.s === undefined || parsedTxWithSignature.v === undefined) {
203
- throw new Error('Tx not signed by Web3Signer');
204
- }
205
- return Signature.fromViemTransactionSignature(parsedTxWithSignature);
162
+ return result.result;
206
163
  }
207
164
  /**
208
165
  * Resolve the effective remote signer URL from config.
@@ -212,4 +169,9 @@ import { hashTypedData, keccak256, parseTransaction, serializeTransaction } from
212
169
  }
213
170
  return this.config.remoteSignerUrl;
214
171
  }
172
+ /**
173
+ * Generate an id to use for a JSON-RPC call
174
+ */ generateId() {
175
+ return randomBytes(4).toString('hex');
176
+ }
215
177
  }
package/dest/types.d.ts CHANGED
@@ -56,7 +56,7 @@ export type ProverKeyStore = {
56
56
  /** Address that identifies the prover. This address will receive the rewards. */
57
57
  id: EthAddressHex;
58
58
  /** One or more EOAs used for sending proof L1 txs. */
59
- publisher: EthAccounts[];
59
+ publisher: EthAccounts;
60
60
  } | EthAccount;
61
61
  export type ValidatorKeyStore = {
62
62
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8DAA8D;AAC9D,MAAM,MAAM,GAAG,CAAC,WAAW,SAAS,MAAM,IAAI,KAAK,MAAM,EAAE,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC;AAEhG,iIAAiI;AACjI,MAAM,MAAM,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IA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AAC,EAAE,qBAAqB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACjC,8GAA8G;IAC9G,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,sEAAsE;IACtE,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/node-keystore",
3
- "version": "2.0.0-nightly.20250829",
3
+ "version": "2.0.0-nightly.20250830",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -62,9 +62,9 @@
62
62
  ]
63
63
  },
64
64
  "dependencies": {
65
- "@aztec/ethereum": "2.0.0-nightly.20250829",
66
- "@aztec/foundation": "2.0.0-nightly.20250829",
67
- "@aztec/stdlib": "2.0.0-nightly.20250829",
65
+ "@aztec/ethereum": "2.0.0-nightly.20250830",
66
+ "@aztec/foundation": "2.0.0-nightly.20250830",
67
+ "@aztec/stdlib": "2.0.0-nightly.20250830",
68
68
  "@ethersproject/wallet": "^5.7.0",
69
69
  "tslib": "^2.4.0",
70
70
  "viem": "2.23.7",
@@ -218,19 +218,10 @@ export class KeystoreManager {
218
218
  };
219
219
  }
220
220
 
221
- // Handle complex prover case with id and publishers
222
- const proverConfig = this.keystore.prover;
223
- const signers: EthSigner[] = [];
224
-
225
- for (const publisherAccounts of proverConfig.publisher) {
226
- const publisherSigners = this.createSignersFromEthAccounts(publisherAccounts, this.keystore.remoteSigner);
227
- signers.push(...publisherSigners);
228
- }
221
+ const id = EthAddress.fromString(this.keystore.prover.id);
222
+ const signers = this.createSignersFromEthAccounts(this.keystore.prover.publisher, this.keystore.remoteSigner);
229
223
 
230
- return {
231
- id: EthAddress.fromString(proverConfig.id),
232
- signers,
233
- };
224
+ return { id, signers };
234
225
  }
235
226
 
236
227
  /**
package/src/schemas.ts CHANGED
@@ -51,17 +51,22 @@ const mnemonicConfigSchema = z.object({
51
51
  });
52
52
 
53
53
  // EthAccount schema
54
- const ethAccountSchema = z.union([ethPrivateKeySchema, remoteSignerAccountSchema, jsonKeyFileV3Schema]);
54
+ const ethAccountSchema = z.union([
55
+ ethPrivateKeySchema,
56
+ remoteSignerAccountSchema,
57
+ jsonKeyFileV3Schema,
58
+ mnemonicConfigSchema,
59
+ ]);
55
60
 
56
61
  // EthAccounts schema
57
- const ethAccountsSchema = z.union([ethAccountSchema, z.array(ethAccountSchema), mnemonicConfigSchema]);
62
+ const ethAccountsSchema = z.union([ethAccountSchema, z.array(ethAccountSchema)]);
58
63
 
59
64
  // Prover keystore schema
60
65
  const proverKeyStoreSchema = z.union([
61
66
  ethAccountSchema,
62
67
  z.object({
63
68
  id: ethAddressSchema,
64
- publisher: z.array(ethAccountsSchema),
69
+ publisher: ethAccountsSchema,
65
70
  }),
66
71
  ]);
67
72
 
package/src/signer.ts CHANGED
@@ -5,9 +5,10 @@
5
5
  */
6
6
  import type { EthSigner } from '@aztec/ethereum';
7
7
  import { Buffer32 } from '@aztec/foundation/buffer';
8
- import { Secp256k1Signer, toRecoveryBit } from '@aztec/foundation/crypto';
8
+ import { Secp256k1Signer, randomBytes, toRecoveryBit } from '@aztec/foundation/crypto';
9
9
  import type { EthAddress } from '@aztec/foundation/eth-address';
10
10
  import { Signature, type ViemTransactionSignature } from '@aztec/foundation/eth-signature';
11
+ import { jsonStringify } from '@aztec/foundation/json-rpc';
11
12
  import { withHexPrefix } from '@aztec/foundation/string';
12
13
 
13
14
  import {
@@ -27,7 +28,7 @@ import type { EthRemoteSignerConfig } from './types.js';
27
28
  export class SignerError extends Error {
28
29
  constructor(
29
30
  message: string,
30
- public method: 'eth_sign' | 'eth_signTransaction' | 'eth_signTypedData_v4',
31
+ public method: string,
31
32
  public url: string,
32
33
  public statusCode?: number,
33
34
  public errorCode?: number,
@@ -128,50 +129,12 @@ export class RemoteSigner implements EthSigner {
128
129
  * Make a JSON-RPC eth_sign request.
129
130
  */
130
131
  private async makeJsonRpcSignRequest(data: Buffer32): Promise<Signature> {
131
- const url = this.getSignerUrl();
132
-
133
- const body = {
134
- jsonrpc: '2.0',
135
- method: 'eth_sign',
136
- params: [this.address.toString(), data.toString()],
137
- id: 1,
138
- };
139
-
140
- const response = await this.fetch(url, {
141
- method: 'POST',
142
- headers: {
143
- 'Content-Type': 'application/json',
144
- },
145
- body: JSON.stringify(body),
146
- });
132
+ let signatureHex = await this.makeJsonRpcRequest('eth_sign', this.address.toString(), data.toString());
147
133
 
148
- if (!response.ok) {
149
- const errorText = await response.text();
150
- throw new SignerError(
151
- `Web3Signer request failed for eth_sign at ${url}: ${response.status} ${response.statusText} - ${errorText}`,
152
- 'eth_sign',
153
- url,
154
- response.status,
155
- );
134
+ if (typeof signatureHex !== 'string') {
135
+ throw new Error('Invalid signature');
156
136
  }
157
137
 
158
- const result = await response.json();
159
-
160
- if (result.error) {
161
- throw new SignerError(
162
- `Web3Signer JSON-RPC error for eth_sign at ${url}: ${result.error.code} - ${result.error.message}`,
163
- 'eth_sign',
164
- url,
165
- undefined,
166
- result.error.code,
167
- );
168
- }
169
-
170
- if (!result.result) {
171
- throw new Error('Invalid response from Web3Signer: no result found');
172
- }
173
-
174
- let signatureHex = result.result;
175
138
  if (!signatureHex.startsWith('0x')) {
176
139
  signatureHex = '0x' + signatureHex;
177
140
  }
@@ -183,50 +146,16 @@ export class RemoteSigner implements EthSigner {
183
146
  * Make a JSON-RPC eth_signTypedData_v4 request.
184
147
  */
185
148
  private async makeJsonRpcSignTypedDataRequest(typedData: TypedDataDefinition): Promise<Signature> {
186
- const url = this.getSignerUrl();
187
-
188
- const body = {
189
- jsonrpc: '2.0',
190
- method: 'eth_signTypedData_v4',
191
- params: [this.address.toString(), typedData],
192
- id: 1,
193
- };
194
-
195
- const response = await this.fetch(url, {
196
- method: 'POST',
197
- headers: {
198
- 'Content-Type': 'application/json',
199
- },
200
- body: JSON.stringify(body),
201
- });
202
-
203
- if (!response.ok) {
204
- const errorText = await response.text();
205
- throw new SignerError(
206
- `Web3Signer request failed for eth_signTypedData_v4 at ${url}: ${response.status} ${response.statusText} - ${errorText}`,
207
- 'eth_signTypedData_v4',
208
- url,
209
- response.status,
210
- );
149
+ let signatureHex = await this.makeJsonRpcRequest(
150
+ 'eth_signTypedData',
151
+ this.address.toString(),
152
+ jsonStringify(typedData),
153
+ );
154
+
155
+ if (typeof signatureHex !== 'string') {
156
+ throw new Error('Invalid signature');
211
157
  }
212
158
 
213
- const result = await response.json();
214
-
215
- if (result.error) {
216
- throw new SignerError(
217
- `Web3Signer JSON-RPC error for eth_signTypedData_v4 at ${url}: ${result.error.code} - ${result.error.message}`,
218
- 'eth_signTypedData_v4',
219
- url,
220
- undefined,
221
- result.error.code,
222
- );
223
- }
224
-
225
- if (!result.result) {
226
- throw new Error('Invalid response from Web3Signer: no result found');
227
- }
228
-
229
- let signatureHex = result.result;
230
159
  if (!signatureHex.startsWith('0x')) {
231
160
  signatureHex = '0x' + signatureHex;
232
161
  }
@@ -242,8 +171,6 @@ export class RemoteSigner implements EthSigner {
242
171
  throw new Error('This signer does not support tx type: ' + tx.type);
243
172
  }
244
173
 
245
- const url = this.getSignerUrl();
246
-
247
174
  const txObject: RemoteSignerTxObject = {
248
175
  from: this.address.toString(),
249
176
  to: tx.to ?? null,
@@ -263,26 +190,49 @@ export class RemoteSigner implements EthSigner {
263
190
  // blobs: tx.blobs?.map(blob => (typeof blob === 'string' ? blob : bufferToHex(Buffer.from(blob)))),
264
191
  };
265
192
 
266
- const body = {
267
- jsonrpc: '2.0',
268
- method: 'eth_signTransaction',
269
- params: [txObject],
270
- id: 1,
271
- };
193
+ let rawTxHex = await this.makeJsonRpcRequest('eth_signTransaction', txObject);
194
+
195
+ if (typeof rawTxHex !== 'string') {
196
+ throw new Error('Invalid signed tx');
197
+ }
198
+
199
+ if (!rawTxHex.startsWith('0x')) {
200
+ rawTxHex = '0x' + rawTxHex;
201
+ }
202
+
203
+ // we get back to whole signed tx. Deserialize it in order to read the signature
204
+ const parsedTxWithSignature = parseTransaction(rawTxHex);
205
+ if (
206
+ parsedTxWithSignature.r === undefined ||
207
+ parsedTxWithSignature.s === undefined ||
208
+ parsedTxWithSignature.v === undefined
209
+ ) {
210
+ throw new Error('Tx not signed by Web3Signer');
211
+ }
212
+
213
+ return Signature.fromViemTransactionSignature(parsedTxWithSignature as ViemTransactionSignature);
214
+ }
215
+
216
+ /**
217
+ * Sends a JSON-RPC request and returns its result
218
+ */
219
+ private async makeJsonRpcRequest(method: string, ...params: any[]): Promise<any> {
220
+ const url = this.getSignerUrl();
221
+ const id = this.generateId();
272
222
 
273
223
  const response = await this.fetch(url, {
274
224
  method: 'POST',
275
225
  headers: {
276
226
  'Content-Type': 'application/json',
277
227
  },
278
- body: JSON.stringify(body),
228
+ body: jsonStringify({ jsonrpc: '2.0', method, params, id }),
279
229
  });
280
230
 
281
231
  if (!response.ok) {
282
232
  const errorText = await response.text();
283
233
  throw new SignerError(
284
- `Web3Signer request failed for eth_signTransaction at ${url}: ${response.status} ${response.statusText} - ${errorText}`,
285
- 'eth_signTransaction',
234
+ `Web3Signer request failed for ${method} at ${url}: ${response.status} ${response.statusText} - ${errorText}`,
235
+ method,
286
236
  url,
287
237
  response.status,
288
238
  );
@@ -292,10 +242,10 @@ export class RemoteSigner implements EthSigner {
292
242
 
293
243
  if (result.error) {
294
244
  throw new SignerError(
295
- `Web3Signer JSON-RPC error for eth_signTransaction at ${url}: ${result.error.code} - ${result.error.message}`,
296
- 'eth_signTransaction',
245
+ `Web3Signer JSON-RPC error for ${method} at ${url}: ${result.error.code} - ${result.error.message}`,
246
+ method,
297
247
  url,
298
- undefined,
248
+ response.status,
299
249
  result.error.code,
300
250
  );
301
251
  }
@@ -304,22 +254,7 @@ export class RemoteSigner implements EthSigner {
304
254
  throw new Error('Invalid response from Web3Signer: no result found');
305
255
  }
306
256
 
307
- let rawTxHex = result.result;
308
- if (!rawTxHex.startsWith('0x')) {
309
- rawTxHex = '0x' + rawTxHex;
310
- }
311
-
312
- // we get back to whole signed tx. Deserialize it in order to read the signature
313
- const parsedTxWithSignature = parseTransaction(rawTxHex);
314
- if (
315
- parsedTxWithSignature.r === undefined ||
316
- parsedTxWithSignature.s === undefined ||
317
- parsedTxWithSignature.v === undefined
318
- ) {
319
- throw new Error('Tx not signed by Web3Signer');
320
- }
321
-
322
- return Signature.fromViemTransactionSignature(parsedTxWithSignature as ViemTransactionSignature);
257
+ return result.result;
323
258
  }
324
259
 
325
260
  /**
@@ -331,4 +266,11 @@ export class RemoteSigner implements EthSigner {
331
266
  }
332
267
  return this.config.remoteSignerUrl;
333
268
  }
269
+
270
+ /**
271
+ * Generate an id to use for a JSON-RPC call
272
+ */
273
+ private generateId(): string {
274
+ return randomBytes(4).toString('hex');
275
+ }
334
276
  }
package/src/types.ts CHANGED
@@ -68,7 +68,7 @@ export type ProverKeyStore =
68
68
  /** Address that identifies the prover. This address will receive the rewards. */
69
69
  id: EthAddressHex;
70
70
  /** One or more EOAs used for sending proof L1 txs. */
71
- publisher: EthAccounts[];
71
+ publisher: EthAccounts;
72
72
  }
73
73
  | EthAccount;
74
74