mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-03-29 03:02:07 +01:00
Update 56.md
Co-authored-by: Leo Wandersleb <leo@leowandersleb.de>
This commit is contained in:
parent
b3736f6204
commit
5c9bf68d1e
44
56.md
44
56.md
@ -30,27 +30,37 @@ A `report` tag MUST be included which consists of the following report types:
|
||||
|
||||
Some report tags only make sense for profile reports, such as `impersonation`
|
||||
|
||||
Example code
|
||||
Example events
|
||||
--------------
|
||||
|
||||
```swift
|
||||
enum ReportType: String {
|
||||
case explicit
|
||||
case illegal
|
||||
case spam
|
||||
case impersonation
|
||||
```json
|
||||
{
|
||||
"kind": 1984,
|
||||
"tags": [
|
||||
[ "p", <pubkey>, "explicit"]
|
||||
],
|
||||
"content": "",
|
||||
...
|
||||
}
|
||||
|
||||
func create_report_tags(target: ReportTarget, type: ReportType) -> [[String]] {
|
||||
var tags: [[String]]
|
||||
switch target {
|
||||
case .user(let pubkey):
|
||||
tags = [["p", pubkey]]
|
||||
case .note(let notet):
|
||||
tags = [["e", notet.note_id], ["p", notet.pubkey]]
|
||||
}
|
||||
{
|
||||
"kind": 1984,
|
||||
"tags": [
|
||||
[ "e", <eventId>, "illegal"],
|
||||
[ "p", <pubkey>]
|
||||
],
|
||||
"content": "He's insulting the king!",
|
||||
...
|
||||
}
|
||||
|
||||
tags.append(["report", type.rawValue])
|
||||
return tags
|
||||
{
|
||||
"kind": 1984,
|
||||
"tags": [
|
||||
[ "p", <impersonator pubkey>, "impersonation"],
|
||||
[ "p", <victim pubkey>]
|
||||
],
|
||||
"content": "Profile is imitating #[1]",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user