FRAClient

public class FRAClient : NSObject

FRAuthenticator is an abstraction layer of FRAuthenticator SDK and is responsible to create, and manage Account, and Mechanism objects with StorageClient

Properties

  • shared instance of FRAuthenticator after SDK started

    Declaration

    Swift

    public static var shared: FRAClient?

Lifecycle

  • Starts SDK’s lifecylce and internal process

    Declaration

    Swift

    public static func start()

StorageClient

  • Sets default SDK’s Storage Client; any storage client that inherits ‘StorageClient’ can be used for SDK’s storage

    Throws

    FRAError

    Declaration

    Swift

    public static func setStorage(storage: StorageClient) throws

    Parameters

    storage

    StoreClient object

FRAPolicyEvaluator

Account methods

  • Retrieves all Account objects from given StorageClient

    Declaration

    Swift

    public func getAllAccounts() -> [Account]

    Return Value

    An array of Account; empty array is returned when there is no Account

  • Retrieves Account object that is associated with given Mechanism object

    Declaration

    Swift

    public func getAccount(mechanism: Mechanism) -> Account?

    Parameters

    mechanism

    Mechanism object to retrieve associated Account object

    Return Value

    Account object that the given Mechanism object belongs to

  • Retrieves a specific Account object with given identifier; identifier as in - format

    Declaration

    Swift

    public func getAccount(identifier: String) -> Account?

    Parameters

    identifier

    identifier of Account object as in - format

    Return Value

    Account object for given identifier

  • Update given Account object on the StorageClient

    Throws

    AccountError

    Declaration

    Swift

    @discardableResult
    public func updateAccount(account: Account) throws -> Bool

    Parameters

    account

    Account object to be updated

    Return Value

    Boolean result of deleting operation

  • Removes given Account object from given StorageClient

    Declaration

    Swift

    @discardableResult
    public func removeAccount(account: Account) -> Bool

    Parameters

    account

    Account object to be removed

    Return Value

    Boolean result of deleting operation

  • Lock the given Account object limiting the access to all Mechanism objects and any PushNotification objects associated with it.

    Throws

    AccountError

    Declaration

    Swift

    @discardableResult
    public func lockAccount(account: Account, policy: FRAPolicy) throws -> Bool

    Parameters

    account

    Account object to be locked

    policy

    The non-compliance policy

    Return Value

    Boolean result of lock operation

  • Unlock the given Account object

    Throws

    AccountError

    Declaration

    Swift

    @discardableResult
    public func unlockAccount(account: Account) throws -> Bool

    Parameters

    account

    Account object to be locked

    Return Value

    Boolean result of unlock operation

Mechanism

  • Retrieves a PushMechanism object with given PushNotification object

    Note: This getMechanism with PushNotification object does not retrieve all PushNotification object associated with PushMechanism. This only returns PushMechanism object without the array.

    Declaration

    Swift

    public func getMechanism(notification: PushNotification) -> PushMechanism?

    Parameters

    notification

    PushNotification object

    Return Value

    PushMechanism object for given PushNotification

  • Removes Mechanism object from StorageClient, and all associated PushNotification objects if needed

    Declaration

    Swift

    @discardableResult
    public func removeMechanism(mechanism: Mechanism) -> Bool

    Parameters

    mechanism

    Mechanism object to be removed

    Return Value

    boolean result of operation

Notification

  • Retrieves an array of PushNotification objects that is associated with given PushMechanism

    Declaration

    Swift

    public func getAllNotifications(mechanism: PushMechanism) -> [PushNotification]

    Parameters

    mechanism

    PushMechanism object to retrieve all notifications

    Return Value

    An array of PushNotification that given PushMechanism received

  • Retrieves an array of PushNotification objects across all PushMechanisms

    Declaration

    Swift

    public func getAllNotifications() -> [PushNotification]

    Parameters

    mechanism

    PushMechanism object to retrieve all notifications

    Return Value

    An array of PushNotification

  • Retrieves PushNotification object with given PushNotification Identifier; Identifier of PushNotification object is -

    Declaration

    Swift

    public func getNotification(identifier: String) -> PushNotification?

    Parameters

    identifier

    String value of PushNotification object’s identifier as in -

    Return Value

    PushNotification object with given identifier

  • Removes PushNotification object from StorageClient

    Declaration

    Swift

    @discardableResult
    public func removeNotification(notification: PushNotification) -> Bool

    Parameters

    notification

    PushNotification object to be removed

    Return Value

    boolean result of operation

QRCode parsing

  • Parses given QR Code URL into Account, and Mechanism object, and stores them into StorageClient if saving both Account and Mechanism objects was successful. If Account already exists, and QR Code is storing new Mechanism object, SDK only stores Mechanism object, and ignores Account object

    Declaration

    Swift

    public func createMechanismFromUri(uri: URL, onSuccess: @escaping MechanismCallback, onError: @escaping ErrorCallback)

    Parameters

    uri

    URL of QR Code

    onSuccess

    success completion callback with Mechanism

    onError

    failure callback with Error