confium 0.6.2 → 0.6.3
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.
- checksums.yaml +4 -4
- data/Cargo.lock +347 -76
- data/ext/confium_native/Cargo.toml +9 -4
- data/ext/confium_native/src/lib.rs +2 -0
- data/ext/confium_native/src/tc_session.rs +268 -0
- data/lib/confium/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0739c3bc2fd3d3d347fd283d19bb70b9bd1611cd262c4d6229b80828d67b441c'
|
|
4
|
+
data.tar.gz: ae757155d9a5312662d44ac21d740c68228b2e8ad011c178e168969b2563d068
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d17228e2f724d28a2481bd6c115cdec90f8955b346c7f72a22b0217d78f5365bbcb61930d08662562c1f9e4ec8b05eeb8dc73c63b30f902dbe27ede051fa9408
|
|
7
|
+
data.tar.gz: 7780ff8ceff7791de1bca7e5dc7e15215db6886eec4cd6d01dbc75b0fa8d04c7d0350234bd33f8d5dfd94587b532c088246c59a28e7edd99ad3fb077ed7d8d34
|
data/Cargo.lock
CHANGED
|
@@ -79,6 +79,12 @@ version = "0.2.0"
|
|
|
79
79
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
80
80
|
checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
|
|
81
81
|
|
|
82
|
+
[[package]]
|
|
83
|
+
name = "base16ct"
|
|
84
|
+
version = "1.0.0"
|
|
85
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
86
|
+
checksum = "fd307490d624467aa6f74b0eabb77633d1f758a7b25f12bceb0b22e08d9726f6"
|
|
87
|
+
|
|
82
88
|
[[package]]
|
|
83
89
|
name = "base64"
|
|
84
90
|
version = "0.23.1"
|
|
@@ -245,6 +251,12 @@ dependencies = [
|
|
|
245
251
|
"cc",
|
|
246
252
|
]
|
|
247
253
|
|
|
254
|
+
[[package]]
|
|
255
|
+
name = "cmov"
|
|
256
|
+
version = "0.5.4"
|
|
257
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
258
|
+
checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a"
|
|
259
|
+
|
|
248
260
|
[[package]]
|
|
249
261
|
name = "confium-api"
|
|
250
262
|
version = "0.3.0"
|
|
@@ -273,7 +285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
273
285
|
checksum = "317ed25adf9a1aad00722a215c3397dea694fcdf90730542e82acdea559644aa"
|
|
274
286
|
dependencies = [
|
|
275
287
|
"ed25519-dalek",
|
|
276
|
-
"p256",
|
|
288
|
+
"p256 0.13.2",
|
|
277
289
|
"rand_core 0.6.4",
|
|
278
290
|
"serde",
|
|
279
291
|
"serde_json",
|
|
@@ -291,14 +303,14 @@ dependencies = [
|
|
|
291
303
|
"confium-api",
|
|
292
304
|
"confium-net",
|
|
293
305
|
"confium-store 0.3.0",
|
|
294
|
-
"confium-tc-core",
|
|
306
|
+
"confium-tc-core 0.3.0",
|
|
295
307
|
"data-encoding",
|
|
296
308
|
"hex",
|
|
297
|
-
"hmac",
|
|
309
|
+
"hmac 0.12.1",
|
|
298
310
|
"inventory",
|
|
299
311
|
"num-bigint",
|
|
300
312
|
"num-traits",
|
|
301
|
-
"p256",
|
|
313
|
+
"p256 0.13.2",
|
|
302
314
|
"rand_core 0.6.4",
|
|
303
315
|
"serde",
|
|
304
316
|
"serde_json",
|
|
@@ -330,11 +342,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
330
342
|
checksum = "19bea8bcb5a76b88ccca2471352176ea234e86c1360982f4a1d7357c2f89ab73"
|
|
331
343
|
dependencies = [
|
|
332
344
|
"hex",
|
|
333
|
-
"hmac",
|
|
345
|
+
"hmac 0.12.1",
|
|
334
346
|
"num-bigint",
|
|
335
347
|
"num-integer",
|
|
336
348
|
"num-traits",
|
|
337
|
-
"p256",
|
|
349
|
+
"p256 0.13.2",
|
|
338
350
|
"rand",
|
|
339
351
|
"rand_core 0.6.4",
|
|
340
352
|
"serde",
|
|
@@ -351,10 +363,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
351
363
|
checksum = "f65c763c1e55aee550db1ba49ba0b97fbfd8373766e4ca48d9ca742897c82f34"
|
|
352
364
|
dependencies = [
|
|
353
365
|
"hex",
|
|
354
|
-
"hmac",
|
|
366
|
+
"hmac 0.12.1",
|
|
355
367
|
"num-bigint",
|
|
356
368
|
"num-traits",
|
|
357
|
-
"p256",
|
|
369
|
+
"p256 0.13.2",
|
|
358
370
|
"rand_core 0.6.4",
|
|
359
371
|
"serde",
|
|
360
372
|
"serde_json",
|
|
@@ -409,7 +421,7 @@ checksum = "767f898b6437a5cc67d403140bcf8cd1dbffa35a450afe28c64147e3175ee091"
|
|
|
409
421
|
dependencies = [
|
|
410
422
|
"chrono",
|
|
411
423
|
"hex",
|
|
412
|
-
"hmac",
|
|
424
|
+
"hmac 0.12.1",
|
|
413
425
|
"rand_core 0.6.4",
|
|
414
426
|
"serde",
|
|
415
427
|
"serde_json",
|
|
@@ -440,10 +452,10 @@ checksum = "6dcbe8f16e42291a63bcc480745653aa1ad993982fb708531778270de9677dd9"
|
|
|
440
452
|
dependencies = [
|
|
441
453
|
"chrono",
|
|
442
454
|
"hex",
|
|
443
|
-
"hmac",
|
|
455
|
+
"hmac 0.12.1",
|
|
444
456
|
"num-bigint",
|
|
445
457
|
"num-traits",
|
|
446
|
-
"p256",
|
|
458
|
+
"p256 0.13.2",
|
|
447
459
|
"rand",
|
|
448
460
|
"rand_core 0.6.4",
|
|
449
461
|
"serde",
|
|
@@ -487,13 +499,13 @@ dependencies = [
|
|
|
487
499
|
"confium-tc-keys",
|
|
488
500
|
"data-encoding",
|
|
489
501
|
"hex",
|
|
490
|
-
"hmac",
|
|
502
|
+
"hmac 0.12.1",
|
|
491
503
|
"inventory",
|
|
492
504
|
"num-bigint",
|
|
493
505
|
"num-integer",
|
|
494
506
|
"num-prime",
|
|
495
507
|
"num-traits",
|
|
496
|
-
"p256",
|
|
508
|
+
"p256 0.13.2",
|
|
497
509
|
"rand",
|
|
498
510
|
"rand_core 0.6.4",
|
|
499
511
|
"serde",
|
|
@@ -507,24 +519,42 @@ dependencies = [
|
|
|
507
519
|
]
|
|
508
520
|
|
|
509
521
|
[[package]]
|
|
510
|
-
name = "confium-tc
|
|
511
|
-
version = "0.
|
|
522
|
+
name = "confium-tc"
|
|
523
|
+
version = "0.4.7"
|
|
512
524
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
513
|
-
checksum = "
|
|
525
|
+
checksum = "940d14f99d311c76e38500126059e2f1f027628657d0615d5bc78422618c83ee"
|
|
514
526
|
dependencies = [
|
|
515
|
-
"
|
|
516
|
-
"confium-tc-core",
|
|
517
|
-
"
|
|
518
|
-
"elliptic-curve",
|
|
519
|
-
"hex",
|
|
527
|
+
"chrono",
|
|
528
|
+
"confium-tc-core 0.4.7",
|
|
529
|
+
"hmac 0.12.1",
|
|
520
530
|
"inventory",
|
|
521
531
|
"num-bigint",
|
|
522
532
|
"num-integer",
|
|
523
533
|
"num-traits",
|
|
524
|
-
"
|
|
525
|
-
"
|
|
534
|
+
"rand_core 0.6.4",
|
|
535
|
+
"serde",
|
|
536
|
+
"serde_json",
|
|
526
537
|
"sha2 0.10.9",
|
|
527
538
|
"snafu 0.8.9",
|
|
539
|
+
"thiserror 1.0.69",
|
|
540
|
+
"zeroize",
|
|
541
|
+
]
|
|
542
|
+
|
|
543
|
+
[[package]]
|
|
544
|
+
name = "confium-tc-cmp20"
|
|
545
|
+
version = "0.4.7"
|
|
546
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
547
|
+
checksum = "58d95093a36282370c3920cc0453f080d3e567afaa340063f44b3dbe1a60bca5"
|
|
548
|
+
dependencies = [
|
|
549
|
+
"confium-tc 0.4.7",
|
|
550
|
+
"crypto-bigint 0.7.5",
|
|
551
|
+
"elliptic-curve 0.14.1",
|
|
552
|
+
"getrandom 0.4.3",
|
|
553
|
+
"inventory",
|
|
554
|
+
"num-bigint",
|
|
555
|
+
"p256 0.14.0",
|
|
556
|
+
"rand",
|
|
557
|
+
"sha2 0.10.9",
|
|
528
558
|
"zeroize",
|
|
529
559
|
]
|
|
530
560
|
|
|
@@ -540,9 +570,9 @@ dependencies = [
|
|
|
540
570
|
"confium-store 0.3.0",
|
|
541
571
|
"data-encoding",
|
|
542
572
|
"hex",
|
|
543
|
-
"hmac",
|
|
573
|
+
"hmac 0.12.1",
|
|
544
574
|
"inventory",
|
|
545
|
-
"p256",
|
|
575
|
+
"p256 0.13.2",
|
|
546
576
|
"rand_core 0.6.4",
|
|
547
577
|
"serde",
|
|
548
578
|
"serde_json",
|
|
@@ -555,48 +585,80 @@ dependencies = [
|
|
|
555
585
|
]
|
|
556
586
|
|
|
557
587
|
[[package]]
|
|
558
|
-
name = "confium-tc-
|
|
559
|
-
version = "0.
|
|
588
|
+
name = "confium-tc-core"
|
|
589
|
+
version = "0.4.7"
|
|
560
590
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
561
|
-
checksum = "
|
|
591
|
+
checksum = "0b09f89b929f19bef0267ea94520cdf86a57f2eb71bf409171d71f6f6e2f98f9"
|
|
562
592
|
dependencies = [
|
|
563
|
-
"
|
|
564
|
-
"
|
|
593
|
+
"chrono",
|
|
594
|
+
"getrandom 0.4.3",
|
|
595
|
+
"hex",
|
|
596
|
+
"hmac 0.12.1",
|
|
597
|
+
"inventory",
|
|
598
|
+
"p256 0.14.0",
|
|
599
|
+
"rand_core 0.6.4",
|
|
565
600
|
"serde",
|
|
601
|
+
"serde_json",
|
|
566
602
|
"sha2 0.10.9",
|
|
603
|
+
"snafu 0.8.9",
|
|
604
|
+
"subtle",
|
|
567
605
|
"thiserror 1.0.69",
|
|
606
|
+
"zeroize",
|
|
568
607
|
]
|
|
569
608
|
|
|
570
609
|
[[package]]
|
|
571
|
-
name = "confium-tc-
|
|
572
|
-
version = "0.
|
|
610
|
+
name = "confium-tc-elgamal-p256"
|
|
611
|
+
version = "0.4.7"
|
|
573
612
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
574
|
-
checksum = "
|
|
613
|
+
checksum = "fec4a5bdef07e17ae0ae0098fd761166c8bb1586f22117bb64e7ea09c1883559"
|
|
575
614
|
dependencies = [
|
|
576
|
-
"
|
|
577
|
-
"
|
|
578
|
-
"p256",
|
|
579
|
-
"rand_core 0.6.4",
|
|
615
|
+
"getrandom 0.4.3",
|
|
616
|
+
"p256 0.14.0",
|
|
580
617
|
"serde",
|
|
618
|
+
"thiserror 1.0.69",
|
|
619
|
+
"zeroize",
|
|
620
|
+
]
|
|
621
|
+
|
|
622
|
+
[[package]]
|
|
623
|
+
name = "confium-tc-frost-ed25519"
|
|
624
|
+
version = "0.4.7"
|
|
625
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
626
|
+
checksum = "58987257f0358c9689b90ea63f4dad4c7902e6a446e3fbcb531fa2d9f69f0eef"
|
|
627
|
+
dependencies = [
|
|
628
|
+
"confium-tc 0.4.7",
|
|
629
|
+
"curve25519-dalek",
|
|
630
|
+
"inventory",
|
|
631
|
+
"rand_core 0.6.4",
|
|
581
632
|
"sha2 0.10.9",
|
|
633
|
+
"snafu 0.8.9",
|
|
634
|
+
]
|
|
635
|
+
|
|
636
|
+
[[package]]
|
|
637
|
+
name = "confium-tc-frost-p256"
|
|
638
|
+
version = "0.4.7"
|
|
639
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
640
|
+
checksum = "9bddf1ab23eb1cfd9d8d6823c5e473a9392a30b6e12cf4889c44612508f865d9"
|
|
641
|
+
dependencies = [
|
|
642
|
+
"elliptic-curve 0.14.1",
|
|
643
|
+
"getrandom 0.4.3",
|
|
644
|
+
"p256 0.14.0",
|
|
582
645
|
"thiserror 1.0.69",
|
|
646
|
+
"zeroize",
|
|
583
647
|
]
|
|
584
648
|
|
|
585
649
|
[[package]]
|
|
586
650
|
name = "confium-tc-gg18"
|
|
587
|
-
version = "0.
|
|
651
|
+
version = "0.4.7"
|
|
588
652
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
589
|
-
checksum = "
|
|
653
|
+
checksum = "45894d305019521a9960dfda5a8ba9d4f7b2b10d9a874905780d75e3d14d264f"
|
|
590
654
|
dependencies = [
|
|
591
|
-
"confium-tc",
|
|
592
|
-
"
|
|
593
|
-
"
|
|
594
|
-
"
|
|
595
|
-
"hex",
|
|
655
|
+
"confium-tc 0.4.7",
|
|
656
|
+
"crypto-bigint 0.7.5",
|
|
657
|
+
"elliptic-curve 0.14.1",
|
|
658
|
+
"getrandom 0.4.3",
|
|
596
659
|
"inventory",
|
|
597
|
-
"p256",
|
|
660
|
+
"p256 0.14.0",
|
|
598
661
|
"sha2 0.10.9",
|
|
599
|
-
"snafu 0.8.9",
|
|
600
662
|
"zeroize",
|
|
601
663
|
]
|
|
602
664
|
|
|
@@ -607,10 +669,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
607
669
|
checksum = "476fce2efcefa4d7a48cfe5accecd1bc3f39959b5ea719fdedac9cfcbfeeb710"
|
|
608
670
|
dependencies = [
|
|
609
671
|
"chrono",
|
|
610
|
-
"confium-tc-core",
|
|
672
|
+
"confium-tc-core 0.3.0",
|
|
611
673
|
"hex",
|
|
612
|
-
"hmac",
|
|
613
|
-
"p256",
|
|
674
|
+
"hmac 0.12.1",
|
|
675
|
+
"p256 0.13.2",
|
|
614
676
|
"rand_core 0.6.4",
|
|
615
677
|
"serde",
|
|
616
678
|
"serde_json",
|
|
@@ -649,17 +711,19 @@ dependencies = [
|
|
|
649
711
|
"confium-pki",
|
|
650
712
|
"confium-privacy",
|
|
651
713
|
"confium-store 0.5.8",
|
|
652
|
-
"confium-tc",
|
|
714
|
+
"confium-tc 0.3.1",
|
|
653
715
|
"confium-tc-cmp20",
|
|
654
|
-
"confium-tc-core",
|
|
716
|
+
"confium-tc-core 0.3.0",
|
|
717
|
+
"confium-tc-core 0.4.7",
|
|
655
718
|
"confium-tc-elgamal-p256",
|
|
719
|
+
"confium-tc-frost-ed25519",
|
|
656
720
|
"confium-tc-frost-p256",
|
|
657
721
|
"confium-tc-gg18",
|
|
658
722
|
"confium-transparency",
|
|
659
723
|
"ed25519-dalek",
|
|
660
724
|
"hex",
|
|
661
725
|
"magnus",
|
|
662
|
-
"p256",
|
|
726
|
+
"p256 0.13.2",
|
|
663
727
|
"rand_core 0.6.4",
|
|
664
728
|
"rb-sys",
|
|
665
729
|
"rnp-rs",
|
|
@@ -686,6 +750,12 @@ version = "0.8.7"
|
|
|
686
750
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
687
751
|
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
|
688
752
|
|
|
753
|
+
[[package]]
|
|
754
|
+
name = "cpubits"
|
|
755
|
+
version = "0.1.1"
|
|
756
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
757
|
+
checksum = "15b85f9c39137c3a891689859392b1bd49812121d0d61c9caf00d46ed5ce06ae"
|
|
758
|
+
|
|
689
759
|
[[package]]
|
|
690
760
|
name = "cpufeatures"
|
|
691
761
|
version = "0.2.17"
|
|
@@ -740,6 +810,22 @@ dependencies = [
|
|
|
740
810
|
"zeroize",
|
|
741
811
|
]
|
|
742
812
|
|
|
813
|
+
[[package]]
|
|
814
|
+
name = "crypto-bigint"
|
|
815
|
+
version = "0.7.5"
|
|
816
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
817
|
+
checksum = "1a52aa3fcda4e6302a9f48734f234d35d4721b96f8fe07d073f07ce9df4f0271"
|
|
818
|
+
dependencies = [
|
|
819
|
+
"cpubits",
|
|
820
|
+
"ctutils",
|
|
821
|
+
"getrandom 0.4.3",
|
|
822
|
+
"hybrid-array",
|
|
823
|
+
"num-traits",
|
|
824
|
+
"rand_core 0.10.1",
|
|
825
|
+
"subtle",
|
|
826
|
+
"zeroize",
|
|
827
|
+
]
|
|
828
|
+
|
|
743
829
|
[[package]]
|
|
744
830
|
name = "crypto-common"
|
|
745
831
|
version = "0.1.7"
|
|
@@ -757,7 +843,9 @@ version = "0.2.2"
|
|
|
757
843
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
758
844
|
checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
|
|
759
845
|
dependencies = [
|
|
846
|
+
"getrandom 0.4.3",
|
|
760
847
|
"hybrid-array",
|
|
848
|
+
"rand_core 0.10.1",
|
|
761
849
|
]
|
|
762
850
|
|
|
763
851
|
[[package]]
|
|
@@ -769,6 +857,16 @@ dependencies = [
|
|
|
769
857
|
"cipher",
|
|
770
858
|
]
|
|
771
859
|
|
|
860
|
+
[[package]]
|
|
861
|
+
name = "ctutils"
|
|
862
|
+
version = "0.4.2"
|
|
863
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
864
|
+
checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e"
|
|
865
|
+
dependencies = [
|
|
866
|
+
"cmov",
|
|
867
|
+
"subtle",
|
|
868
|
+
]
|
|
869
|
+
|
|
772
870
|
[[package]]
|
|
773
871
|
name = "curve25519-dalek"
|
|
774
872
|
version = "4.1.3"
|
|
@@ -780,6 +878,7 @@ dependencies = [
|
|
|
780
878
|
"curve25519-dalek-derive",
|
|
781
879
|
"digest 0.10.7",
|
|
782
880
|
"fiat-crypto",
|
|
881
|
+
"rand_core 0.6.4",
|
|
783
882
|
"rustc_version",
|
|
784
883
|
"subtle",
|
|
785
884
|
"zeroize",
|
|
@@ -858,6 +957,7 @@ dependencies = [
|
|
|
858
957
|
"block-buffer 0.12.1",
|
|
859
958
|
"const-oid 0.10.2",
|
|
860
959
|
"crypto-common 0.2.2",
|
|
960
|
+
"ctutils",
|
|
861
961
|
]
|
|
862
962
|
|
|
863
963
|
[[package]]
|
|
@@ -879,20 +979,35 @@ checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
|
|
|
879
979
|
dependencies = [
|
|
880
980
|
"der 0.7.10",
|
|
881
981
|
"digest 0.10.7",
|
|
882
|
-
"elliptic-curve",
|
|
883
|
-
"rfc6979",
|
|
884
|
-
"serdect",
|
|
982
|
+
"elliptic-curve 0.13.8",
|
|
983
|
+
"rfc6979 0.4.0",
|
|
885
984
|
"signature 2.2.0",
|
|
886
985
|
"spki 0.7.3",
|
|
887
986
|
]
|
|
888
987
|
|
|
988
|
+
[[package]]
|
|
989
|
+
name = "ecdsa"
|
|
990
|
+
version = "0.17.0"
|
|
991
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
992
|
+
checksum = "c0681a4fc24c767085329728d8dfba959af91228aa4610cca4f8ce317ba46ae0"
|
|
993
|
+
dependencies = [
|
|
994
|
+
"der 0.8.1",
|
|
995
|
+
"digest 0.11.3",
|
|
996
|
+
"elliptic-curve 0.14.1",
|
|
997
|
+
"rfc6979 0.6.0",
|
|
998
|
+
"serdect",
|
|
999
|
+
"signature 3.0.0",
|
|
1000
|
+
"spki 0.8.0",
|
|
1001
|
+
"zeroize",
|
|
1002
|
+
]
|
|
1003
|
+
|
|
889
1004
|
[[package]]
|
|
890
1005
|
name = "ed25519"
|
|
891
1006
|
version = "2.2.3"
|
|
892
1007
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
893
1008
|
checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
|
|
894
1009
|
dependencies = [
|
|
895
|
-
"pkcs8",
|
|
1010
|
+
"pkcs8 0.10.2",
|
|
896
1011
|
"signature 2.2.0",
|
|
897
1012
|
]
|
|
898
1013
|
|
|
@@ -923,16 +1038,37 @@ version = "0.13.8"
|
|
|
923
1038
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
924
1039
|
checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
|
|
925
1040
|
dependencies = [
|
|
926
|
-
"base16ct",
|
|
927
|
-
"crypto-bigint",
|
|
1041
|
+
"base16ct 0.2.0",
|
|
1042
|
+
"crypto-bigint 0.5.5",
|
|
928
1043
|
"digest 0.10.7",
|
|
929
|
-
"ff",
|
|
1044
|
+
"ff 0.13.1",
|
|
930
1045
|
"generic-array",
|
|
931
|
-
"group",
|
|
1046
|
+
"group 0.13.0",
|
|
932
1047
|
"pem-rfc7468 0.7.0",
|
|
933
|
-
"pkcs8",
|
|
1048
|
+
"pkcs8 0.10.2",
|
|
934
1049
|
"rand_core 0.6.4",
|
|
935
|
-
"sec1",
|
|
1050
|
+
"sec1 0.7.3",
|
|
1051
|
+
"subtle",
|
|
1052
|
+
"zeroize",
|
|
1053
|
+
]
|
|
1054
|
+
|
|
1055
|
+
[[package]]
|
|
1056
|
+
name = "elliptic-curve"
|
|
1057
|
+
version = "0.14.1"
|
|
1058
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1059
|
+
checksum = "9d65aa39b3a5c1c9c1b745c9a019234bb7a21b77abcb4f4d266d706e2d577d65"
|
|
1060
|
+
dependencies = [
|
|
1061
|
+
"base16ct 1.0.0",
|
|
1062
|
+
"crypto-bigint 0.7.5",
|
|
1063
|
+
"crypto-common 0.2.2",
|
|
1064
|
+
"digest 0.11.3",
|
|
1065
|
+
"ff 0.14.0",
|
|
1066
|
+
"group 0.14.0",
|
|
1067
|
+
"hybrid-array",
|
|
1068
|
+
"pem-rfc7468 1.0.0",
|
|
1069
|
+
"pkcs8 0.11.0",
|
|
1070
|
+
"rand_core 0.10.1",
|
|
1071
|
+
"sec1 0.8.1",
|
|
936
1072
|
"serdect",
|
|
937
1073
|
"subtle",
|
|
938
1074
|
"zeroize",
|
|
@@ -964,6 +1100,16 @@ dependencies = [
|
|
|
964
1100
|
"subtle",
|
|
965
1101
|
]
|
|
966
1102
|
|
|
1103
|
+
[[package]]
|
|
1104
|
+
name = "ff"
|
|
1105
|
+
version = "0.14.0"
|
|
1106
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1107
|
+
checksum = "a1f686ab92a9fb0eaf188f6c6c87b89490baa6fdb0db4544ba4dc47f7942489f"
|
|
1108
|
+
dependencies = [
|
|
1109
|
+
"rand_core 0.10.1",
|
|
1110
|
+
"subtle",
|
|
1111
|
+
]
|
|
1112
|
+
|
|
967
1113
|
[[package]]
|
|
968
1114
|
name = "fiat-crypto"
|
|
969
1115
|
version = "0.2.9"
|
|
@@ -1069,6 +1215,18 @@ dependencies = [
|
|
|
1069
1215
|
"wasi",
|
|
1070
1216
|
]
|
|
1071
1217
|
|
|
1218
|
+
[[package]]
|
|
1219
|
+
name = "getrandom"
|
|
1220
|
+
version = "0.4.3"
|
|
1221
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1222
|
+
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
|
|
1223
|
+
dependencies = [
|
|
1224
|
+
"cfg-if",
|
|
1225
|
+
"libc",
|
|
1226
|
+
"r-efi",
|
|
1227
|
+
"rand_core 0.10.1",
|
|
1228
|
+
]
|
|
1229
|
+
|
|
1072
1230
|
[[package]]
|
|
1073
1231
|
name = "ghash"
|
|
1074
1232
|
version = "0.5.1"
|
|
@@ -1091,11 +1249,22 @@ version = "0.13.0"
|
|
|
1091
1249
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1092
1250
|
checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
|
|
1093
1251
|
dependencies = [
|
|
1094
|
-
"ff",
|
|
1252
|
+
"ff 0.13.1",
|
|
1095
1253
|
"rand_core 0.6.4",
|
|
1096
1254
|
"subtle",
|
|
1097
1255
|
]
|
|
1098
1256
|
|
|
1257
|
+
[[package]]
|
|
1258
|
+
name = "group"
|
|
1259
|
+
version = "0.14.0"
|
|
1260
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1261
|
+
checksum = "7fd1a1c7a5206c5b7a3f5a0d7ccd3ff85d0c8f5133d62a02680255b0004af5f4"
|
|
1262
|
+
dependencies = [
|
|
1263
|
+
"ff 0.14.0",
|
|
1264
|
+
"rand_core 0.10.1",
|
|
1265
|
+
"subtle",
|
|
1266
|
+
]
|
|
1267
|
+
|
|
1099
1268
|
[[package]]
|
|
1100
1269
|
name = "hashbrown"
|
|
1101
1270
|
version = "0.15.5"
|
|
@@ -1134,6 +1303,15 @@ dependencies = [
|
|
|
1134
1303
|
"digest 0.10.7",
|
|
1135
1304
|
]
|
|
1136
1305
|
|
|
1306
|
+
[[package]]
|
|
1307
|
+
name = "hmac"
|
|
1308
|
+
version = "0.13.0"
|
|
1309
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1310
|
+
checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f"
|
|
1311
|
+
dependencies = [
|
|
1312
|
+
"digest 0.11.3",
|
|
1313
|
+
]
|
|
1314
|
+
|
|
1137
1315
|
[[package]]
|
|
1138
1316
|
name = "http"
|
|
1139
1317
|
version = "1.5.0"
|
|
@@ -1156,7 +1334,9 @@ version = "0.4.14"
|
|
|
1156
1334
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1157
1335
|
checksum = "707114b52a152fa7bdb290cd7cd5912d9467273b6d74e21b8d81aca1f8533f6b"
|
|
1158
1336
|
dependencies = [
|
|
1337
|
+
"subtle",
|
|
1159
1338
|
"typenum",
|
|
1339
|
+
"zeroize",
|
|
1160
1340
|
]
|
|
1161
1341
|
|
|
1162
1342
|
[[package]]
|
|
@@ -1529,13 +1709,26 @@ version = "0.13.2"
|
|
|
1529
1709
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1530
1710
|
checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b"
|
|
1531
1711
|
dependencies = [
|
|
1532
|
-
"ecdsa",
|
|
1533
|
-
"elliptic-curve",
|
|
1534
|
-
"primeorder",
|
|
1535
|
-
"serdect",
|
|
1712
|
+
"ecdsa 0.16.9",
|
|
1713
|
+
"elliptic-curve 0.13.8",
|
|
1714
|
+
"primeorder 0.13.6",
|
|
1536
1715
|
"sha2 0.10.9",
|
|
1537
1716
|
]
|
|
1538
1717
|
|
|
1718
|
+
[[package]]
|
|
1719
|
+
name = "p256"
|
|
1720
|
+
version = "0.14.0"
|
|
1721
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1722
|
+
checksum = "d2c9239b2dbc807adbbe147e8cf72ea7450c3a0aabe62cb8e75ff4ec22e1f72a"
|
|
1723
|
+
dependencies = [
|
|
1724
|
+
"ecdsa 0.17.0",
|
|
1725
|
+
"elliptic-curve 0.14.1",
|
|
1726
|
+
"primefield",
|
|
1727
|
+
"primeorder 0.14.0",
|
|
1728
|
+
"serdect",
|
|
1729
|
+
"sha2 0.11.0",
|
|
1730
|
+
]
|
|
1731
|
+
|
|
1539
1732
|
[[package]]
|
|
1540
1733
|
name = "pem-rfc7468"
|
|
1541
1734
|
version = "0.7.0"
|
|
@@ -1576,6 +1769,16 @@ dependencies = [
|
|
|
1576
1769
|
"spki 0.7.3",
|
|
1577
1770
|
]
|
|
1578
1771
|
|
|
1772
|
+
[[package]]
|
|
1773
|
+
name = "pkcs8"
|
|
1774
|
+
version = "0.11.0"
|
|
1775
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1776
|
+
checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7"
|
|
1777
|
+
dependencies = [
|
|
1778
|
+
"der 0.8.1",
|
|
1779
|
+
"spki 0.8.0",
|
|
1780
|
+
]
|
|
1781
|
+
|
|
1579
1782
|
[[package]]
|
|
1580
1783
|
name = "pkg-config"
|
|
1581
1784
|
version = "0.3.34"
|
|
@@ -1622,14 +1825,40 @@ dependencies = [
|
|
|
1622
1825
|
"syn 2.0.119",
|
|
1623
1826
|
]
|
|
1624
1827
|
|
|
1828
|
+
[[package]]
|
|
1829
|
+
name = "primefield"
|
|
1830
|
+
version = "0.14.0"
|
|
1831
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1832
|
+
checksum = "c555a6e4eb7d4e158fcb028c835c3b8642206ddc279b5c6b202ef9a8bdb592f4"
|
|
1833
|
+
dependencies = [
|
|
1834
|
+
"crypto-bigint 0.7.5",
|
|
1835
|
+
"crypto-common 0.2.2",
|
|
1836
|
+
"ff 0.14.0",
|
|
1837
|
+
"rand_core 0.10.1",
|
|
1838
|
+
"subtle",
|
|
1839
|
+
"zeroize",
|
|
1840
|
+
]
|
|
1841
|
+
|
|
1625
1842
|
[[package]]
|
|
1626
1843
|
name = "primeorder"
|
|
1627
1844
|
version = "0.13.6"
|
|
1628
1845
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1629
1846
|
checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6"
|
|
1630
1847
|
dependencies = [
|
|
1631
|
-
"elliptic-curve",
|
|
1848
|
+
"elliptic-curve 0.13.8",
|
|
1849
|
+
]
|
|
1850
|
+
|
|
1851
|
+
[[package]]
|
|
1852
|
+
name = "primeorder"
|
|
1853
|
+
version = "0.14.0"
|
|
1854
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1855
|
+
checksum = "5c9f42978c78a00e3d68f69fc03e57a234debae69da4020a4fb588fcdcd07b06"
|
|
1856
|
+
dependencies = [
|
|
1857
|
+
"elliptic-curve 0.14.1",
|
|
1858
|
+
"once_cell",
|
|
1859
|
+
"primefield",
|
|
1632
1860
|
"serdect",
|
|
1861
|
+
"wnaf",
|
|
1633
1862
|
]
|
|
1634
1863
|
|
|
1635
1864
|
[[package]]
|
|
@@ -1650,6 +1879,12 @@ dependencies = [
|
|
|
1650
1879
|
"proc-macro2",
|
|
1651
1880
|
]
|
|
1652
1881
|
|
|
1882
|
+
[[package]]
|
|
1883
|
+
name = "r-efi"
|
|
1884
|
+
version = "6.0.0"
|
|
1885
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1886
|
+
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
|
1887
|
+
|
|
1653
1888
|
[[package]]
|
|
1654
1889
|
name = "radium"
|
|
1655
1890
|
version = "0.7.0"
|
|
@@ -1683,7 +1918,7 @@ version = "0.6.4"
|
|
|
1683
1918
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1684
1919
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
|
1685
1920
|
dependencies = [
|
|
1686
|
-
"getrandom",
|
|
1921
|
+
"getrandom 0.2.17",
|
|
1687
1922
|
]
|
|
1688
1923
|
|
|
1689
1924
|
[[package]]
|
|
@@ -1757,10 +1992,20 @@ version = "0.4.0"
|
|
|
1757
1992
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1758
1993
|
checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"
|
|
1759
1994
|
dependencies = [
|
|
1760
|
-
"hmac",
|
|
1995
|
+
"hmac 0.12.1",
|
|
1761
1996
|
"subtle",
|
|
1762
1997
|
]
|
|
1763
1998
|
|
|
1999
|
+
[[package]]
|
|
2000
|
+
name = "rfc6979"
|
|
2001
|
+
version = "0.6.0"
|
|
2002
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2003
|
+
checksum = "b4a459cddafb3fe76b31fd8f1108007566c40301feb64dc7b54656eb7388172b"
|
|
2004
|
+
dependencies = [
|
|
2005
|
+
"crypto-bigint 0.7.5",
|
|
2006
|
+
"hmac 0.13.0",
|
|
2007
|
+
]
|
|
2008
|
+
|
|
1764
2009
|
[[package]]
|
|
1765
2010
|
name = "ring"
|
|
1766
2011
|
version = "0.17.14"
|
|
@@ -1769,7 +2014,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
|
|
|
1769
2014
|
dependencies = [
|
|
1770
2015
|
"cc",
|
|
1771
2016
|
"cfg-if",
|
|
1772
|
-
"getrandom",
|
|
2017
|
+
"getrandom 0.2.17",
|
|
1773
2018
|
"libc",
|
|
1774
2019
|
"untrusted",
|
|
1775
2020
|
"windows-sys 0.52.0",
|
|
@@ -1875,10 +2120,24 @@ version = "0.7.3"
|
|
|
1875
2120
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1876
2121
|
checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
|
|
1877
2122
|
dependencies = [
|
|
1878
|
-
"base16ct",
|
|
2123
|
+
"base16ct 0.2.0",
|
|
1879
2124
|
"der 0.7.10",
|
|
1880
2125
|
"generic-array",
|
|
1881
|
-
"pkcs8",
|
|
2126
|
+
"pkcs8 0.10.2",
|
|
2127
|
+
"subtle",
|
|
2128
|
+
"zeroize",
|
|
2129
|
+
]
|
|
2130
|
+
|
|
2131
|
+
[[package]]
|
|
2132
|
+
name = "sec1"
|
|
2133
|
+
version = "0.8.1"
|
|
2134
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2135
|
+
checksum = "d56d437c2f19203ce5f7122e507831de96f3d2d4d3be5af44a0b0a09d8a80e4d"
|
|
2136
|
+
dependencies = [
|
|
2137
|
+
"base16ct 1.0.0",
|
|
2138
|
+
"ctutils",
|
|
2139
|
+
"der 0.8.1",
|
|
2140
|
+
"hybrid-array",
|
|
1882
2141
|
"serdect",
|
|
1883
2142
|
"subtle",
|
|
1884
2143
|
"zeroize",
|
|
@@ -1950,11 +2209,11 @@ dependencies = [
|
|
|
1950
2209
|
|
|
1951
2210
|
[[package]]
|
|
1952
2211
|
name = "serdect"
|
|
1953
|
-
version = "0.
|
|
2212
|
+
version = "0.4.3"
|
|
1954
2213
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1955
|
-
checksum = "
|
|
2214
|
+
checksum = "66cf8fedced2fcf12406bcb34223dffb92eaf34908ede12fed414c82b7f00b3e"
|
|
1956
2215
|
dependencies = [
|
|
1957
|
-
"base16ct",
|
|
2216
|
+
"base16ct 1.0.0",
|
|
1958
2217
|
"serde",
|
|
1959
2218
|
]
|
|
1960
2219
|
|
|
@@ -2025,6 +2284,7 @@ version = "3.0.0"
|
|
|
2025
2284
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2026
2285
|
checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5"
|
|
2027
2286
|
dependencies = [
|
|
2287
|
+
"digest 0.11.3",
|
|
2028
2288
|
"rand_core 0.10.1",
|
|
2029
2289
|
]
|
|
2030
2290
|
|
|
@@ -2610,6 +2870,17 @@ dependencies = [
|
|
|
2610
2870
|
"memchr",
|
|
2611
2871
|
]
|
|
2612
2872
|
|
|
2873
|
+
[[package]]
|
|
2874
|
+
name = "wnaf"
|
|
2875
|
+
version = "0.14.0"
|
|
2876
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2877
|
+
checksum = "ab12e7090f27e2ffd9322651492942d50c2926094af30601e1964337db39daf1"
|
|
2878
|
+
dependencies = [
|
|
2879
|
+
"ff 0.14.0",
|
|
2880
|
+
"group 0.14.0",
|
|
2881
|
+
"hybrid-array",
|
|
2882
|
+
]
|
|
2883
|
+
|
|
2613
2884
|
[[package]]
|
|
2614
2885
|
name = "writeable"
|
|
2615
2886
|
version = "0.6.3"
|
|
@@ -40,10 +40,15 @@ confium-pki = "0.5.6"
|
|
|
40
40
|
confium-store = "0.5.8"
|
|
41
41
|
confium-deployment = "0.3"
|
|
42
42
|
confium-tc = "0.3.1"
|
|
43
|
-
confium-tc-frost-p256 = "0.
|
|
44
|
-
confium-tc-elgamal-p256 = "0.
|
|
45
|
-
confium-tc-cmp20 = "0.
|
|
46
|
-
confium-tc-gg18 = "0.
|
|
43
|
+
confium-tc-frost-p256 = "0.4"
|
|
44
|
+
confium-tc-elgamal-p256 = "0.4"
|
|
45
|
+
confium-tc-cmp20 = "0.4"
|
|
46
|
+
confium-tc-gg18 = "0.4"
|
|
47
|
+
|
|
48
|
+
# Per-party session protocol: the tc-core 0.4 registry line. The 0.3-era
|
|
49
|
+
# in-process drivers above keep their own registry harmlessly.
|
|
50
|
+
confium-tc-session = { package = "confium-tc-core", version = "0.4.7" }
|
|
51
|
+
confium-tc-frost-ed25519 = "0.4.7"
|
|
47
52
|
|
|
48
53
|
# Newly published shared crypto crates (confium product restructuring).
|
|
49
54
|
confium-tc-core = "0.3"
|
|
@@ -14,6 +14,7 @@ mod path;
|
|
|
14
14
|
mod pki;
|
|
15
15
|
mod store;
|
|
16
16
|
mod tc;
|
|
17
|
+
mod tc_session;
|
|
17
18
|
mod transparency;
|
|
18
19
|
mod util;
|
|
19
20
|
|
|
@@ -54,6 +55,7 @@ fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
54
55
|
path::init(ruby, confium)?;
|
|
55
56
|
deployment::init(ruby, confium)?;
|
|
56
57
|
tc::init(ruby, confium)?;
|
|
58
|
+
tc_session::init(ruby, confium)?;
|
|
57
59
|
audit::init(ruby, confium)?;
|
|
58
60
|
ers::init(ruby, confium)?;
|
|
59
61
|
Ok(())
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
//! Confium::TC::Session — per-party threshold protocol sessions.
|
|
2
|
+
//!
|
|
3
|
+
//! Binds `confium_tc_core::Session`: each signer process runs ONE
|
|
4
|
+
//! session for its own party, feeding it the messages received from
|
|
5
|
+
//! the peers and sending on what `round_step` produces. The scheme
|
|
6
|
+
//! never leaves the process — this is the per-party half of the
|
|
7
|
+
//! multi-host signing story (the NetworkCoordinator is the transport
|
|
8
|
+
//! half).
|
|
9
|
+
//!
|
|
10
|
+
//! session = Confium::TC::Session.new("FROST-ed25519-dkg",
|
|
11
|
+
//! parties: ["p0", "p1", "p2"],
|
|
12
|
+
//! threshold: 2,
|
|
13
|
+
//! this_party_idx: 0)
|
|
14
|
+
//! loop do
|
|
15
|
+
//! result = session.round_step(incoming)
|
|
16
|
+
//! break if result["complete"]
|
|
17
|
+
//! incoming = broadcast(result["outgoing"])
|
|
18
|
+
//! end
|
|
19
|
+
//! session.result
|
|
20
|
+
//!
|
|
21
|
+
//! Messages are Hashes with string keys: `"from"`, `"to"` (nil for
|
|
22
|
+
//! broadcast), `"round"`, `"payload"` (binary String).
|
|
23
|
+
|
|
24
|
+
use magnus::{prelude::*, DataTypeFunctions, Error, Module, RArray, RHash, Ruby, TryConvert, TypedData, Value};
|
|
25
|
+
|
|
26
|
+
// Force the frost-ed25519 crate (and its `inventory::submit!` calls for
|
|
27
|
+
// FrostEd25519 + FrostEd25519Dkg) to be linked into the cdylib even
|
|
28
|
+
// though the binding itself never names a symbol from it — otherwise
|
|
29
|
+
// the linker drops the registration statics and `Session::create`
|
|
30
|
+
// reports the scheme as unknown.
|
|
31
|
+
extern crate confium_tc_frost_ed25519 as _frost_ed25519_link;
|
|
32
|
+
|
|
33
|
+
use confium_tc_session::{
|
|
34
|
+
session::{Session as RustSession, SessionParams}, share::Share, Error as TcError, Message,
|
|
35
|
+
Party, PartyList,
|
|
36
|
+
};
|
|
37
|
+
// (confium-tc-session is the renamed confium-tc-core 0.4.7 dependency.)
|
|
38
|
+
|
|
39
|
+
fn typed_session_error(e: TcError, operation: &str) -> Error {
|
|
40
|
+
let ruby = match Ruby::get() {
|
|
41
|
+
Ok(r) => r,
|
|
42
|
+
Err(_) => return Error::new(magnus::exception::runtime_error(), e.to_string()),
|
|
43
|
+
};
|
|
44
|
+
let details = crate::util::new_details(&ruby);
|
|
45
|
+
let _ = details.aset("operation", operation);
|
|
46
|
+
crate::util::confium_error(e.to_string(), "Error", details)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// Confium::TC::Session — see the module docs.
|
|
50
|
+
#[derive(TypedData, DataTypeFunctions)]
|
|
51
|
+
#[magnus(class = "Confium::TC::Session", size)]
|
|
52
|
+
pub struct Session {
|
|
53
|
+
inner: std::cell::RefCell<RustSession>,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
fn bytes_arg(v: Value, name: &str) -> Result<Vec<u8>, Error> {
|
|
57
|
+
crate::util::bytes_from_value(v)
|
|
58
|
+
.map_err(|e| crate::util::arg_error(format!("Session: {name}: {e}")))
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
impl Session {
|
|
62
|
+
fn initialize(ruby: &Ruby, args: &[Value]) -> Result<Self, Error> {
|
|
63
|
+
let scanned = magnus::scan_args::scan_args::<(String,), (Option<RHash>,), (), (), (), ()>(args)
|
|
64
|
+
.map_err(|e| crate::util::arg_error(e.to_string()))?;
|
|
65
|
+
let scheme = scanned.required.0;
|
|
66
|
+
let raw_opts = scanned
|
|
67
|
+
.optional
|
|
68
|
+
.0
|
|
69
|
+
.ok_or_else(|| crate::util::arg_error("Session.new: options Hash is required"))?;
|
|
70
|
+
// Ruby callers pass keywords (`parties: [...]`), which arrive as
|
|
71
|
+
// symbol keys; accept both symbol and string keys.
|
|
72
|
+
let opts = ruby.hash_new();
|
|
73
|
+
raw_opts.foreach(|k: Value, v: Value| {
|
|
74
|
+
let key: String = if k.is_kind_of(ruby.class_symbol()) {
|
|
75
|
+
k.funcall("to_s", ())?
|
|
76
|
+
} else {
|
|
77
|
+
<String as TryConvert>::try_convert(k)?
|
|
78
|
+
};
|
|
79
|
+
opts.aset(key, v)?;
|
|
80
|
+
Ok(magnus::r_hash::ForEach::Continue)
|
|
81
|
+
})?;
|
|
82
|
+
|
|
83
|
+
let required = |key: &str| -> Result<Value, Error> {
|
|
84
|
+
opts.fetch(key).map_err(|_| {
|
|
85
|
+
crate::util::arg_error(format!("Session.new: :{key} is required"))
|
|
86
|
+
})
|
|
87
|
+
};
|
|
88
|
+
let parties_val = required("parties")?;
|
|
89
|
+
let ids: Vec<String> = <Vec<String> as TryConvert>::try_convert(parties_val).map_err(|_| {
|
|
90
|
+
crate::util::arg_error("Session.new: :parties must be an Array of String ids")
|
|
91
|
+
})?;
|
|
92
|
+
if ids.len() < 2 {
|
|
93
|
+
return Err(crate::util::arg_error(
|
|
94
|
+
"Session.new: at least two parties are required",
|
|
95
|
+
));
|
|
96
|
+
}
|
|
97
|
+
let mut parties = PartyList::new();
|
|
98
|
+
for id in &ids {
|
|
99
|
+
parties.push(Party::new(id.clone(), None::<String>));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let threshold: u32 = <u32 as TryConvert>::try_convert(required("threshold")?)
|
|
103
|
+
.map_err(|_| crate::util::arg_error("Session.new: :threshold must be an Integer"))?;
|
|
104
|
+
let this_party_idx: usize = <usize as TryConvert>::try_convert(required("this_party_idx")?)
|
|
105
|
+
.map_err(|_| {
|
|
106
|
+
crate::util::arg_error("Session.new: :this_party_idx must be an Integer")
|
|
107
|
+
})?;
|
|
108
|
+
|
|
109
|
+
let local_share_v: Value = opts
|
|
110
|
+
.get("local_share")
|
|
111
|
+
.unwrap_or_else(|| ruby.qnil().as_value());
|
|
112
|
+
let local_share: Option<Share> = if local_share_v.is_nil() {
|
|
113
|
+
None
|
|
114
|
+
} else {
|
|
115
|
+
Some(Share::new(
|
|
116
|
+
scheme.clone(),
|
|
117
|
+
bytes_arg(local_share_v, "local_share")?,
|
|
118
|
+
))
|
|
119
|
+
};
|
|
120
|
+
let message_v: Value = opts
|
|
121
|
+
.get("message")
|
|
122
|
+
.unwrap_or_else(|| ruby.qnil().as_value());
|
|
123
|
+
let message: Option<Vec<u8>> = if message_v.is_nil() {
|
|
124
|
+
None
|
|
125
|
+
} else {
|
|
126
|
+
Some(bytes_arg(message_v, "message")?)
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
let params = SessionParams {
|
|
130
|
+
scheme: scheme.clone(),
|
|
131
|
+
parties,
|
|
132
|
+
threshold,
|
|
133
|
+
this_party_idx,
|
|
134
|
+
local_share,
|
|
135
|
+
message,
|
|
136
|
+
};
|
|
137
|
+
let inner = RustSession::create(¶ms)
|
|
138
|
+
.map_err(|e| typed_session_error(e, "Session.new"))?;
|
|
139
|
+
let _ = ruby;
|
|
140
|
+
Ok(Self {
|
|
141
|
+
inner: std::cell::RefCell::new(inner),
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
fn scheme_name(&self) -> String {
|
|
146
|
+
self.inner.borrow().scheme_name().to_string()
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
fn threshold(&self) -> u32 {
|
|
150
|
+
self.inner.borrow().threshold()
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
fn party_count(&self) -> usize {
|
|
154
|
+
self.inner.borrow().party_count()
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
fn this_party_idx(&self) -> usize {
|
|
158
|
+
self.inner.borrow().this_party_idx()
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
fn round(&self) -> u8 {
|
|
162
|
+
self.inner.borrow().round()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
fn complete(&self) -> bool {
|
|
166
|
+
self.inner.borrow().is_complete()
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
fn round_step(&self, args: &[Value]) -> Result<RHash, Error> {
|
|
170
|
+
let ruby = Ruby::get().map_err(|e| crate::util::runtime(e.to_string()))?;
|
|
171
|
+
let scanned =
|
|
172
|
+
magnus::scan_args::scan_args::<(), (Option<Value>,), (), (), (), ()>(args)
|
|
173
|
+
.map_err(|e| crate::util::arg_error(e.to_string()))?;
|
|
174
|
+
let incoming = match scanned.optional.0 {
|
|
175
|
+
Some(v) if !v.is_nil() => parse_messages(&ruby, v)?,
|
|
176
|
+
_ => Vec::new(),
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
let result = self
|
|
180
|
+
.inner
|
|
181
|
+
.borrow_mut()
|
|
182
|
+
.round_step(&incoming)
|
|
183
|
+
.map_err(|e| typed_session_error(e, "Session#round_step"))?;
|
|
184
|
+
|
|
185
|
+
let out = ruby.hash_new();
|
|
186
|
+
let arr = ruby.ary_new();
|
|
187
|
+
for m in &result.outgoing {
|
|
188
|
+
let h = ruby.hash_new();
|
|
189
|
+
let _ = h.aset("from", m.from_party_id.as_str());
|
|
190
|
+
let to: Value = match &m.to_party_id {
|
|
191
|
+
Some(t) => ruby.str_new(t).as_value(),
|
|
192
|
+
None => ruby.qnil().as_value(),
|
|
193
|
+
};
|
|
194
|
+
let _ = h.aset("to", to);
|
|
195
|
+
let _ = h.aset("round", m.round as i64);
|
|
196
|
+
let _ = h.aset(
|
|
197
|
+
"payload",
|
|
198
|
+
crate::util::bytes_to_rstring(&ruby, &m.payload),
|
|
199
|
+
);
|
|
200
|
+
arr.push(h)?;
|
|
201
|
+
}
|
|
202
|
+
let _ = out.aset("outgoing", arr);
|
|
203
|
+
let _ = out.aset("complete", result.complete);
|
|
204
|
+
Ok(out)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
fn result(&self) -> Result<magnus::RString, Error> {
|
|
208
|
+
let ruby = Ruby::get().map_err(|e| crate::util::runtime(e.to_string()))?;
|
|
209
|
+
let bytes = self
|
|
210
|
+
.inner
|
|
211
|
+
.borrow()
|
|
212
|
+
.result()
|
|
213
|
+
.map_err(|e| typed_session_error(e, "Session#result"))?;
|
|
214
|
+
Ok(crate::util::bytes_to_rstring(&ruby, &bytes))
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
fn parse_messages(ruby: &Ruby, value: Value) -> Result<Vec<Message>, Error> {
|
|
219
|
+
let arr: RArray = <RArray as TryConvert>::try_convert(value)
|
|
220
|
+
.map_err(|_| crate::util::arg_error("Session#round_step: incoming must be an Array"))?;
|
|
221
|
+
let mut out = Vec::with_capacity(arr.len());
|
|
222
|
+
for item in arr.into_iter() {
|
|
223
|
+
let h: RHash = <RHash as TryConvert>::try_convert(item).map_err(|_| {
|
|
224
|
+
crate::util::arg_error("Session#round_step: each message must be a Hash")
|
|
225
|
+
})?;
|
|
226
|
+
let fetch = |key: &str| -> Result<Value, Error> {
|
|
227
|
+
h.fetch(key)
|
|
228
|
+
.map_err(|_| crate::util::arg_error(format!("message: '{key}' is required")))
|
|
229
|
+
};
|
|
230
|
+
let from: String = <String as TryConvert>::try_convert(fetch("from")?)
|
|
231
|
+
.map_err(|_| crate::util::arg_error("message: 'from' must be a String"))?;
|
|
232
|
+
let to_v: Value = fetch("to")?;
|
|
233
|
+
let to: Option<String> = if to_v.is_nil() {
|
|
234
|
+
None
|
|
235
|
+
} else {
|
|
236
|
+
Some(
|
|
237
|
+
<String as TryConvert>::try_convert(to_v)
|
|
238
|
+
.map_err(|_| crate::util::arg_error("message: 'to' must be a String"))?,
|
|
239
|
+
)
|
|
240
|
+
};
|
|
241
|
+
let round: u8 = <u8 as TryConvert>::try_convert(fetch("round")?)
|
|
242
|
+
.map_err(|_| crate::util::arg_error("message: 'round' must be an Integer"))?;
|
|
243
|
+
let payload: Value = fetch("payload")?;
|
|
244
|
+
let payload = crate::util::bytes_from_value(payload)?;
|
|
245
|
+
let msg = match to {
|
|
246
|
+
Some(t) => Message::directed(from, t, round, payload),
|
|
247
|
+
None => Message::broadcast(from, round, payload),
|
|
248
|
+
};
|
|
249
|
+
out.push(msg);
|
|
250
|
+
let _ = ruby;
|
|
251
|
+
}
|
|
252
|
+
Ok(out)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
pub fn init(ruby: &Ruby, parent: magnus::RModule) -> Result<(), Error> {
|
|
256
|
+
let tc = parent.define_module("TC")?;
|
|
257
|
+
let class = tc.define_class("Session", ruby.class_object())?;
|
|
258
|
+
class.define_singleton_method("new", magnus::function!(Session::initialize, -1))?;
|
|
259
|
+
class.define_method("scheme_name", magnus::method!(Session::scheme_name, 0))?;
|
|
260
|
+
class.define_method("threshold", magnus::method!(Session::threshold, 0))?;
|
|
261
|
+
class.define_method("party_count", magnus::method!(Session::party_count, 0))?;
|
|
262
|
+
class.define_method("this_party_idx", magnus::method!(Session::this_party_idx, 0))?;
|
|
263
|
+
class.define_method("round", magnus::method!(Session::round, 0))?;
|
|
264
|
+
class.define_method("complete?", magnus::method!(Session::complete, 0))?;
|
|
265
|
+
class.define_method("round_step", magnus::method!(Session::round_step, -1))?;
|
|
266
|
+
class.define_method("result", magnus::method!(Session::result, 0))?;
|
|
267
|
+
Ok(())
|
|
268
|
+
}
|
data/lib/confium/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: confium
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Open
|
|
@@ -126,6 +126,7 @@ files:
|
|
|
126
126
|
- ext/confium_native/src/pki.rs
|
|
127
127
|
- ext/confium_native/src/store.rs
|
|
128
128
|
- ext/confium_native/src/tc.rs
|
|
129
|
+
- ext/confium_native/src/tc_session.rs
|
|
129
130
|
- ext/confium_native/src/transparency.rs
|
|
130
131
|
- ext/confium_native/src/util.rs
|
|
131
132
|
- lib/confium.rb
|