Interface OutOfBandPayloadDecode
- All Superinterfaces:
Operation
The object that decodes an
OutOfBandPayload from a String
in JSON format or a base64 URL encoded String representing the JSON. The
OutOfBandPayload can be used to trigger an out-of-band operation (see
OutOfBandOperation).
Example:
private void decodeOutOfBandPayload(Operations operations, String json) {
operations.outOfBandPayloadDecode()
.json(json)
.onError(error -> {
// handle error
})
.onSuccess(outOfBandPayload -> {
// handle the OutOfBandPayload
})
.execute();
}
The JSON is obtained from a push notification, or as a base 64 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"
}
-
Method Summary
Modifier and TypeMethodDescriptionbase64UrlEncoded(String base64UrlEncoded) Specifies the JSON as base 64 URL to be decodedSpecifies the JSON to be decoded.onError(Consumer<OutOfBandPayloadError> errorConsumer) Specifies the object that will be invoked if theOutOfBandPayloadcould not be decoded.onSuccess(Consumer<OutOfBandPayload> outOfBandPayloadConsumer) Specifies the object that will be invoked if theOutOfBandPayloadwas decoded.
-
Method Details
-
json
Specifies the JSON to be decoded.Either the plain JSON or the JSON as base 64 URL (see
base64UrlEncoded(String)) must be provided.- Parameters:
json- the JSON- Returns:
- a
OutOfBandPayloadDecode
-
base64UrlEncoded
Specifies the JSON as base 64 URL to be decodedEither the plain JSON (see
json(String)or the JSON as base 64 URL must be provided.- Parameters:
base64UrlEncoded- the JSON encoded as a base 64 URLString- Returns:
- a
OutOfBandPayloadDecode
-
onError
Specifies the object that will be invoked if theOutOfBandPayloadcould not be decoded. The specified object will receive anOutOfBandPayloadError. This object will be invoked in the main/UI thread.Providing the object handling the error is required.
- Parameters:
errorConsumer- the consumer of anOutOfBandPayloadError- Returns:
- an
OutOfBandPayloadDecode
-
onSuccess
@NonNull OutOfBandPayloadDecode onSuccess(@NonNull Consumer<OutOfBandPayload> outOfBandPayloadConsumer) Specifies the object that will be invoked if theOutOfBandPayloadwas decoded. This object will be invoked in the main/UI thread.Providing the object handling the success is required.
- Parameters:
outOfBandPayloadConsumer- the consumer of anOutOfBandPayload- Returns:
- an
OutOfBandPayloadDecode
-