WalletService
open class WalletService
The API calls for implementing an identity credential/claim wallet.
-
The error that’s returned by
getPendingSignatureRequest
when the request is missing required information.Declaration
Swift
public static let errMalformedRequest = "Received malformed signature request."
-
The error that’s returned in
getPendingSignatureRequest
when there are no requests pending.Declaration
Swift
public static let errNothing = "There are no pending requests."
-
The error that’s returned in
postBlob
orgetBlob
when the blob cannot be decrypted.Declaration
Swift
public static let errInvalidBlobKey = "Invalid decryption key."
-
The error that’s returned in
postBlob
when the blob could not be uploaded.Declaration
Swift
public static let errBackupFailed = "Backup failed."
-
Failure callback function taking an error message. It is executed on the main UI thread.
Declaration
Swift
public typealias FailureCallback = (String) -> Void
-
The URL of the backend REST APIs.
Declaration
Swift
public let backendUrl : String
-
Initialize the wallet API with the given backend URL.
Declaration
Swift
public init(backendUrl : String)
Parameters
backendUrl
The URL of the backend REST APIs.
-
Register this device with the notification service. This enables the app to receive Apple Push Notifications for notification sent to the default registered credential.
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { walletApi.registerDevice(deviceToken: deviceToken, onSuccess: { }, onError: { _ in }) }
Declaration
Swift
open func registerDevice(deviceToken: Data, onSuccess: @escaping () -> Void, onError: @escaping (String) -> Void)
Parameters
deviceToken
The APN device token, as received in didRegisterForRemoteNotificationsWithDeviceToken.
onSuccess
Success callback, invoked on the main thread.
onError
Failure callback , invoked on the main thread with a String error message.
-
Register this device with the notification service. This enables the app to receive Firebase notifications for notification sent to the default registered credential.
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) { walletApi.registerDevice(fcmToken: fcmToken, onSuccess: { }, onError: { _ in }) }
Declaration
Swift
open func registerDevice(fcmToken: String, onSuccess: @escaping () -> Void, onError: @escaping (String) -> Void)
Parameters
fcmToken
The Firebase Cloud Messaging token, as received in didReceiveRegistrationToken.
onSuccess
Success callback, invoked on the main thread.
onError
Failure callback , invoked on the main thread with a String error message.
-
Grab the next login/signing request for the default registered credential.
Declaration
Swift
open func getPendingSignatureRequest(onSuccess: @escaping (_ signatureRequest : WalletUtils.SignatureRequest) -> Void, onError: @escaping FailureCallback)
Parameters
onSuccess
Success callback, invoked on the main thread with the parsed JSON.
onError
Failure callback, invoked on the main thread with a String error message.
-
Remove the pending request identified by its nonce.
Declaration
Swift
open func removeSignatureRequest(nonce: String, onSuccess: @escaping () -> Void, onError: @escaping FailureCallback)
Parameters
nonce
The unique nonce for the login request, as received from the notification or pending request.
onSuccess
Success callback, invoked on the main thread.
onError
Failure callback, invoked on the main thread with a String error message.
-
Store blob encrypted.
Declaration
Swift
open func postBlob(filename: String, blob: Data, onSuccess: @escaping () -> Void, onError: @escaping FailureCallback) throws
Parameters
filename
The filename for later lookup.
blob
The blob to encrypt and store.
onSuccess
Success callback, invoked on the main thread.
onError
Failure callback, invoked on the main thread with a String error message.
-
Get blob by filename and decrypt with key.
Declaration
Swift
open func getBlob(key: [UInt8], filename: String, onSuccess: @escaping (Data) -> Void, onError: @escaping FailureCallback)
Parameters
key
Key used for decryption.
filename
The filename.
onSuccess
Success callback, invoked on the main thread.
onError
Failure callback, invoked on the main thread with a String error message.