EosioReferenceAuthenticatorSignatureProvider
public class EosioReferenceAuthenticatorSignatureProvider : EosioSignatureProviderProtocol
Signature provider for EOSIO SDK for Swift that provides selective disclosure and transaction signing using the
EOSIO Reference iOS Authenticator App. Conforms to EosioSignatureProviderProtocol
.
Requirements for developers.
- Add manifest.json file.
- Add URL scheme or Universal Link.
- Add URL scheme to whitelist.
-
Singleton instance of the
EosioReferenceAuthenticatorSignatureProvider
.Declaration
Swift
public static let shared: EosioReferenceAuthenticatorSignatureProvider
-
Handle an incoming request from a Universal Link.
Declaration
Swift
public static func handleIncoming(userActivity: NSUserActivity)
Parameters
userActivity
Current application state as
NSUserActivity
. -
Handle an incoming request from a custom URL scheme.
Declaration
Swift
public static func handleIncoming(url: URL)
Parameters
url
The URL passed in from the system handler that the app has registered.
-
If true the incoming request requires biometric authentication to be processed.
Declaration
Swift
public var requireBiometric: Bool
-
The return URL of the request.
Declaration
Swift
public var returnUrl: String
-
The call back URL of the request.
Declaration
Swift
public var callbackUrl: String?
-
The declared domain of the request.
Declaration
Swift
public var declaredDomain: String?
-
The application manifest of the request.
Declaration
Swift
public var manifest: String?
-
Security checks or rules to relax during processing of the current request.
Declaration
Swift
public var securityExclusions: SecurityExclusions?
-
The incoming request structure to handle.
See moreDeclaration
Swift
public struct Request : Codable
-
Request Payload native struct.
See moreDeclaration
Swift
public struct RequestPayload : Codable
-
Returned response structure for processed request.
See moreDeclaration
Swift
public struct Response : Codable
-
Response Payload native struct.
See moreDeclaration
Swift
public struct ResponsePayload : Codable
-
Handle selective disclosures in the payload, caching data and call completion.
Declaration
Swift
public static func handleIncomingSelectiveDisclosure(payload: ResponsePayload)
Parameters
payload
The selective disclosure
ResponsePayload
-
The type of selective disclosure.
See moreDeclaration
Swift
public enum SelectiveDisclosureType : String, Codable
-
Single disclosure request.
See moreDeclaration
Swift
public struct Disclosure : Codable
-
Selective disclosure request. Can contain multiple disclosures in a single request.
See moreDeclaration
Swift
public struct SelectiveDisclosureRequest : Codable
-
Selective disclosure response.
See moreDeclaration
Swift
public struct SelectiveDisclosureResponse : Codable
-
Authorizer information returned in selective disclosure.
See moreDeclaration
Swift
public struct Authorizer : Codable
-
Request selective disclosure from the EOSIO Reference iOS Authenticator App. Opens the EOSIO Reference iOS Authenticator App and asks the user for permission.
Declaration
Swift
public func requestSelectiveDisclosure(_ request: SelectiveDisclosureRequest, completion: @escaping (SelectiveDisclosureResponse) -> Void)
Parameters
request
The
SelectiveDisclosureRequest
being sent to the EOSIO Reference iOS Authenticator App.completion
The completion closure to be called with the
SelectiveDisclosureResponse
. -
Get the list of keys from the available authorizers. Required to conform to
EosioSignatureProviderProtocol
.Declaration
Swift
public func getAvailableKeys(completion: @escaping (EosioAvailableKeysResponse) -> Void)
Parameters
completion
Closure to call with the
EosioAvailableKeysResponse
. -
Request authorizers from the EOSIO Reference iOS Authenticator App. Opens the EOSIO Reference iOS Authenticator App and asks the user for permission.
Declaration
Swift
public func requestAuthorizers(completion: @escaping (SelectiveDisclosureResponse) -> Void)
Parameters
completion
The completion closure to be called with the
SelectiveDisclosureResponse
. -
Returns the cache of the last
requestAuthorizers
call if present. Otherwise, requests authorizers from the EOSIO Reference iOS Authenticator App.Remark
In the future, updated authorizers could be retrieved from a server with a token returned from the last
requestAuthorizers
call. Updated authorizers can also be included with each transaction response.Declaration
Swift
public func getAuthorizers(completion: @escaping (SelectiveDisclosureResponse) -> Void)
-
Clear the authorizers in the local cache.
Declaration
Swift
public func clearAuthorizers() throws
-
Read authorizers file from cache.
Throws
If there is an error building the authorizers URL or decoding the cached authorizers JSON.Declaration
Swift
public func getAuthorizers() throws -> [Authorizer]
Return Value
Array
ofAuthorizer
.
-
Handle transaction signature requests in the payload.
Declaration
Swift
public static func handleIncomingTransactionSignature(payload: ResponsePayload)
Parameters
payload
The transaction signature
ResponsePayload
. -
The structure for
See moreEosioReferenceAuthenticatorSignatureProvider.TransactionSignatureRequest.Transaction
.Declaration
Swift
public struct Transaction : Codable
-
The transaction signature request. Conforms to the
See moretransactionSignature
property of the request protocol at: https://github.com/EOSIO/eosio-authentication-transport-protocol-specDeclaration
Swift
public struct TransactionSignatureRequest : Codable
-
The structure for the
See moreEosioReferenceAuthenticatorSignatureProvider.TransactionSignatureResponse
. Conforms to thetransactionSignature
property of the response protocol at: https://github.com/EOSIO/eosio-authentication-transport-protocol-specDeclaration
Swift
public struct TransactionSignatureResponse : Codable
-
Sign transaction implementation method. Required to conform to
EosioSignatureProviderProtocol
.Declaration
Swift
public func signTransaction(request: EosioTransactionSignatureRequest, completion: @escaping (EosioTransactionSignatureResponse) -> Void)
Parameters
request
The
EosioTransactionSignatureRequest
being sent to the EOSIO Reference iOS Authenticator App.completion
The completion closure to be called with the
EosioTransactionSignatureResponse
.