confium 0.3.2-aarch64-linux → 0.3.3-aarch64-linux

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: 5b2525a7c6a928c0fbcd0c2f7980b8d01cbe74020e0a9c76d319d322d2b34e5b
4
- data.tar.gz: 0d5520062602c2c1dfaf9334dab5c20e4f87e589ba2ad23500f832f00bff72dd
3
+ metadata.gz: d16a3c494799da7098bf35d9b41575c45d613b363e2bc719cde272bbc35a31bc
4
+ data.tar.gz: 73c02647bdb969b56b7a82292296ae07fb885f5bd25e16b9969953a78261990a
5
5
  SHA512:
6
- metadata.gz: 03a903e22d5404a8d540dbbecff4b01b3395e585c5bf60d001e82d75415961905b84f23e9a86aed5b307325ccefa763284a70a7e3f12ae79b628e6fbc23ad1ba
7
- data.tar.gz: 6e81063b745a057328fe676056d67b36660ccc91ade8b04d608d23a239afa3a35db0088e6578fb0962b047d764d5e8d18c8d335b1d97774b38e78f827533ff11
6
+ metadata.gz: a86e1a7b59c81424b2bc6d966344c8338475f866eeaf80b5f038e8c1055b1ffa63440eaf5034e04ff268d380317c5cca3389520920db85c66e66467d88e98472
7
+ data.tar.gz: a5a3e2183fdd84e6c3c64746bc163731477409873ebf638e21005f7f6e13aa7a09f7bb24c03424681789e82dd32a2b03c31c2e2613c0ffe8da72182c557bbc88
data/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.3] — 2026-08-23
4
+
5
+ ### Added
6
+
7
+ - **Typed native errors everywhere**: PEM/DER, JSON, TOML, DSL, and
8
+ XML parse failures raise `Confium::ParseError`; out-of-range
9
+ sequence indexes raise `Confium::IndexError`; consistency-proof
10
+ failures raise `Confium::VerificationError` — each with a
11
+ structured `details` Hash (format, operation, index, ...).
12
+ Previously these surfaced as bare `RuntimeError`.
13
+
14
+ ### Added
15
+
16
+ - `Confium::Composite::Signature.components_to_json` /
17
+ `.from_json` — JSON transport for composite signatures with the
18
+ binary fields hex-encoded on the wire (fixes the Sinatra example's
19
+ happy path, which called a `from_json` that did not exist).
20
+ - Steep type checking in CI: the Steepfile never loaded before
21
+ (it used a `configure_code_diagnostics` API that does not exist in
22
+ steep 1.10). `sig/confium.rbs` now covers every pure-Ruby
23
+ subsystem — including the TC session machinery — and
24
+ `bundle exec steep check` is green and enforced. Only the FFI
25
+ layer is excluded (the ffi gem has no RBS signatures).
26
+
27
+ ### Fixed
28
+
29
+ - `Confium::PKI::CMS::SignedDataBuilder#build` raised KeyError on
30
+ the ECDSA-P256 path (`FrostP256.sign` returns `der`/`fixed`, not
31
+ `signature`); it now uses the DER form, which is what CMS carries.
32
+ - `Confium::PKI::CertificateBuilder`, `Confium::PKI::CNML`, and
33
+ `Confium::Transparency::OTS` were unreachable after
34
+ `require "confium"` (missing autoload wiring); the PKI namespace
35
+ file is now eager-required and registers them.
36
+ - All five `hello_*` quickstart examples, the Sinatra example's
37
+ happy path, and every page under `docs/` were rewritten against
38
+ the real APIs (see the docs audit), and CI now runs every example
39
+ on every push.
40
+
3
41
  ## [0.3.2] — 2026-08-22
4
42
 
5
43
  Native platform gems (linux x86_64/aarch64, macOS x86_64/arm64) ship
data/README.adoc CHANGED
@@ -10,7 +10,7 @@ Confium supports three deployment modes:
10
10
  * **Mode 2 — TC PKI replacement**: drop-in for existing PKI consumers (PKCS#11 server, OpenSSL 3.0 provider, JCE)
11
11
  * **Mode 3 — TC Certificate PKI**: institutional deployments with custom certificate formats (OIML CNML, BIPM, pharma, accreditation)
12
12
 
13
- This gem wraps the high-value Confium subsystems via a Rust native extension (built at `gem install` time with `rb_sys` + `magnus`). No separate C ABI library to install; everything is statically linked into the extension.
13
+ This gem wraps the high-value Confium subsystems via a Rust native extension. Pre-compiled platform gems are published for Linux and macOS, so `gem install` needs no Rust toolchain there; other platforms build from source at install time with `rb_sys` + `magnus`. No separate C ABI library to install; everything is statically linked into the extension.
14
14
 
15
15
  == Installation
16
16
 
@@ -18,7 +18,7 @@ Add to your Gemfile:
18
18
 
19
19
  [source,ruby]
20
20
  ----
21
- gem "confium", "~> 0.1"
21
+ gem "confium", "~> 0.3"
22
22
  ----
23
23
 
24
24
  Or install directly:
@@ -31,10 +31,18 @@ $ gem install confium
31
31
  === Prerequisites
32
32
 
33
33
  * Ruby ≥ 3.1
34
+ * Nothing else on the pre-compiled platforms: `x86_64-linux`,
35
+ `aarch64-linux`, `x86_64-darwin`, `arm64-darwin` (each gem carries
36
+ one extension per Ruby C-ABI window)
37
+
38
+ Source builds (other platforms, or installing from the repo) also
39
+ need:
40
+
34
41
  * Rust stable toolchain (`rustup default stable`)
35
42
  * C toolchain (clang/gcc/Xcode CLT)
36
43
 
37
- The gem compiles a Rust cdylib at install time and links it into Ruby as a native extension. There is no separate `libconfium` to install.
44
+ There is no separate `libconfium` to install — the extension
45
+ statically links everything.
38
46
 
39
47
  == Quick start
40
48
 
@@ -76,7 +84,7 @@ recovered = Confium::TC::FrostP256.recover_secret(shares.first(3).map { |s| { "x
76
84
  recovered == kp["private_key"] # => true
77
85
  ----
78
86
 
79
- == API surface (v0.1.0)
87
+ == API surface (v0.3)
80
88
 
81
89
  === `Confium::Transparency`
82
90
  - `MerkleTree.new` / `#append(artifact_hash)` / `#root` / `#length` / `#empty?` / `#inclusion_proof(seq)`
@@ -127,7 +135,7 @@ After checking out the repo:
127
135
  ----
128
136
  $ bundle install
129
137
  $ bundle exec rake compile # build the Rust extension
130
- $ bundle exec rspec # 75+ specs
138
+ $ bundle exec rspec # 226 specs
131
139
  ----
132
140
 
133
141
  == Architecture
data/confium.gemspec CHANGED
@@ -49,7 +49,6 @@ Gem::Specification.new do |spec|
49
49
 
50
50
  spec.add_development_dependency 'rake', '~> 13.0'
51
51
  spec.add_development_dependency 'rake-compiler', '~> 1.3.0'
52
- spec.add_development_dependency 'rake-compiler-dock', '~> 1.3'
53
52
  spec.add_development_dependency 'rspec', '~> 3.0'
54
53
  spec.add_development_dependency 'rubocop', '~> 1.0'
55
54
  spec.add_development_dependency 'steep', '~> 1.5'
data/lib/confium/audit.rb CHANGED
@@ -68,6 +68,7 @@ module Confium
68
68
  attr_reader :records
69
69
 
70
70
  def initialize
71
+ # @type ivar @records: Array[untyped]
71
72
  @records = []
72
73
  end
73
74
 
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module Confium
6
+ module Composite
7
+ # JSON transport for composite signatures. The native extension
8
+ # defines Signature with algorithms/component_count/verify over
9
+ # component Hashes (algorithm, public_key, signature) whose
10
+ # binary fields cannot ride JSON directly, so the wire format
11
+ # hex-encodes them:
12
+ #
13
+ # json = Confium::Composite::Signature.components_to_json(components)
14
+ # sig = Confium::Composite::Signature.from_json(json)
15
+ # sig.verify(message)
16
+ class Signature
17
+ BINARY_FIELDS = %w[public_key signature].freeze
18
+
19
+ def self.components_to_json(components)
20
+ JSON.generate(components.map do |component|
21
+ component.transform_values do |value|
22
+ value.encoding == Encoding::ASCII_8BIT ? value.unpack1('H*') : value
23
+ end
24
+ end)
25
+ end
26
+
27
+ # Accepts either a bare JSON array of component Hashes or a
28
+ # {"components": [...]} envelope, with public_key/signature
29
+ # hex-encoded on the wire. Takes a JSON string or an
30
+ # already-parsed Array/Hash.
31
+ def self.from_json(json)
32
+ data = json.is_a?(String) ? JSON.parse(json) : json
33
+ components = data.is_a?(Hash) ? data['components'] : data
34
+ unless components.is_a?(Array) && !components.empty?
35
+ raise ArgumentError, 'expected a non-empty "components" array'
36
+ end
37
+
38
+ new(components.map { |c| decode_binary_fields(c) })
39
+ end
40
+
41
+ def self.decode_binary_fields(component)
42
+ BINARY_FIELDS.each_with_object(component.dup) do |field, decoded|
43
+ value = component.fetch(field)
44
+ decoded[field] = [value].pack('H*') if value.is_a?(String)
45
+ end
46
+ end
47
+ private_class_method :decode_binary_fields
48
+ end
49
+ end
50
+ end
@@ -21,6 +21,7 @@
21
21
  # Confium::Crypto.lookup(:hash) # => Confium::Digest
22
22
  module Confium
23
23
  module Crypto
24
+ # @type ivar @interfaces: Hash[Symbol, untyped]
24
25
  @interfaces = {}
25
26
 
26
27
  class << self
@@ -33,6 +33,7 @@ module Confium
33
33
 
34
34
  def initialize
35
35
  @content = nil
36
+ # @type ivar @signers: Array[Hash[Symbol, untyped]]
36
37
  @signers = []
37
38
  end
38
39
 
@@ -81,7 +82,9 @@ module Confium
81
82
  result.fetch('signature')
82
83
  when :ecdsa_p256
83
84
  result = Confium::TC::FrostP256.sign(private_key, payload)
84
- result.fetch('signature')
85
+ # CMS carries ECDSA signatures DER-encoded (DSA-Sig-Value);
86
+ # FrostP256.sign returns { "der" => ..., "fixed" => ... }.
87
+ result.fetch('der')
85
88
  else
86
89
  raise ArgumentError, "unsupported algorithm: #{algorithm.inspect}"
87
90
  end
data/lib/confium/pki.rb CHANGED
@@ -9,5 +9,7 @@
9
9
  module Confium
10
10
  module PKI
11
11
  autoload :CMS, 'confium/pki/cms'
12
+ autoload :CertificateBuilder, 'confium/pki/certificate_builder'
13
+ autoload :CNML, 'confium/pki/cnml'
12
14
  end
13
15
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Confium::Transparency namespace file.
4
+ #
5
+ # The Transparency module itself is defined by the native Rust
6
+ # extension via magnus at require time. This file registers
7
+ # pure-Ruby autoloads for the Transparency submodules.
8
+ module Confium
9
+ module Transparency
10
+ autoload :OTS, 'confium/transparency/ots'
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Confium
4
- VERSION = '0.3.2'
4
+ VERSION = '0.3.3'
5
5
  end
data/lib/confium.rb CHANGED
@@ -18,8 +18,7 @@ begin
18
18
  # 3.1 and 3.2 get exact-minor builds while 3.3 covers 3.3+).
19
19
  # Source builds install the extension flat, without a version
20
20
  # directory.
21
- major, minor = RUBY_VERSION.split('.').first(2).map(&:to_i)
22
- window = major > 3 || minor >= 3 ? '3.3' : "#{major}.#{minor}"
21
+ window = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3') ? '3.3' : RUBY_VERSION[/\A\d+\.\d+/]
23
22
  begin
24
23
  require_relative "confium_native/#{window}/confium_native"
25
24
  rescue LoadError
@@ -56,9 +55,21 @@ module Confium
56
55
  autoload :PolicyViolationError, 'confium/errors/policy_violation_error'
57
56
  autoload :SecureBytes, 'confium/secure_bytes'
58
57
  autoload :Policy, 'confium/policy'
59
- autoload :PKI, 'confium/pki'
58
+ # PKI is native-defined, so an autoload would never fire; the
59
+ # namespace file is eager-required and registers the pure-Ruby
60
+ # submodules (CMS, CertificateBuilder, CNML) as autoloads.
61
+ require_relative 'confium/pki'
60
62
  end
61
63
 
64
+ # Eager-load the Composite Signature JSON companion. The native
65
+ # extension defines Confium::Composite; this file reopens the class
66
+ # to add from_json transport.
67
+ require_relative 'confium/composite'
68
+
69
+ # Eager-load the Transparency namespace for the OTS autoload (the
70
+ # module itself is native-defined).
71
+ require_relative 'confium/transparency'
72
+
62
73
  # Eager-load the Audit Ruby companion. The native extension registers
63
74
  # `Confium::Audit` as a Ruby module with the `record`/`sink=`/`sink`
64
75
  # methods; the companion file defines the Sink class hierarchy on top
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Open
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-22 00:00:00.000000000 Z
11
+ date: 2026-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.3.0
41
- - !ruby/object:Gem::Dependency
42
- name: rake-compiler-dock
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.3'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.3'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +100,7 @@ files:
114
100
  - lib/confium.rb
115
101
  - lib/confium/audit.rb
116
102
  - lib/confium/cfm.rb
103
+ - lib/confium/composite.rb
117
104
  - lib/confium/crypto.rb
118
105
  - lib/confium/digest.rb
119
106
  - lib/confium/errors.rb
@@ -142,6 +129,7 @@ files:
142
129
  - lib/confium/tc/session.rb
143
130
  - lib/confium/tc/session_stub.rb
144
131
  - lib/confium/tc/share_file.rb
132
+ - lib/confium/transparency.rb
145
133
  - lib/confium/transparency/ots.rb
146
134
  - lib/confium/version.rb
147
135
  - lib/confium_native/3.1/confium_native.so