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
2c70afd4
Commit
2c70afd4
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Add GetPublicKeyFromContact functor
parent
6a540463
No related branches found
No related tags found
2 merge requests
!102
Release 1.0.0
,
!18
Update Bindings
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sources/ElixxirDAppsSDK/GetPublicKeyFromContact.swift
+30
-0
30 additions, 0 deletions
Sources/ElixxirDAppsSDK/GetPublicKeyFromContact.swift
with
30 additions
and
0 deletions
Sources/ElixxirDAppsSDK/
Legacy/ContactPubkeyProvider
.swift
→
Sources/ElixxirDAppsSDK/
GetPublicKeyFromContact
.swift
+
30
−
0
View file @
2c70afd4
import
Bindings
import
XCTestDynamicOverlay
public
struct
ContactPubk
ey
P
ro
vider
{
public
var
get
:
(
Data
)
throws
->
Data
public
struct
GetPublicK
ey
F
ro
mContact
{
public
var
run
:
(
Data
)
throws
->
Data
public
func
callAsFunction
(
contact
:
Data
)
throws
->
Data
{
try
get
(
contact
)
try
run
(
contact
)
}
}
extension
ContactPubk
ey
P
ro
vider
{
public
static
let
live
=
ContactPubk
ey
P
ro
vider
{
contact
in
extension
GetPublicK
ey
F
ro
mContact
{
public
static
let
live
=
GetPublicK
ey
F
ro
mContact
{
contact
in
var
error
:
NSError
?
let
pub
key
=
BindingsGetPubkeyFromContact
(
contact
,
&
error
)
let
key
=
BindingsGetPubkeyFromContact
(
contact
,
&
error
)
if
let
error
=
error
{
throw
error
}
guard
let
pub
key
=
pub
key
else
{
guard
let
key
=
key
else
{
fatalError
(
"BindingsGetPubkeyFromContact returned `nil` without providing error"
)
}
return
pub
key
return
key
}
}
#if DEBUG
extension
ContactPubkeyProvider
{
public
static
let
failing
=
ContactPubkeyProvider
{
_
in
struct
NotImplemented
:
Error
{}
throw
NotImplemented
()
}
extension
GetPublicKeyFromContact
{
public
static
let
unimplemented
=
GetPublicKeyFromContact
(
run
:
XCTUnimplemented
(
"
\(
Self
.
self
)
"
)
)
}
#endif
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