Implement NIP04: Encrypted Direct Messages

Closes #5

This adds encrypted direct message support to damus

Changelog-Added: Implement NIP04: Encrypted Direct Messages
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-06-30 07:16:48 -07:00
parent 0744156c0c
commit c122035851
24 changed files with 892 additions and 228 deletions

View File

@@ -204,13 +204,13 @@ func make_contact_relays(_ relays: [RelayDescriptor]) -> [String: RelayInfo] {
}
// TODO: tests for this
func is_friend_event(_ ev: NostrEvent, our_pubkey: String, contacts: Contacts) -> Bool
func is_friend_event(_ ev: NostrEvent, keypair: Keypair, contacts: Contacts) -> Bool
{
if !contacts.is_friend(ev.pubkey) {
return false
}
if !ev.is_reply {
if ev.is_reply(keypair.privkey) {
return true
}