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
200f52c6
Commit
200f52c6
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Remove DHKey from GroupMember model
parent
a08505ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!102
Release 1.0.0
,
!51
Remove problematic bigint encoding
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/XXClient/Models/GroupMember.swift
+3
-6
3 additions, 6 deletions
Sources/XXClient/Models/GroupMember.swift
Tests/XXClientTests/Models/GroupMemberTests.swift
+3
-9
3 additions, 9 deletions
Tests/XXClientTests/Models/GroupMemberTests.swift
with
6 additions
and
15 deletions
Sources/XXClient/Models/GroupMember.swift
+
3
−
6
View file @
200f52c6
import
Foundation
import
Foundation
public
struct
GroupMember
:
Equatable
{
public
struct
GroupMember
:
Equatable
{
public
init
(
id
:
Data
,
dhKey
:
DHKey
)
{
public
init
(
id
:
Data
)
{
self
.
id
=
id
self
.
id
=
id
self
.
dhKey
=
dhKey
}
}
public
var
id
:
Data
public
var
id
:
Data
public
var
dhKey
:
DHKey
}
}
extension
GroupMember
:
Decodable
{
extension
GroupMember
:
Decodable
{
enum
CodingKeys
:
String
,
CodingKey
{
enum
CodingKeys
:
String
,
CodingKey
{
case
id
=
"ID"
case
id
=
"ID"
case
dhKey
=
"DhKey"
}
}
public
static
func
decode
(
_
data
:
Data
)
throws
->
Self
{
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
)
return
try
JSONDecoder
()
.
decode
(
Self
.
self
,
from
:
data
)
}
}
}
}
extension
Array
where
Element
==
GroupMember
{
extension
Array
where
Element
==
GroupMember
{
public
static
func
decode
(
_
data
:
Data
)
throws
->
Self
{
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
)
return
try
JSONDecoder
()
.
decode
(
Self
.
self
,
from
:
data
)
}
}
}
}
This diff is collapsed.
Click to expand it.
Tests/XXClientTests/Models/GroupMemberTests.swift
+
3
−
9
View file @
200f52c6
...
@@ -5,14 +5,12 @@ import XCTest
...
@@ -5,14 +5,12 @@ import XCTest
final
class
GroupMemberTests
:
XCTestCase
{
final
class
GroupMemberTests
:
XCTestCase
{
func
testCoding
()
throws
{
func
testCoding
()
throws
{
let
idB64
=
"U4x/lrFkvxuXu59LtHLon1sUhPJSCcnZND6SugndnVID"
let
idB64
=
"U4x/lrFkvxuXu59LtHLon1sUhPJSCcnZND6SugndnVID"
let
dhKeyValue
=
"1759426033802606996617132861414734059978289057332806031357800676138355264622676606691435603603751978195460163638145821347601916259127578968570412642641025630452893097179266022832268525346700655861033031712000288680395716922501450233258587788020541937373196899001184700899008948530359980753630443486308876999029238453979779103124291315202352475056237021681172884599194016245219278368648568458514708567045834427853469072638665888791358582182353417065794210125797368093469194927663862565508608719835557592421245749381164023134450699040591219966988201315627676532245052123725278573237006510683695959381015415110970848376498637637944431576313526294020390694483472829278364602405292767170719547347485307956614210210673321959886410245334772057212077704024337636501108566655549055129066343309591274727538343075929837698653965640646190405582788894021694347212874155979958144038307500444865955516612526623220973497735316081265793063949"
let
dhKeyFingerprint
:
UInt64
=
15989433043166758754
let
jsonString
=
"""
let
jsonString
=
"""
{
{
"
ID
": "
\(
idB64
)
",
"
ID
": "
\(
idB64
)
",
"
DhKey
": {
"
DhKey
": {
"
Value
":
\(
dhKeyValue
)
,
"
Value
":
1759426033802606996617132861414734059978289057332806031357800676138355264622676606691435603603751978195460163638145821347601916259127578968570412642641025630452893097179266022832268525346700655861033031712000288680395716922501450233258587788020541937373196899001184700899008948530359980753630443486308876999029238453979779103124291315202352475056237021681172884599194016245219278368648568458514708567045834427853469072638665888791358582182353417065794210125797368093469194927663862565508608719835557592421245749381164023134450699040591219966988201315627676532245052123725278573237006510683695959381015415110970848376498637637944431576313526294020390694483472829278364602405292767170719547347485307956614210210673321959886410245334772057212077704024337636501108566655549055129066343309591274727538343075929837698653965640646190405582788894021694347212874155979958144038307500444865955516612526623220973497735316081265793063949
,
"
Fingerprint
":
\(
dhKeyFingerprint
)
"
Fingerprint
":
15989433043166758754
}
}
}
}
"""
"""
...
@@ -20,11 +18,7 @@ final class GroupMemberTests: XCTestCase {
...
@@ -20,11 +18,7 @@ final class GroupMemberTests: XCTestCase {
let
model
=
try
GroupMember
.
decode
(
jsonData
)
let
model
=
try
GroupMember
.
decode
(
jsonData
)
XCTAssertNoDifference
(
model
,
GroupMember
(
XCTAssertNoDifference
(
model
,
GroupMember
(
id
:
Data
(
base64Encoded
:
idB64
)
!
,
id
:
Data
(
base64Encoded
:
idB64
)
!
dhKey
:
DHKey
(
value
:
dhKeyValue
,
fingerprint
:
dhKeyFingerprint
)
))
))
let
jsonArrayString
=
"[
\(
jsonString
)
]"
let
jsonArrayString
=
"[
\(
jsonString
)
]"
...
...
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