1 Commits

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

View File

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

View File

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

View File

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

View File

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