NMAOutOfBandOperation

@objc
public protocol NMAOutOfBandOperation : NMAHttpOperation

The operation managing an NMAOutOfBandPayload. An NMAOutOfBandPayload can be provided through different means: a push notification, a QR code or an application link. This operation will process the payload, decrypt it if needed and send it to the server. If the payload is successfully handled by the server, then the SDK will identify whether the operation associated with the payload is a registration or an authentication. Depending on that the onRegistration(_:) or the onAuthentication(_:) will be invoked.

Usage example:

id<NMAOutOfBandOperation> oobOperation = [[client operations] outOfBandOperation];
[oobOperation payload:payload];
[oobOperation onRegistration:^(id<NMAOutOfBandRegistration> _Nonnull registration) {...}];
[oobOperation onAuthentication:^(id<NMAOutOfBandAuthentication> _Nonnull authentication) {...}];
[oobOperation onError:^(NMAOutOfBandOperationError * _Nonnull error) {...}];
[oobOperation execute];
  • Specifies the out-of-band payload to be handled.

    Important

    Providing the out-of-band payload is required.

    Declaration

    Swift

    @discardableResult
    func payload(_ payload: NMAOutOfBandPayload) -> NMAOutOfBandOperation

    Parameters

    payload

    Return Value

    the NMAOutOfBandOperation builder.

  • Specifies the block that will handle the NMAOutOfBandRegistration object associated with the NMAOutOfBandPayload.

    Important

    Providing at least one of the onRegistration or onAuthentication block is required.

    Declaration

    Swift

    @discardableResult
    func onRegistration(_ onRegistration: @escaping (NMAOutOfBandRegistration) -> ()) -> NMAOutOfBandOperation

    Parameters

    onRegistration

    the block to execute in case of registration.

    Return Value

    the NMAOutOfBandOperation builder.

  • Specifies the block that will handle the NMAOutOfBandAuthentication object associated with the NMAOutOfBandPayload.

    Important

    Providing at least one of the onRegistration or onAuthentication block is required.

    Declaration

    Swift

    @discardableResult
    func onAuthentication(_ onAuthentication: @escaping (NMAOutOfBandAuthentication) -> ()) -> NMAOutOfBandOperation

    Parameters

    onAuthentication

    the block to execute in case of authentication.

    Return Value

    the NMAOutOfBandOperation builder.

  • Specifies the block to execute if there was an error handling the NMAOutOfBandPayload: The payload could not be decrypted, the server could not be reached, the server returned an error, etc.

    Important

    Providing the onError block is required.

    Declaration

    Swift

    @discardableResult
    func onError(_ onError: @escaping (NMAOutOfBandOperationError) -> ()) -> NMAOutOfBandOperation

    Parameters

    onError

    the block to execute on failed operation, receives an NMAOutOfBandOperationError.

    Return Value

    the NMAOutOfBandOperation builder.