Skip to content
Snippets Groups Projects

Remove problematic bigint encoding

Merged Dariusz Rybicki requested to merge fix/bigint-encoding into development
2 files
+ 6
15
Compare changes
  • Side-by-side
  • Inline
Files
2
import Foundation
public struct GroupMember: Equatable {
public init(id: Data, dhKey: DHKey) {
public init(id: Data) {
self.id = id
self.dhKey = dhKey
}
public var id: Data
public var dhKey: DHKey
}
extension GroupMember: Decodable {
enum CodingKeys: String, CodingKey {
case id = "ID"
case dhKey = "DhKey"
}
public static func decode(_ data: Data) throws -> Self {
let data = convertJsonNumberToString(in: data, at: "Value")
let data = convertJsonNumberToString(in: data, minNumberLength: 19)
return try JSONDecoder().decode(Self.self, from: data)
}
}
extension Array where Element == GroupMember {
public static func decode(_ data: Data) throws -> Self {
let data = convertJsonNumberToString(in: data, at: "Value")
let data = convertJsonNumberToString(in: data, minNumberLength: 19)
return try JSONDecoder().decode(Self.self, from: data)
}
}
Loading