damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | LICENSE

commit cca8738519702fc9eff32bf398e1dd935a619bc3
parent 04b0e2b38b1f92369d1812f3a0541618da78c60e
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 18 Apr 2022 10:30:28 -0700

fix signature/encoding issues with slashes

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Nostr/NostrEvent.swift | 1+
Mdamus/Nostr/RelayConnection.swift | 1+
2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/damus/Nostr/NostrEvent.swift b/damus/Nostr/NostrEvent.swift @@ -194,6 +194,7 @@ func decode_data<T: Decodable>(_ data: Data) -> T? { func event_commitment(ev: NostrEvent, tags: String) -> String { let encoder = JSONEncoder() + encoder.outputFormatting = .withoutEscapingSlashes let str_data = try! encoder.encode(ev.content) let content = String(decoding: str_data, as: UTF8.self) let commit = "[0,\"\(ev.pubkey)\",\(ev.created_at),\(ev.kind),\(tags),\(content)]" diff --git a/damus/Nostr/RelayConnection.swift b/damus/Nostr/RelayConnection.swift @@ -118,6 +118,7 @@ func make_nostr_req(_ req: NostrRequest) -> String? { func make_nostr_push_event(ev: NostrEvent) -> String? { let encoder = JSONEncoder() + encoder.outputFormatting = .withoutEscapingSlashes let event_data = try! encoder.encode(ev) let event = String(decoding: event_data, as: UTF8.self) let encoded = "[\"EVENT\",\(event)]"