forked from nostr-sdk/nostr-sdk-ios
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
377796e
commit 0491fea
Showing
5 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// DeletionEvent.swift | ||
// | ||
// | ||
// Created by Bryan Montz on 10/29/23. | ||
// | ||
|
||
import Foundation | ||
|
||
/// An event that contains one or more references to other events that the | ||
/// event creator would like to delete. | ||
/// | ||
/// > Note: [NIP-09 Specification](https://github.com/nostr-protocol/nips/blob/master/09.md) | ||
public final class DeletionEvent: NostrEvent { | ||
|
||
public required init(from decoder: Decoder) throws { | ||
try super.init(from: decoder) | ||
} | ||
|
||
@available(*, unavailable, message: "This initializer is unavailable for this class.") | ||
override init(kind: EventKind, content: String, tags: [Tag] = [], createdAt: Int64 = Int64(Date.now.timeIntervalSince1970), signedBy keypair: Keypair) throws { | ||
try super.init(kind: kind, content: content, tags: tags, createdAt: createdAt, signedBy: keypair) | ||
} | ||
|
||
init(content: String, tags: [Tag] = [], createdAt: Int64 = Int64(Date.now.timeIntervalSince1970), signedBy keypair: Keypair) throws { | ||
try super.init(kind: .deletion, content: content, tags: tags, createdAt: createdAt, signedBy: keypair) | ||
} | ||
|
||
/// The reason the creator of the event gave for deleting the included events. | ||
public var reason: String { | ||
content | ||
} | ||
|
||
/// The event ids that the creator requests deletion for. | ||
public var deletedEventIds: [String] { | ||
tags.filter { $0.name == .event }.map { $0.value } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"id": "fa5ed84fc8eeb959fd39ad8e48388cfc33075991ef8e50064cfcecfd918bb91b", | ||
"pubkey": "9947f9659dd80c3682402b612f5447e28249997fb3709500c32a585eb0977340", | ||
"created_at": 1682080184, | ||
"kind": 1, | ||
"tags": [ | ||
[ | ||
"e", | ||
"93930d65435d49db723499335473920795e7f13c45600dcfad922135cf44bd63" | ||
], | ||
[ | ||
"p", | ||
"f8e6c64342f1e052480630e27e1016dce35fc3a614e60434fef4aa2503328ca9" | ||
] | ||
], | ||
"content": "I think it stays persistent on your profile, but interface setting doesn’t persist. Bug. ", | ||
"sig": "96e6667348b2b1fc5f6e73e68fb1605f571ad044077dda62a35c15eb8290f2c4559935db461f8466df3dcf39bc2e11984c5344f65aabee4520dd6653d74cdc09" | ||
} |