nwc-ruby 0.3.0 → 0.3.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: 9b1fb35da37743ef772eac5368822e3656d24a8f1b081fa02174f52084ea0d03
4
- data.tar.gz: '086309565529631e6525c95a22736b86423969216bc12f7ea2e63c65c9cc713e'
3
+ metadata.gz: 1d4c011d51eac1622cceede610301765731ca586ffddea5a3e99cbeba7fdd28e
4
+ data.tar.gz: 68b349cd70ae9d423111a6d4b04c3c6bf088e100a6cad066c93504b0cd078ca0
5
5
  SHA512:
6
- metadata.gz: 54b83902f9b0f3a0cd3df5f453d07d90e31a72b18cb81c888b9635ea44c7d34f804b15a0c6d77ab5fca3bad85be99adb73cf91cc22fb76fed94da35300d63f37
7
- data.tar.gz: 1871b89d77fbac48fb8731ed8ae56c99a3555289313af614b2b1bf13704fca12a64c4233b92ac0fafcd469db1b0fb501b841eba202b21b528698f919eee06183
6
+ metadata.gz: da57ea11db970c08836488cd99a617b85ddff08242facb3c5f2d5984957507ab87597f5b6d9844134550f46b209c97e13163345b2c419b2968392c486848a637
7
+ data.tar.gz: fb90130f2bdd51bb5e650e2b772979ce5573dcd19363d5a8bcebb5f5df17baab29c51401faea95fb9eca64ec06e5335078d95a373556664b715813b61e77730c
data/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.1] — 2026-10-05
11
+
12
+ ### Fixed
13
+
14
+ - **Every request failed with json 3.x.** Outgoing frames were built with
15
+ `Protocol::WebSocket::TextMessage.generate`, which passes
16
+ `symbolize_names: true` to `JSON.generate`; json 3.x rejects that keyword
17
+ with `ArgumentError`. In 0.3.0 this surfaced as `NotSentError` on every
18
+ call ("failed before the request was written (ArgumentError: unknown
19
+ keyword: symbolize_names)"), and `RelayConnection` could not subscribe.
20
+ Frames are now serialized with `JSON.generate` directly.
21
+ - Specs no longer reference `Socket::ResolutionError`, which only exists on
22
+ Ruby 3.3+, so the suite passes on Ruby 3.2.
23
+
10
24
  ## [0.3.0] — 2026-10-05
11
25
 
12
26
  ### Changed
@@ -439,7 +439,8 @@ module NwcRuby
439
439
  end
440
440
 
441
441
  def write_frame(conn, message)
442
- conn.write(Protocol::WebSocket::TextMessage.generate(message))
442
+ # TextMessage.generate passes symbolize_names to JSON.generate, which json 3.x rejects.
443
+ conn.write(Protocol::WebSocket::TextMessage.new(JSON.generate(message)))
443
444
  conn.flush
444
445
  end
445
446
 
@@ -56,8 +56,7 @@ module NwcRuby
56
56
 
57
57
  # @param payload [String] base64 NIP-44 payload
58
58
  # @return [String] UTF-8 plaintext
59
- # rubocop:disable Metrics/AbcSize
60
- def decrypt(payload, privkey_hex, pubkey_hex)
59
+ def decrypt(payload, privkey_hex, pubkey_hex) # rubocop:disable Metrics/AbcSize
61
60
  raise EncryptionError, 'payload is nil or empty' if payload.nil? || payload.empty?
62
61
  raise EncryptionError, "payload starts with '#' (not encrypted)" if payload.start_with?('#')
63
62
 
@@ -87,7 +86,6 @@ module NwcRuby
87
86
  padded = chacha20(chacha_key, chacha_nonce, ciphertext)
88
87
  unpad(padded).force_encoding('UTF-8')
89
88
  end
90
- # rubocop:enable Metrics/AbcSize
91
89
 
92
90
  # --- Internals ------------------------------------------------------
93
91
 
@@ -122,7 +122,7 @@ module NwcRuby
122
122
  def send_message(message)
123
123
  raise NotSentError, 'not connected' unless @conn
124
124
 
125
- @conn.write(Protocol::WebSocket::TextMessage.generate(message))
125
+ @conn.write(Protocol::WebSocket::TextMessage.new(JSON.generate(message)))
126
126
  @conn.flush
127
127
  end
128
128
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NwcRuby
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nwc-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MegalithicBTC
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
224
  requirements: []
225
- rubygems_version: 3.6.9
225
+ rubygems_version: 3.6.8
226
226
  specification_version: 4
227
227
  summary: Ruby client for Nostr Wallet Connect (NIP-47) with safe long-running relay
228
228
  connections.