NMAOutOfBandPayloadDecode

@objc
public protocol NMAOutOfBandPayloadDecode : NMAOperation

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

Usage example:

id<NMAOutOfBandPayloadDecode> oobPayloadDecode = [[client operations] outOfBandPayloadDecode];
[oobPayloadDecode json:jsonPushNotification]];
[oobPayloadDecode onSuccess:^(NMAOutOfBandPayload * _Nonnull oobPayload) {
    // Payload is returned by the SDK.
}];
[oobPayloadDecode onError:^(NMAOutOfBandPayloadError * _Nonnull error) {...}];
[oobPayloadDecode 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) -> NMAOutOfBandPayloadDecode

    Parameters

    json

    the JSON.

    Return Value

    the NMAOutOfBandPayloadDecode 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) -> NMAOutOfBandPayloadDecode

    Parameters

    base64UrlEncoded

    the JSON encoded as a Base64 URL encoded String.

    Return Value

    the NMAOutOfBandPayloadDecode builder.

  • Specifies the block to execute if the NMAOutOfBandPayload was decoded.

    Important

    Providing the onSuccess block is required.

    Declaration

    Swift

    @discardableResult
    func onSuccess(_ onSuccess: @escaping (NMAOutOfBandPayload) -> ()) -> NMAOutOfBandPayloadDecode

    Parameters

    onSuccess

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

    Return Value

    the NMAOutOfBandPayloadDecode builder.

  • Specifies the block to execute if the NMAOutOfBandPayload could not be decoded.

    Important

    Providing the onError block is required.

    Declaration

    Swift

    @discardableResult
    func onError(_ onError: @escaping (NMAOutOfBandPayloadError) -> ()) -> NMAOutOfBandPayloadDecode

    Parameters

    onError

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

    Return Value

    the NMAOutOfBandPayloadDecode builder.