Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Elixxir dApps SDK Swift
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile
iOS
Elixxir dApps SDK Swift
Commits
75b901ad
Commit
75b901ad
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Update E2ESendReport model
parent
8bbf3d8d
No related branches found
No related tags found
2 merge requests
!102
Release 1.0.0
,
!47
Update Bindings.xcframework
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/XXClient/Models/E2ESendReport.swift
+5
-1
5 additions, 1 deletion
Sources/XXClient/Models/E2ESendReport.swift
Tests/XXClientTests/Models/E2ESendReportTests.swift
+9
-5
9 additions, 5 deletions
Tests/XXClientTests/Models/E2ESendReportTests.swift
with
14 additions
and
6 deletions
Sources/XXClient/Models/E2ESendReport.swift
+
5
−
1
View file @
75b901ad
...
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
Tests/XXClientTests/Models/E2ESendReportTests.swift
+
9
−
5
View file @
75b901ad
...
...
@@ -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
))
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment