OutOfBandPayloadDecode

public protocol OutOfBandPayloadDecode : Operation

The object that decodes an OutOfBandPayload from a String in JSON format or a Base64 URL encoded {@code String} representing the JSON. The OutOfBandPayload can be used to trigger an out-of-band operation OutOfBandOperation.

Usage example:

client.operations.outOfBandPayloadDecode
    .json(jsonPayload)
    .onSuccess { outOfBandPayload in
        ...
    }
    .onError { error in
        ...
    }
    .execute()

The JSON is obtained from a push notification, or as a Base64 URL encoded JSON in QR codes generated by the server. JSON example:

{
    "nma_data" : {
        "token" : "b4b07559-f934-4597-a1c5-44d89f691e8f",
        "redeem_url" : "https://fido.siven.ch/nevisfido/token/redeem/authentication",
        "attributeName" : "some additional data to be included in the QR code"
    },
    "nma_data_content_type" : "application/json",
    "nma_data_version" : "1"
}
  • Specifies the JSON to be decoded.

    Important

    You must provide either the JSON through this method, or the Base64 URL encoded representation of the JSON with the base64UrlEncoded(_:) method. Only one of them can be provided.

    Declaration

    Swift

    @discardableResult
    func json(_ json: String) -> OutOfBandPayloadDecode

    Parameters

    json

    the JSON.

    Return Value

    the OutOfBandPayloadDecode builder.

  • Specifies the JSON as Base64 URL encoded String to be decoded.

    Important

    You must provide either the Base64 URL encoded representation of the JSON through this method, or the JSON itself with the json(_:) method. Only one of them can be provided.

    Declaration

    Swift

    @discardableResult
    func base64UrlEncoded(_ base64UrlEncoded: String) -> OutOfBandPayloadDecode

    Parameters

    base64UrlEncoded

    the JSON encoded as a Base64 URL encoded String.

    Return Value

    the OutOfBandPayloadDecode builder.

  • Specifies the block to execute if the OutOfBandPayload was decoded. This object will be invoked in the DispatchQueue.main thread.

    Important

    Providing the onSuccess block is required.

    Declaration

    Swift

    @discardableResult
    func onSuccess(_ onSuccess: @escaping (OutOfBandPayload) -> ()) -> OutOfBandPayloadDecode

    Parameters

    onSuccess

    the block to execute on successful payload decode, receives an OutOfBandPayload.

    Return Value

    the OutOfBandPayloadDecode builder.

  • Specifies the block to execute if the OutOfBandPayload could not be decoded. This object will be invoked in the DispatchQueue.main thread.

    Important

    Providing the onError block is required.

    Declaration

    Swift

    @discardableResult
    func onError(_ onError: @escaping (OutOfBandPayloadError) -> ()) -> OutOfBandPayloadDecode

    Parameters

    onError

    the block to execute on failed payload decode, receives an OutOfBandPayloadError.

    Return Value

    the OutOfBandPayloadDecode builder.