Classes

ActivationCode

@objc public class ActivationCode: NSObject, Codable

The code returned after the user has verified their identity successfully.

Properties

value

@objc public var value: String = ""

String representation of the code.

expiration

@objc public var expiration: Date = Date()

Set when this code will expire. This value is a configuration of the MIRACL platform and its default value is 90 seconds.

API

open class API

Methods

init(sdkConfiguration:)

public init(sdkConfiguration: Configuration) throws

registerUser(for:accessId:deviceName:activationCode:completionHandler:)

public func registerUser(for userId: String,
                         accessId: String,
                         deviceName: String,
                         activationCode: ActivationCode,
                         completionHandler: @escaping (RegistrationResponse?,
Error?) -> Void)

signature(for:regOTT:completionHandler:)

public func signature(for mpinId: String,
                      regOTT: String,
                      completionHandler: @escaping (SignatureResponse?, Error?)
-> Void)

getClientSecret2(for:completionHandler:)

public func getClientSecret2(for cs2URL: URL, completionHandler:@escaping
(ClientSecretResponse?, Error?) -> Void)

pass1(for:mpinId:uValue:scope:completionHandler:)

public func pass1(for dtas: String, mpinId: String, uValue: String, scope:
[String], completionHandler:@escaping (Pass1Response?, Error?) -> Void)

pass2(for:accessId:vValue:completionHandler:)

public func pass2(for mpinId: String, accessId: String, vValue: String,
completionHandler:@escaping (Pass2Response?, Error?) -> Void)

authenticate(authOTT:completionHandler:)

public func authenticate(authOTT: String, completionHandler:@escaping
(AuthenticateResponse?, Error?) -> Void)

AuthenticateResponse

public class AuthenticateResponse: Codable

HTTP response object received in a completion block after a call to authenticate method of the API class.

Currently this class is empty. For a successful authentication only a successful call to authenticate endpoint is needed.

Builder

@objc(ConfigurationBuilder) public class Builder: NSObject

Builds Configuration objects.

Methods

init(projectId:)

@objc public init(projectId: String)

userStorage(userStorage:)

@objc(userStorageWith:) public func userStorage(userStorage: UserStorage) ->
Builder

Set custom UserStorage implementation.

Parameters
Name Description
userStorage custom implementation.

build()

@objc public func build() throws -> Configuration

Returns Configuration object.

ClientSecretResponse

public class ClientSecretResponse: Codable

HTTP response object received in а completion block after а call to getClientSecret2(for cs2URL: completionHandler:)) method of the API class.

Configuration

@objc public class Configuration: NSObject

Object that stores configurations of the SDK with values issued by MIRACL.

MIRACLTrust

open class MIRACLTrust: NSObject

Main class of the SDK used for all possible actions like registration and authentication.

Properties

users

@objc public var users: [User] = []

Array of already registered users

Methods

configure(with:)

@objc public class func configure(with configuration: Configuration) throws

Configure SDK with values issued by MIRACL and stored in the Configuration object. It is recommended to be called right after the application is launched.

  • Parameter configuration:object storing configurations of the SDK.
Parameters
Name Description
configuration object storing configurations of the SDK.

register(for:activationCode:accessId:didRequestPinHandler:completionHandler:)

@objc public class func register(for userId: String,
                                 activationCode: ActivationCode,
                                 accessId: String,
                                 didRequestPinHandler: @escaping
PinRequestHandler,
                                 completionHandler: @escaping
RegistrationCompletionHandler)

Creates new identity in the MIRACL platform.

  • Parameters:
    • userId: an identifier of the user (e.g email address).
    • activationCode: a code obtained during the user verification process indicating that the user has been already verified.
    • accessId: session identifier used to get information from web session.
    • didRequestPinHandler: a closure called when PIN code is needed from the SDK. It can be used to show UI for entering PIN. Its parameter is another closure that is mandatory to be called after the user finishes their action.
    • completionHandler: a closure called when creating a new identity has finished. It can contain an error object or the User where both of them are optional objects.
Parameters
Name Description
userId an identifier of the user (e.g email address).
activationCode a code obtained during the user verification process indicating that the user has been already verified.
accessId session identifier used to get information from web session.
didRequestPinHandler a closure called when PIN code is needed from the SDK. It can be used to show UI for entering PIN. Its parameter is another closure that is mandatory to be called after the user finishes their action.
completionHandler a closure called when creating a new identity has finished. It can contain an error object or the User where both of them are optional objects.

authenticate(for:accessId:didRequestPinHandler:completionHandler:)

@objc public class func authenticate(for user: User,
                                     accessId: String,
                                     didRequestPinHandler: @escaping
PinRequestHandler,
                                     completionHandler: @escaping
AuthenticationCompletionHandler)

Authenticates identity in the MIRACL platform

  • Parameters:
    • user: object that keeps an identity in it.
    • accessId: session identifier used to get information from web session.
    • didRequestPinHandler: a closure called when PIN code is needed from the SDK. It can be used to show UI for entering PIN. Its parameter is another closure that is mandatory to be called after the user finishes their action.
    • completionHandler: a closure called when identity is authenticated. It can contain a boolean flag representing the result of the authentication and an optional error object.
Parameters
Name Description
user object that keeps an identity in it.
accessId session identifier used to get information from web session.
didRequestPinHandler a closure called when PIN code is needed from the SDK. It can be used to show UI for entering PIN. Its parameter is another closure that is mandatory to be called after the user finishes their action.
completionHandler a closure called when identity is authenticated. It can contain a boolean flag representing the result of the authentication and an optional error object.

deleteUser(user:)

@objc public class func deleteUser(user: User) -> Bool

Deletes user object from the local storage.

  • Parameter user: object that keeps an identity in it.
Parameters
Name Description
user object that keeps an identity in it.

Pass1Response

public class Pass1Response: Codable

HTTP response object received in a completion block after a call to pass1(for dtas:mpinId:uValue:scope:completionHandler:) method of the API class.

Pass2Response

public class Pass2Response: Codable

HTTP response object received in a completion block after a call to pass2(for:accessId:vValue:completionHandler:) method of the API class.

RegistrationResponse

public class RegistrationResponse: Codable

HTTP response object received in а completion block after а call to signature(for:regOTT:completionHandler:) method of the API class.

SignatureResponse

public class SignatureResponse: Codable

HTTP response object received in а completion block after a call to a signature(for:regOTT:completionHandler:)) method of the API class.

User

@objc public class User: NSObject

Object representing the user identity.

Properties

userId

@objc public var userId: String = ""

Identifier of the user. Could be email or other string.

blocked

@objc public var blocked: Bool = false

User is blocked when there are 3 unsuccessful registrations.

pinLength

@objc public var pinLength: Int = 0

The number of the digits the user PIN should be.

dtas

@objc public var dtas: String = ""

Base64 encoded URL-s of DTA-s.

mpinId

@objc public var mpinId: Data = Data()

Actual representation of the identity.

token

@objc public var token: Data = Data()

The second factor of the authentication.