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:
4
sig/vendor/schnorr.rbs
vendored
4
sig/vendor/schnorr.rbs
vendored
@@ -1,4 +1,6 @@
|
||||
# Added only to satisfy the Steep requirements. Not 100% reliable.
|
||||
module Schnorr
|
||||
def self.sign: (String message, String private_key, ?String aux_rand) -> untyped
|
||||
def self.sign: (String message, String private_key, ?String aux_rand) -> Signature
|
||||
def self.valid_sig?: (String message, String public_key, String signature) -> bool
|
||||
def self.check_sig!: (String message, String public_key, String signature) -> bool
|
||||
end
|
||||
|
||||
16
sig/vendor/schnorr/signature.rbs
vendored
Normal file
16
sig/vendor/schnorr/signature.rbs
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Added only to satisfy the Steep requirements. Not 100% reliable.
|
||||
module Schnorr
|
||||
class InvalidSignatureError < StandardError
|
||||
end
|
||||
|
||||
class Signature
|
||||
attr_reader r: Integer
|
||||
attr_reader s: Integer
|
||||
|
||||
def self.decode: (String string) -> Signature
|
||||
|
||||
def initialize: (Integer r, Integer s) -> void
|
||||
def encode: -> String
|
||||
def ==: (untyped other) -> bool
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user