purple: switch local testing to staging testing
This commit is contained in:
@@ -43,7 +43,7 @@ func make_nip98_authenticated_request(method: HTTPMethod, url: URL, payload: Dat
|
||||
createdAt: UInt32(Date().timeIntervalSince1970)
|
||||
)
|
||||
|
||||
let auth_note_json_data: Data = try JSONEncoder().encode(auth_note)
|
||||
let auth_note_json_data: Data = try encode_json_data(auth_note)
|
||||
let auth_note_base64: String = base64_encode(auth_note_json_data.bytes)
|
||||
|
||||
request.setValue("Nostr " + auth_note_base64, forHTTPHeaderField: "Authorization")
|
||||
|
||||
@@ -325,7 +325,13 @@ func decode_nostr_event(txt: String) -> NostrResponse? {
|
||||
func encode_json<T: Encodable>(_ val: T) -> String? {
|
||||
let encoder = JSONEncoder()
|
||||
encoder.outputFormatting = .withoutEscapingSlashes
|
||||
return (try? encoder.encode(val)).map { String(decoding: $0, as: UTF8.self) }
|
||||
return (try? encode_json_data(val)).map { String(decoding: $0, as: UTF8.self) }
|
||||
}
|
||||
|
||||
func encode_json_data<T: Encodable>(_ val: T) throws -> Data {
|
||||
let encoder = JSONEncoder()
|
||||
encoder.outputFormatting = .withoutEscapingSlashes
|
||||
return try encoder.encode(val)
|
||||
}
|
||||
|
||||
func decode_nostr_event_json(json: String) -> NostrEvent? {
|
||||
|
||||
Reference in New Issue
Block a user