Implement NIP-04: Encrypted Direct Messages

This commit is contained in:
Wilson Silva
2023-02-25 17:26:28 +07:00
parent 0df4dbb979
commit 857bf0ce8e
12 changed files with 343 additions and 0 deletions

View File

@@ -1,9 +1,16 @@
module Nostr
class Crypto
BN_BASE: Integer
CIPHER_CURVE: String
CIPHER_ALGORITHM: String
def encrypt_text: (String, String, String) -> String
def decrypt_text: (String, String, String) -> String
def sign_event: (Event, String) -> Event
private
def compute_shared_key: (String, String) -> String
def hash_event:(Event) -> String
end
end

View File

@@ -4,5 +4,6 @@ module Nostr
TEXT_NOTE: Integer
RECOMMEND_SERVER: Integer
CONTACT_LIST: Integer
ENCRYPTED_DIRECT_MESSAGE: Integer
end
end

View File

@@ -0,0 +1,12 @@
module Nostr
module Events
class EncryptedDirectMessage < Event
def initialize: (
plain_text: String,
sender_private_key: String,
recipient_public_key: String,
?previous_direct_message: String|nil
) -> void
end
end
end