confium 0.3.0 → 0.3.2

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -0
  3. data/Cargo.lock +106 -5
  4. data/Rakefile +22 -9
  5. data/confium.gemspec +28 -28
  6. data/ext/confium_native/Cargo.toml +1 -0
  7. data/ext/confium_native/extconf.rb +4 -4
  8. data/ext/confium_native/src/attributes.rs +1 -1
  9. data/ext/confium_native/src/audit.rs +1 -1
  10. data/ext/confium_native/src/composite.rs +1 -1
  11. data/ext/confium_native/src/deployment.rs +1 -1
  12. data/ext/confium_native/src/ers.rs +1 -1
  13. data/ext/confium_native/src/openpgp.rs +1 -1
  14. data/ext/confium_native/src/path.rs +1 -1
  15. data/ext/confium_native/src/pki.rs +1 -1
  16. data/ext/confium_native/src/tc.rs +2 -2
  17. data/ext/confium_native/src/transparency.rs +5 -3
  18. data/ext/confium_native/src/util.rs +5 -0
  19. data/lib/confium/audit.rb +5 -5
  20. data/lib/confium/cfm.rb +2 -1
  21. data/lib/confium/digest.rb +4 -2
  22. data/lib/confium/errors/coerce.rb +1 -3
  23. data/lib/confium/errors/crypto_error.rb +8 -6
  24. data/lib/confium/errors/index_error.rb +9 -7
  25. data/lib/confium/errors/not_found_error.rb +9 -7
  26. data/lib/confium/errors/parse_error.rb +9 -7
  27. data/lib/confium/errors/policy_violation_error.rb +9 -7
  28. data/lib/confium/errors/threshold_error.rb +9 -7
  29. data/lib/confium/errors/unresolved_signer_error.rb +8 -6
  30. data/lib/confium/errors/validation_error.rb +10 -8
  31. data/lib/confium/errors/verification_error.rb +9 -7
  32. data/lib/confium/errors.rb +1 -1
  33. data/lib/confium/ffi.rb +4 -4
  34. data/lib/confium/lib.rb +18 -19
  35. data/lib/confium/pki/certificate_builder.rb +3 -3
  36. data/lib/confium/pki/cms/signed_data_builder.rb +10 -10
  37. data/lib/confium/pki/cms.rb +1 -1
  38. data/lib/confium/pki/cnml.rb +8 -8
  39. data/lib/confium/pki.rb +1 -1
  40. data/lib/confium/policy.rb +13 -13
  41. data/lib/confium/secure_bytes.rb +91 -89
  42. data/lib/confium/tc/coordinator.rb +7 -6
  43. data/lib/confium/tc/session.rb +5 -3
  44. data/lib/confium/tc/session_stub.rb +2 -2
  45. data/lib/confium/tc/share_file.rb +13 -13
  46. data/lib/confium/tc.rb +2 -2
  47. data/lib/confium/version.rb +1 -1
  48. data/lib/confium.rb +32 -20
  49. metadata +8 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36b9e9d9aa6a0b038c85ea24caefa5d0e16e9a4efda0bc9a73b1558cc2b52d97
4
- data.tar.gz: d2490e0cf9169a5bf7f05a74600d0a0de115a13d2bb08d58e3e5e121cbe39d2c
3
+ metadata.gz: c8445c7b4b7f4fdea4740a5f22874c5a97eda59e75ebe5cf327dbc84b67ff6f2
4
+ data.tar.gz: 68381a40a3a7f21b5f4330611bbe86e7abbf9223602288f105f611553e86cd21
5
5
  SHA512:
6
- metadata.gz: fd4fde001b8e29ce40d58df86914b2ef6f5322d48bee02858df0a954a7e1575ef4ce42750acd27830bbe1e4ad6e247df56931c9bd8ee1eff0f25b9477fed8602
7
- data.tar.gz: 8b99c6f42ee573a1075fc950dc49ec167b3bde4180243df990c2fcab946d2c5a10af6f226434005158e740441dd84097f0efcd2ce0ee72e187e5792237dbc8df
6
+ metadata.gz: 00cf2dd64ba0bce3897db2d5f026818ccc5f90cc1ad1f27a65869827f530811df1a60c50e6fefeb9c83183859bccce81194b0e031e2fbff5b8213d53bb3cb4cb
7
+ data.tar.gz: a2f6509125418022a2aa3d98d86b724cc841f7f3067884c482d345f2f3b28a0adb63b51dbba34d48dd5d64aa1c827a42d8bf86be273160feb631d5e8a68b72b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,62 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.2] — 2026-08-22
4
+
5
+ Native platform gems (linux x86_64/aarch64, macOS x86_64/arm64) ship
6
+ alongside the source gem — `gem install` no longer needs a Rust
7
+ toolchain on those platforms.
8
+
9
+ The 0.3.0/0.3.1 native-gem builds never actually produced platform
10
+ gems: the cross-compile task targeted a nonexistent rake task inside
11
+ a container whose shell swallowed the failure, and the fallback
12
+ `gem build` stamped platform=ruby. RubyGems blocks re-pushing a
13
+ version that ever existed, so the native gems first appear here.
14
+
15
+ ### Fixed
16
+
17
+ - Platform gems now build on native-arch runners (one per target
18
+ platform). Cross-compilation via rake-compiler-dock is impossible
19
+ for this gem: the dock images are Ubuntu 20.04 (gcc 9.4) while the
20
+ vendored RNP stack needs Botan 3.12, which requires gcc 11+.
21
+ - Each platform gem carries one extension per C-ABI window — exact
22
+ minors 3.1 and 3.2, plus 3.3 (loads on 3.3+) — because Ruby 3.2
23
+ broke the 3.1 ABI (a 3.1-built extension segfaults on 3.2) and
24
+ rb-sys references `ruby_current_vm_ptr` when built against
25
+ Ruby <= 3.2, which libruby stopped exporting in 3.3.
26
+ `lib/confium.rb` picks the window for the running Ruby; source
27
+ builds keep the flat extension path.
28
+ - The release workflow no longer builds a source gem (that burned
29
+ the 0.3.1 version slots against test-and-release.yml's publish),
30
+ refuses to push any gem stamped platform=ruby, and installs each
31
+ packaged gem on Ruby 3.1 through 3.4 before publishing.
32
+ - Windows remains unsupported: the vendored RNP (json-c + botan)
33
+ build has no MSVC/mingw story.
34
+
35
+ ## [0.3.1] — 2026-08-21
36
+
37
+ Shipped as a source gem only (the intended native platform gems
38
+ failed to materialize; see 0.3.2).
39
+
40
+ ### Added
41
+
42
+ - ERS archival binding (`Confium::EvidenceRecord`, RFC 4998) and the
43
+ `CONFIUM_LIB` explicit dylib path override.
44
+ - Audit log bindings with sign-triggered autofire and an Enumerable
45
+ `MemorySink`.
46
+ - Typed error hierarchy across all subsystems with native-error
47
+ coercion.
48
+ - CMP20/GG18 in-process threshold ECDSA (`Confium::TC::Cmp20`,
49
+ `Confium::TC::Gg18`) and TC share files with the documented
50
+ envelope shape.
51
+ - Twenty worked examples plus the examples and CNML-profile guides.
52
+
53
+ ### Fixed
54
+
55
+ - The PKI CSR spec no longer shells out to the openssl CLI (it
56
+ generated its fixture with a key file that was never created).
57
+ - CI: first `.rubocop.yml`, Ruby-3.1-compatible lockfile, and a test
58
+ matrix matching the shipped platforms.
59
+
3
60
  ## [0.3.0] — 2026-08-04
4
61
 
5
62
  Synced with Confium Rust workspace v0.3.0 (product restructuring).
data/Cargo.lock CHANGED
@@ -1,6 +1,6 @@
1
1
  # This file is automatically @generated by Cargo.
2
2
  # It is not intended for manual editing.
3
- version = 3
3
+ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "adler2"
@@ -239,6 +239,8 @@ dependencies = [
239
239
  [[package]]
240
240
  name = "confium-api"
241
241
  version = "0.3.0"
242
+ source = "registry+https://github.com/rust-lang/crates.io-index"
243
+ checksum = "edbc3fc8f6518e979ff76837b40c543b85bfc764bac2855d87ae79c68cbfcc5a"
242
244
  dependencies = [
243
245
  "confium-macros",
244
246
  "inventory",
@@ -273,6 +275,8 @@ dependencies = [
273
275
  [[package]]
274
276
  name = "confium-coordinator"
275
277
  version = "0.3.0"
278
+ source = "registry+https://github.com/rust-lang/crates.io-index"
279
+ checksum = "e8c96d4d5997726cf0eb794410e3e8bbce839cfba9c4a32e26ede0c076b02e64"
276
280
  dependencies = [
277
281
  "chrono",
278
282
  "confium-api",
@@ -310,6 +314,45 @@ dependencies = [
310
314
  "zeroize",
311
315
  ]
312
316
 
317
+ [[package]]
318
+ name = "confium-crypto-vss"
319
+ version = "0.3.0"
320
+ source = "registry+https://github.com/rust-lang/crates.io-index"
321
+ checksum = "19bea8bcb5a76b88ccca2471352176ea234e86c1360982f4a1d7357c2f89ab73"
322
+ dependencies = [
323
+ "hex",
324
+ "hmac",
325
+ "num-bigint",
326
+ "num-integer",
327
+ "num-traits",
328
+ "p256",
329
+ "rand",
330
+ "rand_core",
331
+ "serde",
332
+ "serde_json",
333
+ "sha2",
334
+ "subtle",
335
+ "thiserror",
336
+ ]
337
+
338
+ [[package]]
339
+ name = "confium-crypto-zk"
340
+ version = "0.3.0"
341
+ source = "registry+https://github.com/rust-lang/crates.io-index"
342
+ checksum = "f65c763c1e55aee550db1ba49ba0b97fbfd8373766e4ca48d9ca742897c82f34"
343
+ dependencies = [
344
+ "hex",
345
+ "hmac",
346
+ "num-bigint",
347
+ "num-traits",
348
+ "p256",
349
+ "rand_core",
350
+ "serde",
351
+ "serde_json",
352
+ "sha2",
353
+ "thiserror",
354
+ ]
355
+
313
356
  [[package]]
314
357
  name = "confium-deployment"
315
358
  version = "0.3.0"
@@ -329,6 +372,8 @@ dependencies = [
329
372
  [[package]]
330
373
  name = "confium-macros"
331
374
  version = "0.3.0"
375
+ source = "registry+https://github.com/rust-lang/crates.io-index"
376
+ checksum = "783f0dbfa6cd490f4670a5491254f4122d1f87604931724d99a2de37f0a73123"
332
377
  dependencies = [
333
378
  "proc-macro2",
334
379
  "quote",
@@ -338,6 +383,8 @@ dependencies = [
338
383
  [[package]]
339
384
  name = "confium-net"
340
385
  version = "0.3.0"
386
+ source = "registry+https://github.com/rust-lang/crates.io-index"
387
+ checksum = "98a17fd08f3f04772fa0227e0855d38d7de0637996fb44e058da098e069fab28"
341
388
  dependencies = [
342
389
  "confium-api",
343
390
  "inventory",
@@ -345,6 +392,21 @@ dependencies = [
345
392
  "url",
346
393
  ]
347
394
 
395
+ [[package]]
396
+ name = "confium-observability"
397
+ version = "0.3.0"
398
+ source = "registry+https://github.com/rust-lang/crates.io-index"
399
+ checksum = "767f898b6437a5cc67d403140bcf8cd1dbffa35a450afe28c64147e3175ee091"
400
+ dependencies = [
401
+ "chrono",
402
+ "hex",
403
+ "hmac",
404
+ "rand_core",
405
+ "serde",
406
+ "serde_json",
407
+ "sha2",
408
+ ]
409
+
348
410
  [[package]]
349
411
  name = "confium-pki"
350
412
  version = "0.3.1"
@@ -363,9 +425,31 @@ dependencies = [
363
425
  "x509-cert",
364
426
  ]
365
427
 
428
+ [[package]]
429
+ name = "confium-privacy"
430
+ version = "0.3.0"
431
+ source = "registry+https://github.com/rust-lang/crates.io-index"
432
+ checksum = "6dcbe8f16e42291a63bcc480745653aa1ad993982fb708531778270de9677dd9"
433
+ dependencies = [
434
+ "chrono",
435
+ "hex",
436
+ "hmac",
437
+ "num-bigint",
438
+ "num-traits",
439
+ "p256",
440
+ "rand",
441
+ "rand_core",
442
+ "serde",
443
+ "serde_json",
444
+ "sha2",
445
+ "thiserror",
446
+ ]
447
+
366
448
  [[package]]
367
449
  name = "confium-store"
368
450
  version = "0.3.0"
451
+ source = "registry+https://github.com/rust-lang/crates.io-index"
452
+ checksum = "66f760cf6182b532f7746b95842e2b4599ab78a5bbe35af2992df309417e5975"
369
453
  dependencies = [
370
454
  "confium-api",
371
455
  "inventory",
@@ -374,7 +458,9 @@ dependencies = [
374
458
 
375
459
  [[package]]
376
460
  name = "confium-tc"
377
- version = "0.3.0"
461
+ version = "0.3.1"
462
+ source = "registry+https://github.com/rust-lang/crates.io-index"
463
+ checksum = "3dd7d4965aef12324cb76d397294c317b83b774de029f1d37b387cf54ba9593c"
378
464
  dependencies = [
379
465
  "chrono",
380
466
  "confium-api",
@@ -405,7 +491,9 @@ dependencies = [
405
491
 
406
492
  [[package]]
407
493
  name = "confium-tc-cmp20"
408
- version = "0.3.0"
494
+ version = "0.3.1"
495
+ source = "registry+https://github.com/rust-lang/crates.io-index"
496
+ checksum = "7f28758121e44a86beefdf54a63428ab9bd9ec7a3797f7c065351b876518815c"
409
497
  dependencies = [
410
498
  "confium-tc",
411
499
  "confium-tc-core",
@@ -426,6 +514,8 @@ dependencies = [
426
514
  [[package]]
427
515
  name = "confium-tc-core"
428
516
  version = "0.3.0"
517
+ source = "registry+https://github.com/rust-lang/crates.io-index"
518
+ checksum = "add3e15337ce81944f78c9ce844d870a081cbe91506a85b9a5c4e4c0da983771"
429
519
  dependencies = [
430
520
  "chrono",
431
521
  "confium-api",
@@ -477,7 +567,9 @@ dependencies = [
477
567
 
478
568
  [[package]]
479
569
  name = "confium-tc-gg18"
480
- version = "0.3.0"
570
+ version = "0.3.1"
571
+ source = "registry+https://github.com/rust-lang/crates.io-index"
572
+ checksum = "f5e3522da6c2352ff26f1a0719781e8f392cdfb7c264c681c87d0f0207540384"
481
573
  dependencies = [
482
574
  "confium-tc",
483
575
  "confium-tc-core",
@@ -494,6 +586,8 @@ dependencies = [
494
586
  [[package]]
495
587
  name = "confium-tc-keys"
496
588
  version = "0.3.0"
589
+ source = "registry+https://github.com/rust-lang/crates.io-index"
590
+ checksum = "476fce2efcefa4d7a48cfe5accecd1bc3f39959b5ea719fdedac9cfcbfeeb710"
497
591
  dependencies = [
498
592
  "chrono",
499
593
  "confium-tc-core",
@@ -525,15 +619,21 @@ dependencies = [
525
619
 
526
620
  [[package]]
527
621
  name = "confium_native"
528
- version = "0.1.0"
622
+ version = "0.3.0"
529
623
  dependencies = [
530
624
  "chrono",
531
625
  "confium-attributes",
532
626
  "confium-composite",
533
627
  "confium-core",
628
+ "confium-crypto-vss",
629
+ "confium-crypto-zk",
534
630
  "confium-deployment",
631
+ "confium-observability",
535
632
  "confium-pki",
633
+ "confium-privacy",
634
+ "confium-tc",
536
635
  "confium-tc-cmp20",
636
+ "confium-tc-core",
537
637
  "confium-tc-elgamal-p256",
538
638
  "confium-tc-frost-p256",
539
639
  "confium-tc-gg18",
@@ -547,6 +647,7 @@ dependencies = [
547
647
  "rnp-rs",
548
648
  "serde_json",
549
649
  "sha2",
650
+ "subtle",
550
651
  ]
551
652
 
552
653
  [[package]]
data/Rakefile CHANGED
@@ -1,16 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
- RSpec::Core::RakeTask.new(:spec)
3
+ require 'rake/clean'
4
+ require 'bundler/gem_tasks'
6
5
 
7
- require "rubocop/rake_task"
8
- RuboCop::RakeTask.new
6
+ require 'rb_sys/extensiontask'
7
+ gemspec = Gem::Specification.load('confium.gemspec')
8
+ RbSys::ExtensionTask.new('confium_native', gemspec) do |ext|
9
+ ext.lib_dir = 'lib/confium_native'
10
+ end
11
+
12
+ # Tooling tasks are dev-only and are not needed to build the
13
+ # extension. Guard the requires so minimal environments (e.g. release
14
+ # tooling containers) can still load this Rakefile.
15
+ begin
16
+ require 'rspec/core/rake_task'
17
+ RSpec::Core::RakeTask.new(:spec)
18
+ rescue LoadError
19
+ nil
20
+ end
9
21
 
10
- require "rb_sys/extensiontask"
11
- gemspec = Gem::Specification.load("confium.gemspec")
12
- RbSys::ExtensionTask.new("confium_native", gemspec) do |ext|
13
- ext.lib_dir = "lib/confium_native"
22
+ begin
23
+ require 'rubocop/rake_task'
24
+ RuboCop::RakeTask.new
25
+ rescue LoadError
26
+ nil
14
27
  end
15
28
 
16
29
  task compile: :clean
data/confium.gemspec CHANGED
@@ -1,35 +1,35 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lib/confium/version"
3
+ require_relative 'lib/confium/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "confium"
6
+ spec.name = 'confium'
7
7
  spec.version = Confium::VERSION
8
8
  spec.platform = Gem::Platform::RUBY
9
9
 
10
- spec.authors = ["Ribose Open"]
11
- spec.email = ["open.source@ribose.com"]
10
+ spec.authors = ['Ribose Open']
11
+ spec.email = ['open.source@ribose.com']
12
12
 
13
- spec.summary = "Ruby bindings for the Confium multi-stakeholder threshold cryptography framework."
14
- spec.description = "Confium provides threshold cryptography for Ruby: FROST / CMP20 / GG18 " \
15
- "signing sessions, X.509 certificate issuance (CNML-ready), composite " \
16
- "PQ-migration signatures, and transparency-log anchoring. Powered by a " \
17
- "Rust native extension (magnus + rb_sys) — no separate C ABI to install."
18
- spec.homepage = "https://www.confium.org"
19
- spec.license = "BSD-2-Clause"
13
+ spec.summary = 'Ruby bindings for the Confium multi-stakeholder threshold cryptography framework.'
14
+ spec.description = 'Confium provides threshold cryptography for Ruby: FROST / CMP20 / GG18 ' \
15
+ 'signing sessions, X.509 certificate issuance (CNML-ready), composite ' \
16
+ 'PQ-migration signatures, and transparency-log anchoring. Powered by a ' \
17
+ 'Rust native extension (magnus + rb_sys) — no separate C ABI to install.'
18
+ spec.homepage = 'https://www.confium.org'
19
+ spec.license = 'BSD-2-Clause'
20
20
 
21
21
  spec.metadata = {
22
- "bug_tracker_uri" => "https://github.com/confium/confium-ruby/issues",
23
- "changelog_uri" => "https://github.com/confium/confium-ruby/blob/main/CHANGELOG.md",
24
- "homepage_uri" => spec.homepage,
25
- "source_code_uri" => "https://github.com/confium/confium-ruby",
26
- "rubygems_mfa_required" => "true",
22
+ 'bug_tracker_uri' => 'https://github.com/confium/confium-ruby/issues',
23
+ 'changelog_uri' => 'https://github.com/confium/confium-ruby/blob/main/CHANGELOG.md',
24
+ 'homepage_uri' => spec.homepage,
25
+ 'source_code_uri' => 'https://github.com/confium/confium-ruby',
26
+ 'rubygems_mfa_required' => 'true'
27
27
  }
28
28
 
29
29
  # Rust extension — compiled at gem install via rb_sys.
30
- spec.extensions = ["ext/confium_native/extconf.rb"]
30
+ spec.extensions = ['ext/confium_native/extconf.rb']
31
31
 
32
- spec.files = Dir.glob("{lib,ext}/**/*") + %w[
32
+ spec.files = Dir.glob('{lib,ext}/**/*') + %w[
33
33
  CHANGELOG.md
34
34
  LICENSE.txt
35
35
  Rakefile
@@ -40,17 +40,17 @@ 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
- spec.require_paths = ["lib"]
43
+ spec.require_paths = ['lib']
44
44
 
45
- spec.required_ruby_version = ">= 3.1.0"
45
+ spec.required_ruby_version = '>= 3.1.0'
46
46
 
47
47
  # Required for the Rust extension.
48
- spec.add_dependency "rb_sys", "~> 0.9.39"
49
-
50
- spec.add_development_dependency "rake", "~> 13.0"
51
- spec.add_development_dependency "rake-compiler", "~> 1.2.0"
52
- spec.add_development_dependency "rake-compiler-dock", "~> 1.3"
53
- spec.add_development_dependency "rspec", "~> 3.0"
54
- spec.add_development_dependency "rubocop", "~> 1.0"
55
- spec.add_development_dependency "steep", "~> 1.5"
48
+ spec.add_dependency 'rb_sys', '~> 0.9.39'
49
+
50
+ spec.add_development_dependency 'rake', '~> 13.0'
51
+ spec.add_development_dependency 'rake-compiler', '~> 1.3.0'
52
+ spec.add_development_dependency 'rake-compiler-dock', '~> 1.3'
53
+ spec.add_development_dependency 'rspec', '~> 3.0'
54
+ spec.add_development_dependency 'rubocop', '~> 1.0'
55
+ spec.add_development_dependency 'steep', '~> 1.5'
56
56
  end
@@ -50,6 +50,7 @@ ed25519-dalek = { version = "2", features = ["rand_core"] }
50
50
  rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
51
51
 
52
52
  sha2 = "0.10"
53
+ subtle = "2"
53
54
  chrono = "0.4"
54
55
  hex = "0.4"
55
56
  serde_json = "1"
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "mkmf"
4
- require "rb_sys/mkmf"
3
+ require 'mkmf'
4
+ require 'rb_sys/mkmf'
5
5
 
6
- create_rust_makefile("confium_native") do |r|
7
- r.profile = ENV.fetch("RB_SYS_CARGO_PROFILE", :dev).to_sym
6
+ create_rust_makefile('confium_native') do |r|
7
+ r.profile = ENV.fetch('RB_SYS_CARGO_PROFILE', :dev).to_sym
8
8
  r.use_stable_api_compiled_fallback = true
9
9
  r.force_install_rust_toolchain = false
10
10
  end
@@ -12,7 +12,7 @@
12
12
 
13
13
  use confium_attributes::{evaluate, parse as dsl_parse, Predicate, SignerAttributes};
14
14
  use magnus::{
15
- exception, function, method, prelude::*, typed_data::Obj, DataTypeFunctions, Error, Module,
15
+ exception, function, method, typed_data::Obj, DataTypeFunctions, Error, Module,
16
16
  Object, Ruby, TryConvert, TypedData, Value,
17
17
  };
18
18
 
@@ -11,7 +11,7 @@
11
11
  //! sink raises, the calling operation still succeeds. Audit
12
12
  //! failures must never break a signing ceremony.
13
13
 
14
- use magnus::{exception, function, prelude::*, Error, Module, Object, RHash, Ruby, Value};
14
+ use magnus::{exception, function, prelude::*, Error, Module, Ruby, Value};
15
15
  use sha2::{Digest, Sha256};
16
16
 
17
17
  const SINK_IVAR: &str = "@sink";
@@ -12,7 +12,7 @@
12
12
  //! with `#all_verified?` and `#per_component` accessors.
13
13
 
14
14
  use confium_composite::{CompositeSignature, ComponentSignature, VerificationResult};
15
- use ed25519_dalek::{Signer, SigningKey};
15
+ use ed25519_dalek::SigningKey;
16
16
  use magnus::{
17
17
  exception, function, method, prelude::*, scan_args,
18
18
  typed_data::Obj, DataTypeFunctions, Error, IntoValue,
@@ -12,7 +12,7 @@ use confium_deployment::{
12
12
  validate::validate_manifest,
13
13
  };
14
14
  use crate::util::enforce_size;
15
- use magnus::{exception, function, method, prelude::*, typed_data::Obj, DataTypeFunctions, Error, Module, Object, Ruby, TypedData};
15
+ use magnus::{exception, function, method, typed_data::Obj, DataTypeFunctions, Error, Module, Object, Ruby, TypedData};
16
16
 
17
17
  #[derive(TypedData, DataTypeFunctions)]
18
18
  #[magnus(class = "Confium::Identity::Actor", size)]
@@ -5,7 +5,7 @@ use confium_transparency::ers::{
5
5
  EvidenceRecord, HashAlgorithm,
6
6
  };
7
7
  use magnus::{
8
- exception, function, method, prelude::*, typed_data::Obj,
8
+ exception, function, method, typed_data::Obj,
9
9
  DataTypeFunctions, Error, Module, Object, Ruby, TryConvert, TypedData, Value,
10
10
  };
11
11
 
@@ -39,7 +39,7 @@ fn native_dearmor(ruby: &Ruby, data: Value) -> Result<magnus::RString, Error> {
39
39
  }
40
40
 
41
41
  /// Initialize the `Confium::OpenPGP` module.
42
- pub fn init(ruby: &Ruby, parent: RModule) -> Result<(), Error> {
42
+ pub fn init(_ruby: &Ruby, parent: RModule) -> Result<(), Error> {
43
43
  let openpgp = parent.define_module("OpenPGP")?;
44
44
 
45
45
  openpgp.define_singleton_method("_native_armor", function!(native_armor, 2))?;
@@ -10,7 +10,7 @@ use confium_pki::{
10
10
  path::{validate_path, CertPath},
11
11
  result::VerificationResult as PathVerificationResult,
12
12
  };
13
- use magnus::{exception, function, method, prelude::*, DataTypeFunctions, Error, Module, Object, Ruby, TypedData, Value};
13
+ use magnus::{exception, function, method, prelude::*, DataTypeFunctions, Error, Module, Ruby, TypedData, Value};
14
14
 
15
15
  /// Wraps a confium_pki::path::VerificationResult.
16
16
  #[derive(TypedData, DataTypeFunctions)]
@@ -205,7 +205,7 @@ impl SignedData {
205
205
  /// any standards-compliant CMS consumer.
206
206
  fn to_der(&self) -> Result<RString, Error> {
207
207
  let ruby = Ruby::get().map_err(|e| Error::new(exception::runtime_error(), e.to_string()))?;
208
- let der = encode_signed_data_der(&*self.inner.borrow())
208
+ let der = encode_signed_data_der(&self.inner.borrow())
209
209
  .map_err(|e| Error::new(exception::runtime_error(), e.to_string()))?;
210
210
  Ok(bytes_to_rstring(&ruby, &der))
211
211
  }
@@ -97,7 +97,7 @@ fn recover(shares_value: Value) -> Result<magnus::RString, Error> {
97
97
  let secret = recover_secret(&refs)
98
98
  .map_err(|e| Error::new(exception::runtime_error(), e.to_string()))?;
99
99
  let ruby = Ruby::get().map_err(|e| Error::new(exception::runtime_error(), e.to_string()))?;
100
- Ok(bytes_to_rstring(&ruby, &scalar_to_bytes(&secret).to_vec()))
100
+ Ok(bytes_to_rstring(&ruby, scalar_to_bytes(&secret).as_ref()))
101
101
  }
102
102
 
103
103
  fn keypair(ruby: &Ruby) -> Result<RHash, Error> {
@@ -105,7 +105,7 @@ fn keypair(ruby: &Ruby) -> Result<RHash, Error> {
105
105
  let result = ruby.hash_new();
106
106
  let signing_bytes = kp.to_signing_key().to_bytes();
107
107
  let verifying_bytes = kp.to_verifying_key().to_sec1_bytes();
108
- result.aset("private_key", bytes_to_rstring(ruby, &signing_bytes.to_vec()))?;
108
+ result.aset("private_key", bytes_to_rstring(ruby, &signing_bytes))?;
109
109
  result.aset("public_key", bytes_to_rstring(ruby, &verifying_bytes))?;
110
110
  Ok(result)
111
111
  }
@@ -11,7 +11,7 @@ use confium_transparency::{
11
11
  };
12
12
  use magnus::{
13
13
  exception, function, method, prelude::*, typed_data::Obj, DataTypeFunctions, Error, IntoValue,
14
- Module, Object, RHash, RString, Ruby, TryConvert, TypedData, Value,
14
+ Module, Object, RString, Ruby, TryConvert, TypedData, Value,
15
15
  };
16
16
 
17
17
  #[derive(TypedData, DataTypeFunctions)]
@@ -221,7 +221,8 @@ impl InclusionProofWrap {
221
221
  Side::Right => hash_internal(current, step.sibling),
222
222
  };
223
223
  }
224
- Ok(current == root)
224
+ use subtle::ConstantTimeEq;
225
+ Ok(current.ct_eq(&root).into())
225
226
  }
226
227
 
227
228
  /// External-auditor inclusion verification. Accepts an explicit
@@ -255,7 +256,8 @@ impl InclusionProofWrap {
255
256
  Side::Right => hash_internal(current, step.sibling),
256
257
  };
257
258
  }
258
- Ok(current == root)
259
+ use subtle::ConstantTimeEq;
260
+ Ok(current.ct_eq(&root).into())
259
261
  }
260
262
  }
261
263
 
@@ -134,6 +134,7 @@ pub fn new_details(ruby: &Ruby) -> RHash {
134
134
  // only the domain-specific fields; :operation and :component are
135
135
  // filled automatically.
136
136
 
137
+ #[allow(dead_code)]
137
138
  pub fn parse_error(msg: impl Into<String>, operation: &str, format: Option<&str>, offset: Option<usize>) -> Error {
138
139
  let ruby = match Ruby::get() {
139
140
  Ok(r) => r,
@@ -147,6 +148,7 @@ pub fn parse_error(msg: impl Into<String>, operation: &str, format: Option<&str>
147
148
  confium_error(msg, "ParseError", d)
148
149
  }
149
150
 
151
+ #[allow(dead_code)]
150
152
  pub fn validation_error(msg: impl Into<String>, operation: &str, param: &str, expected: &str, actual: &str) -> Error {
151
153
  let ruby = match Ruby::get() {
152
154
  Ok(r) => r,
@@ -160,6 +162,7 @@ pub fn validation_error(msg: impl Into<String>, operation: &str, param: &str, ex
160
162
  confium_error(msg, "ValidationError", d)
161
163
  }
162
164
 
165
+ #[allow(dead_code)]
163
166
  pub fn verification_error(msg: impl Into<String>, operation: &str, signer_index: Option<usize>, algorithm: Option<&str>) -> Error {
164
167
  let ruby = match Ruby::get() {
165
168
  Ok(r) => r,
@@ -172,6 +175,7 @@ pub fn verification_error(msg: impl Into<String>, operation: &str, signer_index:
172
175
  confium_error(msg, "VerificationError", d)
173
176
  }
174
177
 
178
+ #[allow(dead_code)]
175
179
  pub fn crypto_error(msg: impl Into<String>, operation: &str, primitive: &str) -> Error {
176
180
  let ruby = match Ruby::get() {
177
181
  Ok(r) => r,
@@ -183,6 +187,7 @@ pub fn crypto_error(msg: impl Into<String>, operation: &str, primitive: &str) ->
183
187
  confium_error(msg, "CryptoError", d)
184
188
  }
185
189
 
190
+ #[allow(dead_code)]
186
191
  pub fn threshold_error(msg: impl Into<String>, operation: &str, have: usize, need: usize) -> Error {
187
192
  let ruby = match Ruby::get() {
188
193
  Ok(r) => r,
data/lib/confium/audit.rb CHANGED
@@ -12,8 +12,8 @@
12
12
  # per record). Custom sinks can subclass {Sink} for HTTP / syslog /
13
13
  # Kafka backends.
14
14
 
15
- require "json"
16
- require "time"
15
+ require 'json'
16
+ require 'time'
17
17
 
18
18
  module Confium
19
19
  module Audit
@@ -81,8 +81,8 @@ module Confium
81
81
  end
82
82
 
83
83
  # Enumerable contract: yield each record in insertion order.
84
- def each(&block)
85
- @records.each(&block)
84
+ def each(&)
85
+ @records.each(&)
86
86
  end
87
87
  end
88
88
 
@@ -109,7 +109,7 @@ module Confium
109
109
 
110
110
  def initialize(path)
111
111
  @path = path
112
- @io = File.open(path, "a")
112
+ @io = File.open(path, 'a')
113
113
  @io.sync = true
114
114
  end
115
115
 
data/lib/confium/cfm.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
 
3
5
  module Confium
@@ -17,6 +19,5 @@ module Confium
17
19
  def load_plugin(name, path)
18
20
  Confium.call_ffi(:cfm_plugin_load, @ptr, name, path, nil, nil)
19
21
  end
20
-
21
22
  end
22
23
  end