connect to relays stored in contacts

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-06-08 13:09:46 -07:00
parent bbb0ee205f
commit 23bb7c7f18
5 changed files with 34 additions and 6 deletions

View File

@@ -236,6 +236,10 @@ func encode_json<T: Encodable>(_ val: T) -> String? {
return (try? encoder.encode(val)).map { String(decoding: $0, as: UTF8.self) }
}
func decode_json<T: Decodable>(_ val: String) -> T? {
return try? JSONDecoder().decode(T.self, from: Data(val.utf8))
}
func decode_data<T: Decodable>(_ data: Data) -> T? {
let decoder = JSONDecoder()
do {