Skip to content
Snippets Groups Projects
Commit 75b901ad authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Update E2ESendReport model

parent 8bbf3d8d
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!47Update Bindings.xcframework
......@@ -4,16 +4,19 @@ public struct E2ESendReport: Equatable {
public init(
roundList: [Int]?,
messageId: Data?,
timestamp: Int?
timestamp: Int?,
keyResidue: Data?
) {
self.roundList = roundList
self.messageId = messageId
self.timestamp = timestamp
self.keyResidue = keyResidue
}
public var roundList: [Int]?
public var messageId: Data?
public var timestamp: Int?
public var keyResidue: Data?
}
extension E2ESendReport: Codable {
......@@ -21,6 +24,7 @@ extension E2ESendReport: Codable {
case roundList = "Rounds"
case messageId = "MessageID"
case timestamp = "Timestamp"
case keyResidue = "KeyResidue"
}
public static func decode(_ data: Data) throws -> Self {
......
......@@ -5,13 +5,15 @@ import XCTest
final class E2ESendReportTests: XCTestCase {
func testCoding() throws {
let rounds = [1, 5, 9]
let messageIdB64 = "51Yy47uZbP0o2Y9B/kkreDLTB6opUol3M3mYiY2dcdQ="
let timestamp: Int = 1_653_582_683_183_384_000
let messageIdB64 = "iM34yCIr4Je8ZIzL9iAAG1UWAeDiHybxMTioMAaezvs="
let timestamp: Int = 1_661_532_254_302_612_000
let keyResidueB64 = "9q2/A69EAuFM1hFAT7Bzy5uGOQ4T6bPFF72h5PlgCWE="
let jsonString = """
{
"Rounds": [\(rounds.map { "\($0)" }.joined(separator: ", "))],
"MessageID": "\(messageIdB64)",
"Timestamp": \(timestamp)
"Timestamp": \(timestamp),
"KeyResidue": "\(keyResidueB64)"
}
"""
let jsonData = jsonString.data(using: .utf8)!
......@@ -20,7 +22,8 @@ final class E2ESendReportTests: XCTestCase {
XCTAssertNoDifference(model, E2ESendReport(
roundList: rounds,
messageId: Data(base64Encoded: messageIdB64)!,
timestamp: timestamp
timestamp: timestamp,
keyResidue: Data(base64Encoded: keyResidueB64)
))
let encodedModel = try model.encode()
......@@ -37,7 +40,8 @@ final class E2ESendReportTests: XCTestCase {
XCTAssertNoDifference(model, E2ESendReport(
roundList: nil,
messageId: nil,
timestamp: nil
timestamp: nil,
keyResidue: nil
))
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment