io-endpoint 0.18.0 → 0.19.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: 01c66c778ce2edc823029e630d48e6240d7540fc277604e47341fba40a2a0377
4
- data.tar.gz: 4da0e58ab7270e0edde4442049dc6e6fc6a5b818798da77383c2e99ef6fa2cfe
3
+ metadata.gz: 7fd588de618301021d1fcc23188ab4f50ad2b4e4f4f36f996a36c8bfffe10028
4
+ data.tar.gz: 00375d72509321b8fcbb179dac71ff8a41469e7774048953618557b054556eda
5
5
  SHA512:
6
- metadata.gz: 2b1cf8108ad055f3e40ec41e4ee82d510c72d2ae17bd49bc895c4944ada35a9d1c45e97ea44aab6a7bc75d8bdc0f5c808009fe5012d843e6b591af1fdbef62e9
7
- data.tar.gz: 0e0eee1759843f2c045be325730706ee85c730603172b76c252955bb2121f3c962bb4a60fbf6617e67d7ebc50ba83b0b3e304ba7d9d2c468c0fa77dd35b0bc46
6
+ metadata.gz: 0fa3bd96abdb1b98fb191995867f5d325f98d760bd5d578c916c091ffc6ae0bc8294ee766410bd6b5a057840da37060aa5cad3471e82652bcc0912b9864b356d
7
+ data.tar.gz: 2166dc7b1b45a2c073b998997e16c8b5d64c9b4c42b4d930f20f58ae3005581721a5f7035e7b560f435ebdf752a657dbc73eeb9aa105ec6cf3729a1c4eefb4b6
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2023-2025, by Samuel Williams.
4
+ # Copyright, 2023-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "host_endpoint"
7
7
  require_relative "generic"
@@ -59,6 +59,37 @@ module IO::Endpoint
59
59
  # @attribute [Symbol | Nil] The peer verification policy.
60
60
  attr :verification
61
61
 
62
+ # Compare configurations by their certificate material and verification policy.
63
+ # @parameter other [Object] The object to compare.
64
+ # @returns [Boolean] Whether both configurations have the same class and values.
65
+ def ==(other)
66
+ return other.instance_of?(self.class) &&
67
+ @trust_store.eql?(other.trust_store) &&
68
+ @certificate_chain.eql?(other.certificate_chain) &&
69
+ @private_key.eql?(other.private_key) &&
70
+ @verification.eql?(other.verification)
71
+ end
72
+
73
+ alias eql? ==
74
+
75
+ # Compute a hash from the configuration values. Freeze the configuration before using it as a hash key.
76
+ # @returns [Integer] The hash of the configuration.
77
+ def hash
78
+ return [self.class, @trust_store, @certificate_chain, @private_key, @verification].hash
79
+ end
80
+
81
+ # Freeze the configuration and independent copies of its certificate material, without freezing caller-owned values.
82
+ # @returns [Configuration] This immutable configuration. Use `dup.freeze` to preserve the original configuration too.
83
+ def freeze
84
+ return self if frozen?
85
+
86
+ @trust_store = @trust_store&.dup&.freeze
87
+ @certificate_chain = @certificate_chain&.map{|certificate| certificate.dup.freeze}&.freeze
88
+ @private_key = @private_key&.dup&.freeze
89
+
90
+ super
91
+ end
92
+
62
93
  # Whether peer certificates should be verified.
63
94
  # @returns [Boolean] Whether peer verification is enabled.
64
95
  def verify_peer?
@@ -55,6 +55,33 @@ module IO::Endpoint
55
55
  @system_certificates
56
56
  end
57
57
 
58
+ # Compare trust stores by their ordered certificates and system certificate policy.
59
+ # @parameter other [Object] The object to compare.
60
+ # @returns [Boolean] Whether both trust stores have the same class and values.
61
+ def ==(other)
62
+ return other.instance_of?(self.class) &&
63
+ @certificates.eql?(other.certificates) &&
64
+ @system_certificates.eql?(other.system_certificates?)
65
+ end
66
+
67
+ alias eql? ==
68
+
69
+ # Compute a hash from the trust store values. Freeze the trust store before using it as a hash key.
70
+ # @returns [Integer] The hash of the trust store.
71
+ def hash
72
+ return [self.class, @certificates, @system_certificates].hash
73
+ end
74
+
75
+ # Freeze the trust store and independent copies of its certificates, without freezing caller-owned values.
76
+ # @returns [TrustStore] This immutable trust store. Use `dup.freeze` to preserve the original trust store too.
77
+ def freeze
78
+ return self if frozen?
79
+
80
+ @certificates = @certificates.map{|certificate| certificate.dup.freeze}.freeze
81
+
82
+ super
83
+ end
84
+
58
85
  # Get a representation of the trust store without exposing certificate material.
59
86
  # @returns [String] A redacted representation of the trust store.
60
87
  def inspect
@@ -7,6 +7,6 @@
7
7
  class IO
8
8
  # @namespace
9
9
  module Endpoint
10
- VERSION = "0.18.0"
10
+ VERSION = "0.19.0"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -16,6 +16,10 @@ Please see the [project documentation](https://socketry.github.io/io-endpoint) f
16
16
 
17
17
  Please see the [project releases](https://socketry.github.io/io-endpointreleases/index) for all releases.
18
18
 
19
+ ### v0.19.0
20
+
21
+ - Compare TLS configurations and trust stores by value, allowing equivalent configurations to share cache entries. Freezing them creates immutable certificate data without freezing caller-owned values.
22
+
19
23
  ### v0.18.0
20
24
 
21
25
  - The `openssl` gem 3.3.0 or newer is now required.
@@ -56,10 +60,6 @@ Please see the [project releases](https://socketry.github.io/io-endpointreleases
56
60
 
57
61
  - Uniform `#to_s` and `#inspect` implementations across all endpoints.
58
62
 
59
- ### v0.13.1
60
-
61
- - Fixed state leak between iterations of the accept loop.
62
-
63
63
  ## See Also
64
64
 
65
65
  - [async-io](https://github.com/socketry/async-io) — Where this implementation originally came from.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.19.0
4
+
5
+ - Compare TLS configurations and trust stores by value, allowing equivalent configurations to share cache entries. Freezing them creates immutable certificate data without freezing caller-owned values.
6
+
3
7
  ## v0.18.0
4
8
 
5
9
  - The `openssl` gem 3.3.0 or newer is now required.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: io-endpoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 4.0.10
106
+ rubygems_version: 4.0.16
107
107
  specification_version: 4
108
108
  summary: Provides a separation of concerns interface for IO endpoints.
109
109
  test_files: []
metadata.gz.sig CHANGED
Binary file