Browse Source

fix signature/encoding issues with slashes

Signed-off-by: William Casarin <jb55@jb55.com>
profiles-everywhere
William Casarin 3 years ago
parent
commit
cca8738519
  1. 1
      damus/Nostr/NostrEvent.swift
  2. 1
      damus/Nostr/RelayConnection.swift

1
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)]"

1
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)]"

Loading…
Cancel
Save