1 Commits

Author SHA1 Message Date
Râu Cao
03bd5203ca Make code compatible with Ruby 2.7
Not including specs etc.
2024-01-15 11:55:09 +03:00
4 changed files with 7 additions and 11 deletions

View File

@@ -13,8 +13,6 @@ module Nostr
# #
# @param [String] key_kind The kind of key that is invalid (public or private) # @param [String] key_kind The kind of key that is invalid (public or private)
# #
def initialize(key_kind) def initialize(key_kind) = super("Invalid #{key_kind} key type")
super("Invalid #{key_kind} key type")
end
end end
end end

View File

@@ -79,9 +79,7 @@ module Nostr
# #
# @return [String] The bech32 string representation of the key # @return [String] The bech32 string representation of the key
# #
def to_bech32 def to_bech32 = Bech32.encode(hrp: self.class.hrp, data: self)
Bech32.encode(hrp: self.class.hrp, data: self)
end
protected protected

View File

@@ -89,7 +89,7 @@ module Nostr
def get_key_pair_from_private_key(private_key) def get_key_pair_from_private_key(private_key)
validate_private_key(private_key) validate_private_key(private_key)
public_key = extract_public_key(private_key) public_key = extract_public_key(private_key)
KeyPair.new(private_key: private_key, public_key: public_key) KeyPair.new(private_key:, public_key:)
end end
private private

View File

@@ -62,10 +62,10 @@ module Nostr
) )
event = Event.new( event = Event.new(
pubkey: keypair.public_key, pubkey: keypair.public_key,
kind: kind, kind:,
content: content, content:,
created_at: created_at, created_at:,
tags: tags tags:
) )
event.sign(keypair.private_key) event.sign(keypair.private_key)
end end