confium 0.6.3 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0739c3bc2fd3d3d347fd283d19bb70b9bd1611cd262c4d6229b80828d67b441c'
4
- data.tar.gz: ae757155d9a5312662d44ac21d740c68228b2e8ad011c178e168969b2563d068
3
+ metadata.gz: 604e0df1709827705bdca8fabd5ac2c5bdb70eb1e32b550e7ad7bfca143d7dcc
4
+ data.tar.gz: b1d4eea58189c4e1acf7613c27efc23ea7a76ea6afb9a32b911f27d56dc45a7c
5
5
  SHA512:
6
- metadata.gz: d17228e2f724d28a2481bd6c115cdec90f8955b346c7f72a22b0217d78f5365bbcb61930d08662562c1f9e4ec8b05eeb8dc73c63b30f902dbe27ede051fa9408
7
- data.tar.gz: 7780ff8ceff7791de1bca7e5dc7e15215db6886eec4cd6d01dbc75b0fa8d04c7d0350234bd33f8d5dfd94587b532c088246c59a28e7edd99ad3fb077ed7d8d34
6
+ metadata.gz: e07456a3f0a1c4499290372d238fd15e173e578deabb01de7bea5c5b6c014495eab86b962c71f33fb3f21c9d2f9124dd982373c5e7df404c011955180d136b1f
7
+ data.tar.gz: 2ee41a6707200f709086c9ae63d73554f2aa8836abf06c732a1ac904fded30baece97813b50a8229c2a351ea3cf0430d2265d3f93b06aa49daa4f8447c67e037
data/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.0] — 2026-09-07
4
+
5
+ ### Added
6
+
7
+ - `Confium::Transport::SignerClient` / `CoordinatorServer` —
8
+ coordinator sessions over any registry transport the extension
9
+ links, addressed by URL: `tcp://host:port` for local/trusted
10
+ networks, `noise://host:port` for Noise_XX
11
+ (`Noise_XX_25519_ChaChaPoly_BLAKE2s`) encrypted sessions.
12
+ `noise://` URLs take `key=<hex>` (local static private key;
13
+ ephemeral and trust-on-first-use when omitted) and `pinned=<hex>`
14
+ (SHA-256 fingerprint of the expected peer static key — the
15
+ handshake aborts on mismatch). The handshake carries a 10-second
16
+ deadline so a non-Noise peer fails fast instead of hanging.
17
+ `SignerClient` exposes `#register`, `#create_session`,
18
+ `#submit_commitment`, `#submit_share` (returns the aggregated
19
+ signature once the threshold is met, else nil);
20
+ `CoordinatorServer.new(url)` serves any linked scheme for tests
21
+ and single-process deployments.
22
+
23
+ ### Changed
24
+
25
+ - **BREAKING**: `Confium::Net` is `Confium::Transport`. Defining
26
+ `Confium::Net` shadowed Ruby stdlib `Net` for every constant
27
+ lookup under the `Confium` namespace — `Confium::Audit::OtlpSink`'s
28
+ `Net::HTTP` resolved to `Confium::Net::HTTP` and raised
29
+ `NameError`. No prior release shipped the `Net` names.
30
+
31
+ ## [0.6.3] — 2026-08-26
32
+
33
+ ### Added
34
+
35
+ - `Confium::TC::Session` — per-party threshold protocol sessions
36
+ over confium-tc-core 0.4: each signer process runs its own
37
+ session (`"FROST-ed25519-dkg"` for distributed key generation,
38
+ `"FROST-ed25519"` for signing with the DKG share and message) and
39
+ exchanges only `round_step` messages — the share never leaves the
40
+ process. `#round_step(incoming)` returns
41
+ `{ "outgoing" => [...], "complete" => bool }`; the completed DKG
42
+ session's `#result` is the party's share blob, the signing
43
+ session's `#result` an RFC 8032 Ed25519 signature verifiable under
44
+ the group public key.
45
+
3
46
  ## [0.6.2] — 2026-08-26
4
47
 
5
48
  ### Added
data/Cargo.lock CHANGED
@@ -135,6 +135,15 @@ dependencies = [
135
135
  "wyz",
136
136
  ]
137
137
 
138
+ [[package]]
139
+ name = "blake2"
140
+ version = "0.10.6"
141
+ source = "registry+https://github.com/rust-lang/crates.io-index"
142
+ checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe"
143
+ dependencies = [
144
+ "digest 0.10.7",
145
+ ]
146
+
138
147
  [[package]]
139
148
  name = "block-buffer"
140
149
  version = "0.10.4"
@@ -207,6 +216,30 @@ version = "1.0.4"
207
216
  source = "registry+https://github.com/rust-lang/crates.io-index"
208
217
  checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
209
218
 
219
+ [[package]]
220
+ name = "chacha20"
221
+ version = "0.9.1"
222
+ source = "registry+https://github.com/rust-lang/crates.io-index"
223
+ checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818"
224
+ dependencies = [
225
+ "cfg-if",
226
+ "cipher",
227
+ "cpufeatures 0.2.17",
228
+ ]
229
+
230
+ [[package]]
231
+ name = "chacha20poly1305"
232
+ version = "0.10.1"
233
+ source = "registry+https://github.com/rust-lang/crates.io-index"
234
+ checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35"
235
+ dependencies = [
236
+ "aead",
237
+ "chacha20",
238
+ "cipher",
239
+ "poly1305",
240
+ "zeroize",
241
+ ]
242
+
210
243
  [[package]]
211
244
  name = "chrono"
212
245
  version = "0.4.45"
@@ -229,6 +262,7 @@ checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
229
262
  dependencies = [
230
263
  "crypto-common 0.1.7",
231
264
  "inout",
265
+ "zeroize",
232
266
  ]
233
267
 
234
268
  [[package]]
@@ -301,7 +335,7 @@ checksum = "e8c96d4d5997726cf0eb794410e3e8bbce839cfba9c4a32e26ede0c076b02e64"
301
335
  dependencies = [
302
336
  "chrono",
303
337
  "confium-api",
304
- "confium-net",
338
+ "confium-net 0.3.0",
305
339
  "confium-store 0.3.0",
306
340
  "confium-tc-core 0.3.0",
307
341
  "data-encoding",
@@ -321,6 +355,26 @@ dependencies = [
321
355
  "zeroize",
322
356
  ]
323
357
 
358
+ [[package]]
359
+ name = "confium-coordinator"
360
+ version = "0.8.5"
361
+ source = "registry+https://github.com/rust-lang/crates.io-index"
362
+ checksum = "52f49eae3301b6f1f2f36b2eb66d0fdd863bcecb1dc18b51ec51e5f8d1bb9dc3"
363
+ dependencies = [
364
+ "chrono",
365
+ "confium-net 0.8.5",
366
+ "getrandom 0.4.3",
367
+ "hex",
368
+ "hmac 0.13.0",
369
+ "p256 0.14.0",
370
+ "rand_core 0.6.4",
371
+ "serde",
372
+ "serde_json",
373
+ "sha2 0.11.0",
374
+ "thiserror 2.0.20",
375
+ "tracing",
376
+ ]
377
+
324
378
  [[package]]
325
379
  name = "confium-core"
326
380
  version = "0.2.0"
@@ -413,6 +467,44 @@ dependencies = [
413
467
  "url",
414
468
  ]
415
469
 
470
+ [[package]]
471
+ name = "confium-net"
472
+ version = "0.8.5"
473
+ source = "registry+https://github.com/rust-lang/crates.io-index"
474
+ checksum = "2bd7098e54033a09b1f6a4ebd0c0f54d6c44da8f46cfdff7ae156895f1083fc6"
475
+ dependencies = [
476
+ "inventory",
477
+ "snafu 0.9.2",
478
+ "url",
479
+ ]
480
+
481
+ [[package]]
482
+ name = "confium-net-noise"
483
+ version = "0.8.5"
484
+ source = "registry+https://github.com/rust-lang/crates.io-index"
485
+ checksum = "213e90ce6daa40d1ec92d8e524276744a07f027c453bd32815f80c29ba947237"
486
+ dependencies = [
487
+ "confium-net 0.8.5",
488
+ "inventory",
489
+ "sha2 0.11.0",
490
+ "snafu 0.9.2",
491
+ "snow",
492
+ "url",
493
+ "x25519-dalek",
494
+ ]
495
+
496
+ [[package]]
497
+ name = "confium-net-tcp"
498
+ version = "0.8.3"
499
+ source = "registry+https://github.com/rust-lang/crates.io-index"
500
+ checksum = "1b80e3d692ed5328a72e754a0f73d81f6c8fde3714d05fc0be1953f657e05f76"
501
+ dependencies = [
502
+ "confium-net 0.8.5",
503
+ "inventory",
504
+ "snafu 0.9.2",
505
+ "url",
506
+ ]
507
+
416
508
  [[package]]
417
509
  name = "confium-observability"
418
510
  version = "0.3.0"
@@ -493,8 +585,8 @@ checksum = "3dd7d4965aef12324cb76d397294c317b83b774de029f1d37b387cf54ba9593c"
493
585
  dependencies = [
494
586
  "chrono",
495
587
  "confium-api",
496
- "confium-coordinator",
497
- "confium-net",
588
+ "confium-coordinator 0.3.0",
589
+ "confium-net 0.3.0",
498
590
  "confium-store 0.3.0",
499
591
  "confium-tc-keys",
500
592
  "data-encoding",
@@ -566,7 +658,7 @@ checksum = "add3e15337ce81944f78c9ce844d870a081cbe91506a85b9a5c4e4c0da983771"
566
658
  dependencies = [
567
659
  "chrono",
568
660
  "confium-api",
569
- "confium-net",
661
+ "confium-net 0.3.0",
570
662
  "confium-store 0.3.0",
571
663
  "data-encoding",
572
664
  "hex",
@@ -703,10 +795,13 @@ dependencies = [
703
795
  "chrono",
704
796
  "confium-attributes",
705
797
  "confium-composite",
798
+ "confium-coordinator 0.8.5",
706
799
  "confium-core",
707
800
  "confium-crypto-vss",
708
801
  "confium-crypto-zk",
709
802
  "confium-deployment",
803
+ "confium-net-noise",
804
+ "confium-net-tcp",
710
805
  "confium-observability",
711
806
  "confium-pki",
712
807
  "confium-privacy",
@@ -1215,6 +1310,18 @@ dependencies = [
1215
1310
  "wasi",
1216
1311
  ]
1217
1312
 
1313
+ [[package]]
1314
+ name = "getrandom"
1315
+ version = "0.3.4"
1316
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1317
+ checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
1318
+ dependencies = [
1319
+ "cfg-if",
1320
+ "libc",
1321
+ "r-efi 5.3.0",
1322
+ "wasip2",
1323
+ ]
1324
+
1218
1325
  [[package]]
1219
1326
  name = "getrandom"
1220
1327
  version = "0.4.3"
@@ -1223,7 +1330,7 @@ checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
1223
1330
  dependencies = [
1224
1331
  "cfg-if",
1225
1332
  "libc",
1226
- "r-efi",
1333
+ "r-efi 6.0.0",
1227
1334
  "rand_core 0.10.1",
1228
1335
  ]
1229
1336
 
@@ -1785,6 +1892,17 @@ version = "0.3.34"
1785
1892
  source = "registry+https://github.com/rust-lang/crates.io-index"
1786
1893
  checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
1787
1894
 
1895
+ [[package]]
1896
+ name = "poly1305"
1897
+ version = "0.8.0"
1898
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1899
+ checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf"
1900
+ dependencies = [
1901
+ "cpufeatures 0.2.17",
1902
+ "opaque-debug",
1903
+ "universal-hash",
1904
+ ]
1905
+
1788
1906
  [[package]]
1789
1907
  name = "polyval"
1790
1908
  version = "0.6.2"
@@ -1879,6 +1997,12 @@ dependencies = [
1879
1997
  "proc-macro2",
1880
1998
  ]
1881
1999
 
2000
+ [[package]]
2001
+ name = "r-efi"
2002
+ version = "5.3.0"
2003
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2004
+ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
2005
+
1882
2006
  [[package]]
1883
2007
  name = "r-efi"
1884
2008
  version = "6.0.0"
@@ -2348,6 +2472,23 @@ dependencies = [
2348
2472
  "syn 2.0.119",
2349
2473
  ]
2350
2474
 
2475
+ [[package]]
2476
+ name = "snow"
2477
+ version = "0.10.0"
2478
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2479
+ checksum = "599b506ccc4aff8cf7844bc42cf783009a434c1e26c964432560fb6d6ad02d82"
2480
+ dependencies = [
2481
+ "aes-gcm",
2482
+ "blake2",
2483
+ "chacha20poly1305",
2484
+ "curve25519-dalek",
2485
+ "getrandom 0.3.4",
2486
+ "ring",
2487
+ "rustc_version",
2488
+ "sha2 0.10.9",
2489
+ "subtle",
2490
+ ]
2491
+
2351
2492
  [[package]]
2352
2493
  name = "spki"
2353
2494
  version = "0.7.3"
@@ -2666,6 +2807,15 @@ version = "0.11.1+wasi-snapshot-preview1"
2666
2807
  source = "registry+https://github.com/rust-lang/crates.io-index"
2667
2808
  checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
2668
2809
 
2810
+ [[package]]
2811
+ name = "wasip2"
2812
+ version = "1.0.4+wasi-0.2.12"
2813
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2814
+ checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487"
2815
+ dependencies = [
2816
+ "wit-bindgen",
2817
+ ]
2818
+
2669
2819
  [[package]]
2670
2820
  name = "wasm-bindgen"
2671
2821
  version = "0.2.126"
@@ -2870,6 +3020,12 @@ dependencies = [
2870
3020
  "memchr",
2871
3021
  ]
2872
3022
 
3023
+ [[package]]
3024
+ name = "wit-bindgen"
3025
+ version = "0.57.1"
3026
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3027
+ checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
3028
+
2873
3029
  [[package]]
2874
3030
  name = "wnaf"
2875
3031
  version = "0.14.0"
@@ -2896,6 +3052,18 @@ dependencies = [
2896
3052
  "tap",
2897
3053
  ]
2898
3054
 
3055
+ [[package]]
3056
+ name = "x25519-dalek"
3057
+ version = "2.0.1"
3058
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3059
+ checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277"
3060
+ dependencies = [
3061
+ "curve25519-dalek",
3062
+ "rand_core 0.6.4",
3063
+ "serde",
3064
+ "zeroize",
3065
+ ]
3066
+
2899
3067
  [[package]]
2900
3068
  name = "x509-cert"
2901
3069
  version = "0.3.0"
data/README.adoc CHANGED
@@ -18,7 +18,7 @@ Add to your Gemfile:
18
18
 
19
19
  [source,ruby]
20
20
  ----
21
- gem "confium", "~> 0.3"
21
+ gem "confium", "~> 0.7"
22
22
  ----
23
23
 
24
24
  Or install directly:
@@ -78,18 +78,38 @@ kp = Confium::TC::FrostP256.generate_keypair
78
78
  shares = Confium::TC::FrostP256.split_secret(kp["private_key"], 3, 5)
79
79
  recovered = Confium::TC::FrostP256.recover_secret(shares.first(3).map { |s| { "x" => s.x, "y" => s.y_bytes } })
80
80
  recovered == kp["private_key"] # => true
81
+
82
+ # Distributed key generation + 2-of-3 FROST-ed25519 signing (each party
83
+ # holds its own Confium::TC::Session and only exchanges round messages)
84
+ parties = %w[alice bob carol]
85
+ sessions = parties.each_with_index.map do |id, i|
86
+ Confium::TC::Session.new("FROST-ed25519-dkg", parties: parties, threshold: 2, this_party_idx: i)
87
+ end
88
+ # run rounds: session.round_step(messages_in) -> {"outgoing" => [...], "complete" => bool}
89
+ # broadcast "outgoing" payloads between sessions until every session is complete
90
+ dkg_share = sessions.first.result # this party's share (embeds the group public key)
91
+
92
+ signers = sessions.first(2).map.with_index do |s, i|
93
+ Confium::TC::Session.new("FROST-ed25519",
94
+ parties: parties.first(2), threshold: 2, this_party_idx: i,
95
+ local_share: dkg_share, message: "authentic message")
96
+ end
97
+ # run rounds as above; the completed session's #result is an RFC 8032
98
+ # Ed25519 signature verifiable under the group public key
81
99
  ----
82
100
 
83
- == API surface (v0.3)
101
+ == API surface (v0.7)
84
102
 
85
103
  === `Confium::Transparency`
86
104
  - `MerkleTree.new` / `#append(artifact_hash)` / `#root` / `#length` / `#empty?` / `#inclusion_proof(seq)`
87
105
  - `InclusionProof#sequence` / `#steps` / `#verify(root)`
106
+ - `Ots.stamp(hash)` / `Ots.verify(receipt, hash)` — OpenTimestamps anchoring interface (pure-Ruby stub; calendar-server wiring lands with the Rust client)
88
107
 
89
108
  === `Confium::Composite` — PQ migration
90
109
  - `.generate_ed25519_keypair` → `{ private_key:, public_key: }`
91
110
  - `.sign_ed25519(private_key, message)` → component Hash
92
- - `Signature.new(components)` / `#verify(message)` / `#component_count` / `#algorithms`
111
+ - `Signature.new(components)` / `#verify(message)` / `#component_count` / `#algorithms` / `#to_json`
112
+ - `.from_json(json)` / `.components_to_json(components)` / `.canonical_json(json, data)`
93
113
  - `VerificationResult#all_verified?` / `#per_component`
94
114
 
95
115
  === `Confium::Attributes` — threshold policy DSL
@@ -99,11 +119,14 @@ recovered == kp["private_key"] # => true
99
119
  - DSL: `min_count("attr", n)`, `min_distinct("attr", n)`, `any("attr")`, `all("attr")`, `none("attr")`, `and(...)`, `or(...)`, `not(p)`
100
120
 
101
121
  === `Confium::PKI`
102
- - `Certificate.from_der(bytes)` / `.from_pem(str)` / `#to_der` / `#to_pem` / `#fingerprint_sha256` / `#serial_hex` / `#not_before` / `#not_after` / `#valid_at?(iso8601)` / `#public_key_bytes`
122
+ - `Certificate.from_der(bytes)` / `.from_pem(str)` / `#to_der` / `#to_pem` / `#fingerprint_sha256` / `#serial_hex` / `#not_before` / `#not_after` / `#valid_at?(iso8601)` / `#public_key_bytes`; DER parse failures carry a byte `offset` in the error details
123
+ - `CertificateBuilder` / `CMS::SignedDataBuilder` — build certificates and signed data in Ruby
124
+ - `PathValidator.validate(leaf, intermediates, root, now_iso8601 = nil)` → `PathValidationResult` (chain validation leaf → root at a point in time)
103
125
  - `CSR.from_der` / `.from_pem` / `#to_der` / `#to_pem`
104
126
  - `CMS::SignedData.from_json` / `#to_json` / `#signer_count` / `#content_type` / `#content` / `#certificate_count` / `#certificate_at(i)`
105
127
  - `CMS::Content#bytes` / `#length`
106
128
  - `XMLDSig.canonicalize(xml)` / `.canonicalize_exclusive(xml)` (Canonical XML RFC 3076 + Exclusive C14N)
129
+ - `Cnml` — institutional certificate workflow helpers
107
130
 
108
131
  === `Confium::Identity` — actor roles
109
132
  - `.actor_types` → `["manufacturer", "testing_lab", "issuing_authority_officer", "biml_director", "quorum_coordinator", "verifier"]`
@@ -123,6 +146,51 @@ recovered == kp["private_key"] # => true
123
146
  - `.partial_decrypt(party_index, share_bytes, ciphertext)` → `{ party_index:, bytes: }`
124
147
  - `.aggregate_partials(partials, threshold, ciphertext)` → shared_secret bytes
125
148
 
149
+ === `Confium::TC::Cmp20` / `Confium::TC::Gg18` — threshold ECDSA protocols
150
+ - `.keygen(threshold, parties)` → `{ public_key, shares }`
151
+ - `.sign(shares, public_key, message)` → DER ECDSA signature
152
+
153
+ === `Confium::TC::Session` — per-party threshold sessions (real FROST)
154
+ - `Session.new(scheme, parties:, threshold:, this_party_idx:, local_share: nil, message: nil)` — `"FROST-ed25519-dkg"` for distributed key generation, `"FROST-ed25519"` for signing (pass the DKG share and the message)
155
+ - `#scheme_name` / `#threshold` / `#party_count` / `#this_party_idx` / `#round` / `#complete?`
156
+ - `#round_step(messages)` → `{ "outgoing" => [{from, to, round, payload}...], "complete" => bool }` — feed each round's incoming messages, broadcast the outgoing ones
157
+ - `#result` — after DKG: share blob (group public key + party share); after signing: RFC 8032 Ed25519 signature
158
+
159
+ === `Confium::TC::Coordinator` — quorum signing orchestration
160
+ - `Coordinator.new(quorum_id:)` / `#create_session(message:, threshold:, scheme: "CMP20-ECDSA-P256")` / `#submit_commitment` / `#submit_share` / `#aggregate` / `#session_state`
161
+ - `SigningSession#add_commitment` / `#add_share` / `#threshold_met?` / `#aggregate` — the seam every transport adapts to
162
+ - `NetworkCoordinator` — TCP/NDJSON server (`#start` / `#stop` / `#running?`); `SignerClient` — remote submit + aggregate with typed `RemoteError`
163
+ - `ShareFile` — encrypted share-file persistence
164
+
165
+ === `Confium::Store::Keystore` — key handles and remote signing
166
+ - `Keystore.new(backend, **options)` / `.backends`
167
+ - `#sign(key_id, algorithm, message)` → signature bytes (sign-with-handle contract; cloud KMS backends `aws-kms` / `gcp-kms` / `azure-keyvault` via cargo features)
168
+
169
+ === `Confium::Audit` — structured audit trail
170
+ - `Audit.sink =` / `Audit.sink` / `Audit.enabled?` / `Audit.record(...)`
171
+ - `Sink` (base) / `MemorySink` / `StderrSink` / `FileSink`
172
+ - `OtlpSink.new(endpoint:, headers:, service_name:, ...)` — OTLP/HTTP export with retry and `#dropped` counter
173
+
174
+ === `Confium::OpenPGP`
175
+ - `.armor(data, type)` / `.dearmor(data)` — RFC 9580 §6 ASCII armor with CRC-24 (pure Ruby)
176
+ - `.verify_detached(message, signature, keys)` / `.verify(...)` — real signature verification when the extension is built with the `pgp` feature; `PGP_AVAILABLE` reports it
177
+
178
+ === `Confium::Transport` — coordinator clients over any transport
179
+ - `SignerClient.new(url)` — connect over any registry transport: `tcp://host:port` (local/trusted) or `noise://host:port?key=<hex>&pinned=<hex>` (Noise_XX encrypted, stable identity + peer pinning)
180
+ - `#register(signer_id, quorum_id)` / `#create_session(quorum_id, scheme, message, threshold, num_parties)` → session id
181
+ - `#submit_commitment(session_id, signer_id, bytes)` / `#submit_share(session_id, signer_id, bytes)`
182
+ - `CoordinatorServer.new(url)` — serve coordinator sessions over any linked scheme (test/in-process use)
183
+
184
+ === `Confium::ERS` — evidence records
185
+ - `EvidenceRecord.build_initial(...)` / `#renew(...)` / `#renewal_count` (RFC 4998 / RFC 6283 archival)
186
+
187
+ === `Confium::Policy` / `Confium::SecureBytes`
188
+ - `Policy.jurisdiction = :eu` — jurisdictional algorithm policy (EU/US profiles; SM2/SM3/SM4 for CN planned)
189
+ - `SecureBytes.wrap(raw)` — zeroize-on-clear wrapper for private keys, shares, and secrets (`#bytes` non-destructive read, `#clear`)
190
+
191
+ === Errors
192
+ - Typed error hierarchy (`ParseError`, `ThresholdError`, `VerificationError`, `PolicyViolationError`, ...) — native failures surface positional `details` hashes (including DER byte offsets for parse errors)
193
+
126
194
  == Development
127
195
 
128
196
  After checking out the repo:
data/confium.gemspec CHANGED
@@ -40,6 +40,8 @@ Gem::Specification.new do |spec|
40
40
  ]
41
41
  spec.files.reject! { |f| File.directory?(f) }
42
42
  spec.files.reject! { |f| f =~ /\.(dll|so|dylib|lib|bundle)\Z/ }
43
+ # Windows socket diagnostic crate — development-only, never shipped.
44
+ spec.files.reject! { |f| f.start_with?('ext/socket-smoke/') }
43
45
  spec.require_paths = ['lib']
44
46
 
45
47
  spec.required_ruby_version = '>= 3.1.0'
@@ -25,6 +25,9 @@ build = "build.rs"
25
25
  pgp = ["rnp"]
26
26
 
27
27
  [dependencies]
28
+ confium-coordinator = "0.8"
29
+ confium-net-noise = "0.8"
30
+ confium-net-tcp = "0.8"
28
31
  # rb-sys for Ruby C API access.
29
32
  rb-sys = { version = "0.9.124", features = ["global-allocator"] }
30
33
 
@@ -14,10 +14,14 @@ mod path;
14
14
  mod pki;
15
15
  mod store;
16
16
  mod tc;
17
+ mod net;
17
18
  mod tc_session;
18
19
  mod transparency;
19
20
  mod util;
20
21
 
22
+ #[cfg(windows)]
23
+ mod winsock;
24
+
21
25
  use magnus::{function, Error, Module, Ruby};
22
26
 
23
27
  const VERSION: &str = env!("CARGO_PKG_VERSION");
@@ -30,6 +34,19 @@ fn native_loaded() -> bool {
30
34
  true
31
35
  }
32
36
 
37
+ /// `Confium::Native.winsock_probe(tag)` — run the winsock diagnostic
38
+ /// sequence at an arbitrary point (Windows only; no-op elsewhere).
39
+ /// Timeline bisect for the listener bind failure: call it at ext
40
+ /// load, suite start, and just before a ceremony to see exactly when
41
+ /// each std net operation degrades.
42
+ fn winsock_probe_fn(tag: String) -> Result<(), Error> {
43
+ #[cfg(windows)]
44
+ winsock::probe_on_demand(&tag);
45
+ #[cfg(not(windows))]
46
+ let _ = tag;
47
+ Ok(())
48
+ }
49
+
33
50
  fn core_version() -> &'static str {
34
51
  // Set by build.rs at compile time from Cargo.lock. Always matches the
35
52
  // confium-core crate version the extension was built against.
@@ -38,11 +55,15 @@ fn core_version() -> &'static str {
38
55
 
39
56
  #[magnus::init]
40
57
  fn init(ruby: &Ruby) -> Result<(), Error> {
58
+ #[cfg(windows)]
59
+ winsock::probe();
60
+
41
61
  let confium = ruby.define_module("Confium")?;
42
62
  let native = confium.define_module("Native")?;
43
63
  native.define_module_function("version", function!(native_version, 0))?;
44
64
  native.define_module_function("loaded?", function!(native_loaded, 0))?;
45
65
  confium.define_module_function("core_version", function!(core_version, 0))?;
66
+ native.define_module_function("winsock_probe", function!(winsock_probe_fn, 1))?;
46
67
 
47
68
  transparency::init(ruby, confium)?;
48
69
  openpgp_verify::init(ruby, confium)?;
@@ -56,6 +77,7 @@ fn init(ruby: &Ruby) -> Result<(), Error> {
56
77
  deployment::init(ruby, confium)?;
57
78
  tc::init(ruby, confium)?;
58
79
  tc_session::init(ruby, confium)?;
80
+ net::init(ruby, confium)?;
59
81
  audit::init(ruby, confium)?;
60
82
  ers::init(ruby, confium)?;
61
83
  Ok(())
@@ -0,0 +1,125 @@
1
+ //! Confium::Transport — transport-level coordinator clients.
2
+ //!
3
+ //! Binds the registry-transport coordinator surface: a signer dials
4
+ //! the coordinator over any URL scheme the native library links
5
+ //! (tcp:// for local/trusted, noise:// for encrypted sessions with
6
+ //! key=/pinned= parameters), and a CoordinatorServer serves any
7
+ //! linked scheme. This is the transport half of multi-host signing;
8
+ //! the protocol half is Confium::TC::Session.
9
+
10
+ use magnus::{prelude::*, DataTypeFunctions, Error, Ruby, TypedData};
11
+
12
+ // Force the noise transport crate (and its `register_transport!`
13
+ // static) into the cdylib so the noise:// scheme resolves — the
14
+ // binding itself never names a symbol from it.
15
+ extern crate confium_net_noise as _noise_link;
16
+ extern crate confium_net_tcp as _tcp_link;
17
+
18
+ use confium_coordinator::coordinator::client::SignerClient as RustSignerClient;
19
+ use confium_coordinator::coordinator::net_server::CoordinatorServer as RustCoordinatorServer;
20
+
21
+ fn io_error(e: std::io::Error, operation: &str) -> Error {
22
+ magnus::Error::new(
23
+ magnus::exception::io_error(),
24
+ format!("{operation}: {e}"),
25
+ )
26
+ }
27
+
28
+ /// Confium::Transport::SignerClient — a coordinator connection over a
29
+ /// registry transport URL.
30
+ #[derive(TypedData, DataTypeFunctions)]
31
+ #[magnus(class = "Confium::Transport::SignerClient", size)]
32
+ pub struct SignerClient {
33
+ inner: std::cell::RefCell<RustSignerClient>,
34
+ }
35
+
36
+ impl SignerClient {
37
+ fn initialize(ruby: &Ruby, url: String) -> Result<Self, Error> {
38
+ let _ = ruby;
39
+ let inner = RustSignerClient::connect_url(&url).map_err(|e| io_error(e, "SignerClient.new"))?;
40
+ Ok(Self { inner: std::cell::RefCell::new(inner) })
41
+ }
42
+
43
+ fn register(&self, signer_id: String, quorum_id: String) -> Result<(), Error> {
44
+ self.inner
45
+ .borrow_mut()
46
+ .register(&signer_id, &quorum_id)
47
+ .map_err(|e| io_error(e, "register"))
48
+ }
49
+
50
+ fn create_session(
51
+ &self,
52
+ quorum_id: String,
53
+ scheme: String,
54
+ message: String,
55
+ threshold: u32,
56
+ num_parties: u32,
57
+ ) -> Result<String, Error> {
58
+ self.inner
59
+ .borrow_mut()
60
+ .create_session(&quorum_id, &scheme, message.as_bytes(), threshold, num_parties)
61
+ .map_err(|e| io_error(e, "create_session"))
62
+ }
63
+
64
+ fn submit_commitment(&self, args: &[magnus::Value]) -> Result<(), Error> {
65
+ let scanned = magnus::scan_args::scan_args::<(String, String, Vec<u8>), (), (), (), (), ()>(args)
66
+ .map_err(|e| magnus::Error::new(magnus::exception::arg_error(), e.to_string()))?;
67
+ let (session_id, signer_id, commitment) = scanned.required;
68
+ self.inner
69
+ .borrow_mut()
70
+ .submit_commitment(&session_id, &signer_id, &commitment)
71
+ .map_err(|e| io_error(e, "submit_commitment"))
72
+ }
73
+
74
+ fn submit_share(&self, args: &[magnus::Value]) -> Result<Option<Vec<u8>>, Error> {
75
+ let scanned = magnus::scan_args::scan_args::<(String, String, Vec<u8>), (), (), (), (), ()>(args)
76
+ .map_err(|e| magnus::Error::new(magnus::exception::arg_error(), e.to_string()))?;
77
+ let (session_id, signer_id, share) = scanned.required;
78
+ self.inner
79
+ .borrow_mut()
80
+ .submit_share(&session_id, &signer_id, &share)
81
+ .map_err(|e| io_error(e, "submit_share"))
82
+ }
83
+ }
84
+
85
+ /// Confium::Transport::CoordinatorServer — serves coordinator sessions over
86
+ /// any linked transport scheme. Held in a Ruby object; the server
87
+ /// thread runs until the process exits.
88
+ #[derive(TypedData, DataTypeFunctions)]
89
+ #[magnus(class = "Confium::Transport::CoordinatorServer", size)]
90
+ pub struct CoordinatorServer {
91
+ _bound: String,
92
+ }
93
+
94
+ impl CoordinatorServer {
95
+ fn initialize(ruby: &Ruby, url: String) -> Result<Self, Error> {
96
+ let _ = ruby;
97
+ let server = RustCoordinatorServer::new(&url);
98
+ let bound = server
99
+ .start_url(&url)
100
+ .map_err(|e| io_error(e, "CoordinatorServer.new"))?;
101
+ Ok(Self { _bound: bound })
102
+ }
103
+ }
104
+
105
+ pub fn init(ruby: &Ruby, parent: magnus::RModule) -> Result<(), Error> {
106
+ let net = parent.define_module("Transport")?;
107
+
108
+ let client = net.define_class("SignerClient", ruby.class_object())?;
109
+ client.define_singleton_method("new", magnus::function!(SignerClient::initialize, 1))?;
110
+ client.define_method("register", magnus::method!(SignerClient::register, 2))?;
111
+ client.define_method(
112
+ "create_session",
113
+ magnus::method!(SignerClient::create_session, 5),
114
+ )?;
115
+ client.define_method(
116
+ "submit_commitment",
117
+ magnus::method!(SignerClient::submit_commitment, -1),
118
+ )?;
119
+ client.define_method("submit_share", magnus::method!(SignerClient::submit_share, -1))?;
120
+
121
+ let server = net.define_class("CoordinatorServer", ruby.class_object())?;
122
+ server.define_singleton_method("new", magnus::function!(CoordinatorServer::initialize, 1))?;
123
+
124
+ Ok(())
125
+ }