Allow the verification of signatures and events

Added the methods:
- Event#verify_signature
- Crypto#check_sig!
- Crypto#valid_sig?
- Crypto#sign_message

Fixed a primitive obsession by introducing a Signature class to ensure that signatures are valid Nostr signatures.
This commit is contained in:
Wilson Silva
2024-03-14 22:03:26 +00:00
parent f8893f9b0e
commit 01010c763f
25 changed files with 637 additions and 47 deletions

View File

@@ -0,0 +1,5 @@
module Nostr
class InvalidSignatureFormatError < SignatureValidationError
def initialize: -> void
end
end

View File

@@ -0,0 +1,5 @@
module Nostr
class InvalidSignatureLengthError < SignatureValidationError
def initialize: -> void
end
end

View File

@@ -0,0 +1,5 @@
module Nostr
class InvalidSignatureTypeError < SignatureValidationError
def initialize: -> void
end
end

View File

@@ -0,0 +1,4 @@
module Nostr
class SignatureValidationError < Error
end
end