nostr 0.5.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.adr-dir +1 -0
  3. data/.rubocop.yml +3 -1
  4. data/.rubocop_todo.yml +1 -1
  5. data/.tool-versions +2 -2
  6. data/CHANGELOG.md +63 -1
  7. data/README.md +6 -2
  8. data/adr/0001-record-architecture-decisions.md +19 -0
  9. data/adr/0002-introduction-of-signature-class.md +27 -0
  10. data/adr/0003-logging-methods-vs-logger-class.md +122 -0
  11. data/adr/0004-default-logging-activation.md +66 -0
  12. data/adr/0005-logger-types.md +32 -0
  13. data/docs/.vitepress/config.mjs +3 -0
  14. data/docs/bun.lockb +0 -0
  15. data/docs/common-use-cases/logging-and-debugging.md +60 -0
  16. data/docs/common-use-cases/signing-and-verifying-events.md +50 -0
  17. data/docs/common-use-cases/signing-and-verifying-messages.md +43 -0
  18. data/docs/core/client.md +1 -1
  19. data/docs/getting-started/overview.md +5 -1
  20. data/docs/index.md +0 -2
  21. data/docs/package.json +3 -3
  22. data/lib/nostr/client/color_logger.rb +69 -0
  23. data/lib/nostr/client/logger.rb +85 -0
  24. data/lib/nostr/client/plain_logger.rb +69 -0
  25. data/lib/nostr/client.rb +32 -6
  26. data/lib/nostr/crypto.rb +82 -6
  27. data/lib/nostr/errors/invalid_key_format_error.rb +1 -1
  28. data/lib/nostr/errors/invalid_key_length_error.rb +1 -1
  29. data/lib/nostr/errors/invalid_key_type_error.rb +1 -1
  30. data/lib/nostr/errors/invalid_signature_format_error.rb +18 -0
  31. data/lib/nostr/errors/invalid_signature_length_error.rb +18 -0
  32. data/lib/nostr/errors/invalid_signature_type_error.rb +16 -0
  33. data/lib/nostr/errors/signature_validation_error.rb +6 -0
  34. data/lib/nostr/errors.rb +4 -0
  35. data/lib/nostr/event.rb +36 -9
  36. data/lib/nostr/event_kind.rb +1 -0
  37. data/lib/nostr/events/encrypted_direct_message.rb +4 -4
  38. data/lib/nostr/filter.rb +10 -7
  39. data/lib/nostr/key.rb +2 -2
  40. data/lib/nostr/key_pair.rb +26 -2
  41. data/lib/nostr/keygen.rb +1 -1
  42. data/lib/nostr/signature.rb +67 -0
  43. data/lib/nostr/version.rb +1 -1
  44. data/lib/nostr.rb +3 -0
  45. data/nostr.gemspec +10 -10
  46. data/sig/nostr/client/color_logger.rbs +6 -0
  47. data/sig/nostr/client/logger.rbs +12 -0
  48. data/sig/nostr/client/plain_logger.rbs +6 -0
  49. data/sig/nostr/client.rbs +2 -0
  50. data/sig/nostr/crypto.rbs +3 -0
  51. data/sig/nostr/errors/invalid_signature_format_error.rbs +5 -0
  52. data/sig/nostr/errors/invalid_signature_length_error.rbs +5 -0
  53. data/sig/nostr/errors/invalid_signature_type_error.rbs +5 -0
  54. data/sig/nostr/errors/signature_validation_error.rbs +4 -0
  55. data/sig/nostr/event.rbs +7 -6
  56. data/sig/nostr/key_pair.rbs +1 -0
  57. data/sig/nostr/signature.rbs +14 -0
  58. data/sig/vendor/event_emitter.rbs +8 -10
  59. data/sig/vendor/schnorr/signature.rbs +16 -0
  60. data/sig/vendor/schnorr.rbs +3 -1
  61. metadata +48 -22
@@ -38,8 +38,8 @@ module Nostr
38
38
  # @param private_key [PrivateKey] 32-bytes hex-encoded private key.
39
39
  # @param public_key [PublicKey] 32-bytes hex-encoded public key.
40
40
  #
41
- # @raise ArgumentError when the private key is not a +PrivateKey+
42
- # @raise ArgumentError when the public key is not a +PublicKey+
41
+ # @raise ArgumentError when the private key is not a {PrivateKey}
42
+ # @raise ArgumentError when the public key is not a {PublicKey}
43
43
  #
44
44
  def initialize(private_key:, public_key:)
45
45
  validate_keys(private_key, public_key)
@@ -48,6 +48,30 @@ module Nostr
48
48
  @public_key = public_key
49
49
  end
50
50
 
51
+ # Allows array destructuring of the KeyPair, enabling the extraction of +PrivateKey+ and +PublicKey+ separately
52
+ #
53
+ # @api public
54
+ #
55
+ # @example Implicit usage of `to_ary` for destructuring
56
+ # keypair = Nostr::KeyPair.new(
57
+ # private_key: Nostr::PrivateKey.new('7d1e4219a5e7d8342654c675085bfbdee143f0eb0f0921f5541ef1705a2b407d'),
58
+ # public_key: Nostr::PublicKey.new('15678d8fbc126fa326fac536acd5a6dcb5ef64b3d939abe31d6830cba6cd26d6'),
59
+ # )
60
+ # # The `to_ary` method can be implicitly used for array destructuring:
61
+ # private_key, public_key = keypair
62
+ # # Now `private_key` and `public_key` hold the respective values.
63
+ #
64
+ # @example Explicit usage of `to_ary`
65
+ # array_representation = keypair.to_ary
66
+ # # array_representation is now an array: [PrivateKey, PublicKey]
67
+ # # where PrivateKey and PublicKey are the respective objects.
68
+ #
69
+ # @return [Array<PrivateKey, PublicKey>] An array containing the {PrivateKey} and {PublicKey} in that order
70
+ #
71
+ def to_ary
72
+ [private_key, public_key]
73
+ end
74
+
51
75
  private
52
76
 
53
77
  # Validates the keys
data/lib/nostr/keygen.rb CHANGED
@@ -22,7 +22,7 @@ module Nostr
22
22
  # @api public
23
23
  #
24
24
  # @example
25
- # keypair = keygen.generate_keypair
25
+ # keypair = keygen.generate_key_pair
26
26
  # keypair # #<Nostr::KeyPair:0x0000000107bd3550
27
27
  # @private_key="893c4cc8088924796b41dc788f7e2f746734497010b1a9f005c1faad7074b900",
28
28
  # @public_key="2d7661527d573cc8e84f665fa971dd969ba51e2526df00c149ff8e40a58f9558">
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nostr
4
+ # 64-bytes lowercase hex of the signature of the sha256 hash of the serialized event data,
5
+ # which is the same as the "id" field
6
+ class Signature < String
7
+ # The regular expression for hexadecimal lowercase characters
8
+ #
9
+ # @return [Regexp] The regular expression for hexadecimal lowercase characters
10
+ #
11
+ FORMAT = /^[a-f0-9]+$/
12
+
13
+ # The length of the signature in hex format
14
+ #
15
+ # @return [Integer] The length of the signature in hex format
16
+ #
17
+ LENGTH = 128
18
+
19
+ # Instantiates a new Signature
20
+ #
21
+ # @api public
22
+ #
23
+ # @example Instantiating a new signature
24
+ # Nostr::Signature.new(
25
+ # 'f418c97b50cc68227e82f4f3a79d79eb2b7a0fa517859c86e1a8fa91e3741b7f' \
26
+ # '06e070c44129227b83fcbe93cecb02a346804a4080ce47685ecad60ab4f5f128'
27
+ # )
28
+ #
29
+ # @param [String] hex_value Hex-encoded value of the signature
30
+ #
31
+ # @raise [SignatureValidationError]
32
+ #
33
+ def initialize(hex_value)
34
+ validate(hex_value)
35
+
36
+ super(hex_value)
37
+ end
38
+
39
+ private
40
+
41
+ # Hex-encoded value of the signature
42
+ #
43
+ # @api private
44
+ #
45
+ # @return [String] hex_value Hex-encoded value of the signature
46
+ #
47
+ attr_reader :hex_value
48
+
49
+ # Validates the hex value of the signature
50
+ #
51
+ # @api private
52
+ #
53
+ # @param [String] hex_value The signature in hex format
54
+ #
55
+ # @raise InvalidSignatureTypeError when the signature is not a string
56
+ # @raise InvalidSignatureLengthError when the signature's length is not 128 characters
57
+ # @raise InvalidSignatureFormatError when the signature is in an invalid format
58
+ #
59
+ # @return [void]
60
+ #
61
+ def validate(hex_value)
62
+ raise InvalidSignatureTypeError unless hex_value.is_a?(String)
63
+ raise InvalidSignatureLengthError unless hex_value.size == LENGTH
64
+ raise InvalidSignatureFormatError unless hex_value.match(FORMAT)
65
+ end
66
+ end
67
+ end
data/lib/nostr/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nostr
4
4
  # The version of the gem
5
- VERSION = '0.5.0'
5
+ VERSION = '0.7.0'
6
6
  end
data/lib/nostr.rb CHANGED
@@ -12,9 +12,12 @@ require_relative 'nostr/relay'
12
12
  require_relative 'nostr/relay_message_type'
13
13
  require_relative 'nostr/key_pair'
14
14
  require_relative 'nostr/event_kind'
15
+ require_relative 'nostr/signature'
15
16
  require_relative 'nostr/event'
16
17
  require_relative 'nostr/events/encrypted_direct_message'
17
18
  require_relative 'nostr/client'
19
+ require_relative 'nostr/client/logger'
20
+ require_relative 'nostr/client/color_logger'
18
21
  require_relative 'nostr/user'
19
22
  require_relative 'nostr/key'
20
23
  require_relative 'nostr/private_key'
data/nostr.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'Client and relay implementation of the Nostr protocol.'
13
13
  spec.homepage = 'https://nostr-ruby.com/'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = '>= 3.2.0'
15
+ spec.required_ruby_version = '>= 3.3.0'
16
16
  spec.metadata['rubygems_mfa_required'] = 'true'
17
17
 
18
18
  spec.metadata['homepage_uri'] = spec.homepage
@@ -32,32 +32,32 @@ Gem::Specification.new do |spec|
32
32
  spec.require_paths = ['lib']
33
33
 
34
34
  spec.add_dependency 'bech32', '~> 1.4'
35
- spec.add_dependency 'bip-schnorr', '~> 0.6'
35
+ spec.add_dependency 'bip-schnorr', '~> 0.7'
36
36
  spec.add_dependency 'ecdsa', '~> 1.2'
37
37
  spec.add_dependency 'event_emitter', '~> 0.2'
38
38
  spec.add_dependency 'faye-websocket', '~> 0.11'
39
- spec.add_dependency 'json', '~> 2.6'
39
+ spec.add_dependency 'json', '~> 2.7'
40
40
 
41
41
  spec.add_development_dependency 'bundler-audit', '~> 0.9'
42
- spec.add_development_dependency 'dotenv', '~> 2.8'
42
+ spec.add_development_dependency 'dotenv', '~> 3.1'
43
43
  spec.add_development_dependency 'guard', '~> 2.18'
44
44
  spec.add_development_dependency 'guard-bundler', '~> 3.0'
45
45
  spec.add_development_dependency 'guard-bundler-audit', '~> 0.1'
46
46
  spec.add_development_dependency 'guard-rspec', '~> 4.7'
47
47
  spec.add_development_dependency 'guard-rubocop', '~> 1.5'
48
- spec.add_development_dependency 'overcommit', '~> 0.59'
48
+ spec.add_development_dependency 'overcommit', '~> 0.63'
49
49
  spec.add_development_dependency 'pry', '~> 0.14'
50
50
  spec.add_development_dependency 'puma', '~> 6.4'
51
51
  spec.add_development_dependency 'rack', '~> 3.0'
52
52
  spec.add_development_dependency 'rake', '~> 13.1'
53
- spec.add_development_dependency 'rbs', '~> 3.3'
54
- spec.add_development_dependency 'rspec', '~> 3.12'
55
- spec.add_development_dependency 'rubocop', '~> 1.57'
53
+ spec.add_development_dependency 'rbs', '~> 3.4'
54
+ spec.add_development_dependency 'rspec', '~> 3.13'
55
+ spec.add_development_dependency 'rubocop', '~> 1.62'
56
56
  spec.add_development_dependency 'rubocop-rake', '~> 0.6'
57
- spec.add_development_dependency 'rubocop-rspec', '2.25'
57
+ spec.add_development_dependency 'rubocop-rspec', '2.29'
58
58
  spec.add_development_dependency 'simplecov', '= 0.17'
59
59
  spec.add_development_dependency 'simplecov-console', '~> 0.9'
60
- spec.add_development_dependency 'steep', '~> 1.6'
60
+ spec.add_development_dependency 'steep', '~> 1.7.dev3'
61
61
  spec.add_development_dependency 'typeprof', '~> 0.21'
62
62
  spec.add_development_dependency 'yard', '~> 0.9'
63
63
  spec.add_development_dependency 'yard-junk', '~> 0.0.9'
@@ -0,0 +1,6 @@
1
+ module Nostr
2
+ class Client
3
+ class ColorLogger < Logger
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,12 @@
1
+ module Nostr
2
+ class Client
3
+ class Logger
4
+ def attach_to: (Client client) -> void
5
+ def on_connect: (Relay relay) -> void
6
+ def on_message: (String message) -> void
7
+ def on_send: (String message) -> void
8
+ def on_error: (String message) -> void
9
+ def on_close: (String code, String reason) -> void
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ module Nostr
2
+ class Client
3
+ class PlainLogger < Logger
4
+ end
5
+ end
6
+ end
data/sig/nostr/client.rbs CHANGED
@@ -10,11 +10,13 @@ module Nostr
10
10
 
11
11
  private
12
12
 
13
+ attr_reader logger: Logger
13
14
  attr_reader subscriptions: Hash[String, Subscription]
14
15
  attr_reader parent_to_child_channel: EventMachine::Channel
15
16
  attr_reader child_to_parent_channel: EventMachine::Channel
16
17
 
17
18
  def execute_within_an_em_thread: { -> void } -> Thread
18
19
  def initialize_channels: -> void
20
+ def build_websocket_client: (String relay_name) -> Faye::WebSocket::Client
19
21
  end
20
22
  end
data/sig/nostr/crypto.rbs CHANGED
@@ -7,6 +7,9 @@ module Nostr
7
7
  def encrypt_text: (PrivateKey, PublicKey, String) -> String
8
8
  def decrypt_text: (PrivateKey, PublicKey, String) -> String
9
9
  def sign_event: (Event, PrivateKey) -> Event
10
+ def sign_message: (String, PrivateKey) -> Signature
11
+ def valid_sig?: (String, PublicKey, Signature) -> bool
12
+ def check_sig!: (String, PublicKey, Signature) -> bool
10
13
 
11
14
  private
12
15
 
@@ -0,0 +1,5 @@
1
+ module Nostr
2
+ class InvalidSignatureFormatError < SignatureValidationError
3
+ def initialize: -> void
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Nostr
2
+ class InvalidSignatureLengthError < SignatureValidationError
3
+ def initialize: -> void
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Nostr
2
+ class InvalidSignatureTypeError < SignatureValidationError
3
+ def initialize: -> void
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module Nostr
2
+ class SignatureValidationError < Error
3
+ end
4
+ end
data/sig/nostr/event.rbs CHANGED
@@ -5,8 +5,8 @@ module Nostr
5
5
  attr_reader kind: Integer
6
6
  attr_reader tags: Array[Array[String]]
7
7
  attr_reader content: String
8
- attr_accessor id: String?|nil
9
- attr_accessor sig: String?|nil
8
+ attr_accessor id: String?
9
+ attr_accessor sig: Signature?
10
10
 
11
11
  def initialize: (
12
12
  pubkey: PublicKey,
@@ -14,24 +14,25 @@ module Nostr
14
14
  content: String,
15
15
  ?created_at: Integer,
16
16
  ?tags: Array[Array[String]],
17
- ?id: String|nil,
18
- ?sig: String|nil
17
+ ?id: String?,
18
+ ?sig: Signature?
19
19
  ) -> void
20
20
 
21
21
  def serialize: -> [Integer, String, Integer, Integer, Array[Array[String]], String]
22
22
 
23
23
  def to_h: -> {
24
- id: String?|nil,
24
+ id: String?,
25
25
  pubkey: String,
26
26
  created_at: Integer,
27
27
  kind: Integer,
28
28
  tags: Array[Array[String]],
29
29
  content: String,
30
- sig: String?|nil
30
+ sig: String?
31
31
  }
32
32
  def ==: (Event other) -> bool
33
33
 
34
34
  def sign:(PrivateKey) -> Event
35
+ def verify_signature: -> bool
35
36
 
36
37
  def add_event_reference: (String) -> Array[Array[String]]
37
38
  def add_pubkey_reference: (PublicKey) -> Array[Array[String]]
@@ -5,6 +5,7 @@ module Nostr
5
5
  attr_reader public_key: PublicKey
6
6
 
7
7
  def initialize: (private_key: PrivateKey, public_key: PublicKey) -> void
8
+ def to_ary: -> [PrivateKey, PublicKey]
8
9
 
9
10
  private
10
11
 
@@ -0,0 +1,14 @@
1
+ module Nostr
2
+ class Signature < String
3
+ FORMAT: Regexp
4
+ LENGTH: int
5
+
6
+ def initialize: (String) -> void
7
+
8
+ private
9
+
10
+ attr_reader hex_value: String
11
+
12
+ def validate: (String) -> nil
13
+ end
14
+ end
@@ -1,16 +1,14 @@
1
1
  # Added only to satisfy the Steep requirements. Not 100% reliable.
2
2
  module EventEmitter
3
- interface _Event
4
- def data: -> String
5
- def message: -> String
6
- def code: -> Integer
7
- def reason: -> String
8
- end
3
+ def self.included: (Module) -> void
4
+ def self.apply: (untyped) -> void
9
5
 
10
- def add_listener: (Symbol event_name) { (_Event event) -> void } -> void
6
+ def __events: () -> Array[untyped]
7
+
8
+ def add_listener: (Symbol | String type, ?Hash[untyped, untyped] params) { (*untyped) -> void } -> Integer
11
9
  alias on add_listener
10
+ alias once add_listener
12
11
 
13
- def remove_listener: (untyped id_or_type) -> Array[untyped]?
14
- def emit: (Symbol `type`, *untyped data) -> Array[untyped]
15
- def once: (Symbol `type`) -> Integer
12
+ def remove_listener: (Integer | Symbol | String id_or_type) -> void
13
+ def emit: (Symbol | String type, *untyped data) -> void
16
14
  end
@@ -0,0 +1,16 @@
1
+ # Added only to satisfy the Steep requirements. Not 100% reliable.
2
+ module Schnorr
3
+ class InvalidSignatureError < StandardError
4
+ end
5
+
6
+ class Signature
7
+ attr_reader r: Integer
8
+ attr_reader s: Integer
9
+
10
+ def self.decode: (String string) -> Signature
11
+
12
+ def initialize: (Integer r, Integer s) -> void
13
+ def encode: -> String
14
+ def ==: (untyped other) -> bool
15
+ end
16
+ end
@@ -1,4 +1,6 @@
1
1
  # Added only to satisfy the Steep requirements. Not 100% reliable.
2
2
  module Schnorr
3
- def self.sign: (String message, String private_key, ?String aux_rand) -> untyped
3
+ def self.sign: (String message, String private_key, ?String aux_rand) -> Signature
4
+ def self.valid_sig?: (String message, String public_key, String signature) -> bool
5
+ def self.check_sig!: (String message, String public_key, String signature) -> bool
4
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nostr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wilson Silva
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-20 00:00:00.000000000 Z
11
+ date: 2024-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bech32
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.6'
33
+ version: '0.7'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.6'
40
+ version: '0.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ecdsa
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.6'
89
+ version: '2.7'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '2.6'
96
+ version: '2.7'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: bundler-audit
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.8'
117
+ version: '3.1'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '2.8'
124
+ version: '3.1'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: guard
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -198,14 +198,14 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0.59'
201
+ version: '0.63'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0.59'
208
+ version: '0.63'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: pry
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -268,42 +268,42 @@ dependencies:
268
268
  requirements:
269
269
  - - "~>"
270
270
  - !ruby/object:Gem::Version
271
- version: '3.3'
271
+ version: '3.4'
272
272
  type: :development
273
273
  prerelease: false
274
274
  version_requirements: !ruby/object:Gem::Requirement
275
275
  requirements:
276
276
  - - "~>"
277
277
  - !ruby/object:Gem::Version
278
- version: '3.3'
278
+ version: '3.4'
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: rspec
281
281
  requirement: !ruby/object:Gem::Requirement
282
282
  requirements:
283
283
  - - "~>"
284
284
  - !ruby/object:Gem::Version
285
- version: '3.12'
285
+ version: '3.13'
286
286
  type: :development
287
287
  prerelease: false
288
288
  version_requirements: !ruby/object:Gem::Requirement
289
289
  requirements:
290
290
  - - "~>"
291
291
  - !ruby/object:Gem::Version
292
- version: '3.12'
292
+ version: '3.13'
293
293
  - !ruby/object:Gem::Dependency
294
294
  name: rubocop
295
295
  requirement: !ruby/object:Gem::Requirement
296
296
  requirements:
297
297
  - - "~>"
298
298
  - !ruby/object:Gem::Version
299
- version: '1.57'
299
+ version: '1.62'
300
300
  type: :development
301
301
  prerelease: false
302
302
  version_requirements: !ruby/object:Gem::Requirement
303
303
  requirements:
304
304
  - - "~>"
305
305
  - !ruby/object:Gem::Version
306
- version: '1.57'
306
+ version: '1.62'
307
307
  - !ruby/object:Gem::Dependency
308
308
  name: rubocop-rake
309
309
  requirement: !ruby/object:Gem::Requirement
@@ -324,14 +324,14 @@ dependencies:
324
324
  requirements:
325
325
  - - '='
326
326
  - !ruby/object:Gem::Version
327
- version: '2.25'
327
+ version: '2.29'
328
328
  type: :development
329
329
  prerelease: false
330
330
  version_requirements: !ruby/object:Gem::Requirement
331
331
  requirements:
332
332
  - - '='
333
333
  - !ruby/object:Gem::Version
334
- version: '2.25'
334
+ version: '2.29'
335
335
  - !ruby/object:Gem::Dependency
336
336
  name: simplecov
337
337
  requirement: !ruby/object:Gem::Requirement
@@ -366,14 +366,14 @@ dependencies:
366
366
  requirements:
367
367
  - - "~>"
368
368
  - !ruby/object:Gem::Version
369
- version: '1.6'
369
+ version: 1.7.dev3
370
370
  type: :development
371
371
  prerelease: false
372
372
  version_requirements: !ruby/object:Gem::Requirement
373
373
  requirements:
374
374
  - - "~>"
375
375
  - !ruby/object:Gem::Version
376
- version: '1.6'
376
+ version: 1.7.dev3
377
377
  - !ruby/object:Gem::Dependency
378
378
  name: typeprof
379
379
  requirement: !ruby/object:Gem::Requirement
@@ -437,6 +437,7 @@ executables: []
437
437
  extensions: []
438
438
  extra_rdoc_files: []
439
439
  files:
440
+ - ".adr-dir"
440
441
  - ".editorconfig"
441
442
  - ".overcommit.yml"
442
443
  - ".rspec"
@@ -452,12 +453,20 @@ files:
452
453
  - README.md
453
454
  - Rakefile
454
455
  - Steepfile
456
+ - adr/0001-record-architecture-decisions.md
457
+ - adr/0002-introduction-of-signature-class.md
458
+ - adr/0003-logging-methods-vs-logger-class.md
459
+ - adr/0004-default-logging-activation.md
460
+ - adr/0005-logger-types.md
455
461
  - docs/.gitignore
456
462
  - docs/.vitepress/config.mjs
457
463
  - docs/README.md
458
464
  - docs/api-examples.md
459
465
  - docs/bun.lockb
460
466
  - docs/common-use-cases/bech32-encoding-and-decoding-(NIP-19).md
467
+ - docs/common-use-cases/logging-and-debugging.md
468
+ - docs/common-use-cases/signing-and-verifying-events.md
469
+ - docs/common-use-cases/signing-and-verifying-messages.md
461
470
  - docs/core/client.md
462
471
  - docs/core/keys.md
463
472
  - docs/core/user.md
@@ -483,6 +492,9 @@ files:
483
492
  - lib/nostr.rb
484
493
  - lib/nostr/bech32.rb
485
494
  - lib/nostr/client.rb
495
+ - lib/nostr/client/color_logger.rb
496
+ - lib/nostr/client/logger.rb
497
+ - lib/nostr/client/plain_logger.rb
486
498
  - lib/nostr/client_message_type.rb
487
499
  - lib/nostr/crypto.rb
488
500
  - lib/nostr/errors.rb
@@ -491,7 +503,11 @@ files:
491
503
  - lib/nostr/errors/invalid_key_format_error.rb
492
504
  - lib/nostr/errors/invalid_key_length_error.rb
493
505
  - lib/nostr/errors/invalid_key_type_error.rb
506
+ - lib/nostr/errors/invalid_signature_format_error.rb
507
+ - lib/nostr/errors/invalid_signature_length_error.rb
508
+ - lib/nostr/errors/invalid_signature_type_error.rb
494
509
  - lib/nostr/errors/key_validation_error.rb
510
+ - lib/nostr/errors/signature_validation_error.rb
495
511
  - lib/nostr/event.rb
496
512
  - lib/nostr/event_kind.rb
497
513
  - lib/nostr/events/encrypted_direct_message.rb
@@ -503,6 +519,7 @@ files:
503
519
  - lib/nostr/public_key.rb
504
520
  - lib/nostr/relay.rb
505
521
  - lib/nostr/relay_message_type.rb
522
+ - lib/nostr/signature.rb
506
523
  - lib/nostr/subscription.rb
507
524
  - lib/nostr/user.rb
508
525
  - lib/nostr/version.rb
@@ -510,6 +527,9 @@ files:
510
527
  - sig/nostr.rbs
511
528
  - sig/nostr/bech32.rbs
512
529
  - sig/nostr/client.rbs
530
+ - sig/nostr/client/color_logger.rbs
531
+ - sig/nostr/client/logger.rbs
532
+ - sig/nostr/client/plain_logger.rbs
513
533
  - sig/nostr/client_message_type.rbs
514
534
  - sig/nostr/crypto.rbs
515
535
  - sig/nostr/errors/error.rbs
@@ -517,7 +537,11 @@ files:
517
537
  - sig/nostr/errors/invalid_key_format_error.rbs
518
538
  - sig/nostr/errors/invalid_key_length_error.rbs
519
539
  - sig/nostr/errors/invalid_key_type_error.rbs
540
+ - sig/nostr/errors/invalid_signature_format_error.rbs
541
+ - sig/nostr/errors/invalid_signature_length_error.rbs
542
+ - sig/nostr/errors/invalid_signature_type_error.rbs
520
543
  - sig/nostr/errors/key_validation_error.rbs
544
+ - sig/nostr/errors/signature_validation_error.rbs
521
545
  - sig/nostr/event.rbs
522
546
  - sig/nostr/event_kind.rbs
523
547
  - sig/nostr/events/encrypted_direct_message.rbs
@@ -529,6 +553,7 @@ files:
529
553
  - sig/nostr/public_key.rbs
530
554
  - sig/nostr/relay.rbs
531
555
  - sig/nostr/relay_message_type.rbs
556
+ - sig/nostr/signature.rbs
532
557
  - sig/nostr/subscription.rbs
533
558
  - sig/nostr/user.rbs
534
559
  - sig/vendor/bech32.rbs
@@ -543,6 +568,7 @@ files:
543
568
  - sig/vendor/faye/websocket/api.rbs
544
569
  - sig/vendor/faye/websocket/client.rbs
545
570
  - sig/vendor/schnorr.rbs
571
+ - sig/vendor/schnorr/signature.rbs
546
572
  homepage: https://nostr-ruby.com/
547
573
  licenses:
548
574
  - MIT
@@ -559,14 +585,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
559
585
  requirements:
560
586
  - - ">="
561
587
  - !ruby/object:Gem::Version
562
- version: 3.2.0
588
+ version: 3.3.0
563
589
  required_rubygems_version: !ruby/object:Gem::Requirement
564
590
  requirements:
565
591
  - - ">="
566
592
  - !ruby/object:Gem::Version
567
593
  version: '0'
568
594
  requirements: []
569
- rubygems_version: 3.4.20
595
+ rubygems_version: 3.5.6
570
596
  signing_key:
571
597
  specification_version: 4
572
598
  summary: Client and relay implementation of the Nostr protocol.