didit-sdk 2.20.0 → 2.20.1

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: 58596e10eb50e7a57f33c7024c52a0201b68090c2ce1724ed0a95d9bb43787ae
4
- data.tar.gz: 0655b223441a6aad276de0cf8d4d85fa966e20898024a808213363e9920b9124
3
+ metadata.gz: 386e86938a0165b91be256b1890eb68d82e94f766118555be4edc4c95b65e99c
4
+ data.tar.gz: c9ec401cabf274672f67416c706d0a9667740bea0ab2af3c10c27e60619ee0e4
5
5
  SHA512:
6
- metadata.gz: 730e39c0fff1151cda0e223a56a0a721fed943470c391f14d2be78fa906322196bfa1651ae740021d38aab3be75e693da50cb63587db437abc6a2fc35d04ee2e
7
- data.tar.gz: 20d98d5fdefcc2861614f80357a060f2be272a0e5b3d5b61186188f50aee83641c200c05ad78141349d310cf1894915691d66192e3ae4d57c9603032cc2b66d9
6
+ metadata.gz: 4e7824c2658bff991a5e735a8064f6e27c5554654fab55a20156c8aa6a7a7a46fee1954ccd95bbf64a4ba03e408dbfbbf8b4832f7dff367d1cd0e1a94020e474
7
+ data.tar.gz: 6565ed0d918c746a1fe369226a68c3174875d3d689c03c9c6f8b7c671b2f251b4c385682630de27cc2264bbe8ade2e711ec9c9749b3886a9d01852ea90b648d1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.20.1](https://github.com/didit-protocol/sdk-ruby/compare/v2.20.0...v2.20.1) (2026-11-14)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * refuse an idempotency key that is not printable ASCII before any request ([#81](https://github.com/didit-protocol/sdk-ruby/issues/81)) ([dd351a8](https://github.com/didit-protocol/sdk-ruby/commit/dd351a8e93803fcec2bf70c341291025296c0255))
9
+
3
10
  ## [2.20.0](https://github.com/didit-protocol/sdk-ruby/compare/v2.19.0...v2.20.0) (2026-11-14)
4
11
 
5
12
 
@@ -23,6 +23,7 @@ module Didit
23
23
  OPTION_KEYS = %i[timeout max_retries extra_headers extra_query extra_body idempotency_key].freeze
24
24
  IDEMPOTENCY_HEADER = "Idempotency-Key"
25
25
  IDEMPOTENCY_KEY_MAX = 255
26
+ PRINTABLE_ASCII = /\A(?:[!-~]|[!-~][ -~]*[!-~])\z/
26
27
  KEY_METHODS = %i[post put patch delete].freeze
27
28
  RETRYABLE_WITH_KEY = %i[post patch].freeze
28
29
  UNRESERVED = /[^A-Za-z0-9\-._~]/
@@ -50,12 +51,13 @@ module Didit
50
51
  }
51
52
  end
52
53
 
53
- # The key must be a String of 1 to 255 characters.
54
+ # The key must be a String of 1 to 255 printable ASCII characters (space to "~") that neither start nor
55
+ # end with a space: it travels as an HTTP header value that the server trims.
54
56
  def check_idempotency_key(value)
55
- unless value.is_a?(String) && value.length.between?(1, IDEMPOTENCY_KEY_MAX)
57
+ unless value.is_a?(String) && value.length.between?(1, IDEMPOTENCY_KEY_MAX) && value.match?(PRINTABLE_ASCII)
56
58
  shown = value.is_a?(String) ? "a String of #{value.length} characters" : value.inspect
57
- raise ConfigurationError, "idempotency_key must be a String of 1 to #{IDEMPOTENCY_KEY_MAX} characters, " \
58
- "got #{shown}."
59
+ raise ConfigurationError, "idempotency_key must be a String of 1 to #{IDEMPOTENCY_KEY_MAX} printable ASCII " \
60
+ "characters that neither start nor end with a space, got #{shown}."
59
61
  end
60
62
 
61
63
  value
data/lib/didit/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Didit
4
- VERSION = "2.20.0" # x-release-please-version
4
+ VERSION = "2.20.1" # x-release-please-version
5
5
  end
@@ -115,6 +115,7 @@ module Didit
115
115
  OPTION_KEYS: Array[Symbol]
116
116
  IDEMPOTENCY_HEADER: String
117
117
  IDEMPOTENCY_KEY_MAX: Integer
118
+ PRINTABLE_ASCII: Regexp
118
119
  KEY_METHODS: Array[Symbol]
119
120
  RETRYABLE_WITH_KEY: Array[Symbol]
120
121
  UNRESERVED: Regexp
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: didit-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.20.0
4
+ version: 2.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didit