Class WebAPITransfer
-
- All Implemented Interfaces:
-
com.scytales.mvalid.sdk.engagement.DeviceEngagementDependent
,com.scytales.mvalid.sdk.retrieval.Timeoutable
,com.scytales.mvalid.sdk.retrieval.Transfer
,com.scytales.mvalid.sdk.retrieval.TransferProgressListenable
,com.scytales.mvalid.sdk.retrieval.TransferReceiveDependent
public final class WebAPITransfer implements Transfer<D>, TransferProgressListenable, TransferReceiveDependent, DeviceEngagementDependent, Timeoutable
Transfer implementation requests data from Issuer Authority using DeviceEngagement.ServerRetrievalMethods.WebAPI if in DeviceEngagement.
public class SomeActivity extends
implements DeviceEngagementCallback, TransferReceiveCallback, TransferProgressListener { private Map<String, Map<String, Map<String, Boolean>>> docRequests = ... @Override public void onEngage(@NonNull Received<EngagementReceived> engagementReceived) { engagementReceived.run( failure -> {androidx.appcompat.app.AppCompatActivity
.e(TAG, failure.toString()); }, success -> { DeviceEngagement deviceEngagement = success.getDeviceEngagement(); Handover handover = success.getHandover(); try { Request request = Request.createForServerOnly(docRequests, deviceEngagement); byte[] requestBytes = request.getServerRequestData(); WebAPITransfer webAPITransfer = new WebAPITransfer(); webAPITransfer.forDeviceEngagement(deviceEngagement); webAPITransfer.setTransferReceiveCallback(this); webAPITransfer.setProgressListener(this); webAPITransfer.send(requestBytes); } catch (SDKException e) {android.util.Log
.e(TAG, e.getMessage(), e); } }); } @Override public void onProgressEvent(@NonNull TransferProgressEvent event) {android.util.Log
.i(TAG, event.toString()); } @Override public void onReceive(@NonNull Received<TransferReceived> transferReceived) { transferReceived.run( failure -> {android.util.Log
.e(TAG, failure.toString()); }, success -> { success.runForServer(receivedBytes -> { // do stuff with receivedBytes }); }); } }android.util.Log
-
-
Field Summary
Fields Modifier and Type Field Description public volatile int
readTimeout
public volatile int
connectionTimeout
-
Constructor Summary
Constructors Constructor Description WebAPITransfer()
Instantiates a new Web api transfer.
-
Method Summary
Modifier and Type Method Description int
getReadTimeout()
Gets read timeout. WebAPITransfer
setReadTimeout(int readTimeoutInMillis)
Sets read timeout. int
getConnectionTimeout()
Gets connection timeout. WebAPITransfer
setConnectionTimeout(int connectionTimeoutInMillis)
Sets connection timeout. WebAPITransfer
forDeviceEngagement(@NonNull() DeviceEngagement deviceEngagement)
For device engagement device engagement dependent. WebAPITransfer
setTransferProgressListener(@NonNull() TransferProgressListener transferProgressListener)
Sets transfer progress listener. WebAPITransfer
unsetTransferProgressListener()
Unset transfer progress listener transfer progress listenable. WebAPITransfer
setTransferReceiveCallback(@NonNull() TransferReceiveCallback callback)
Sets transfer receive callback. WebAPITransfer
trustAllCertificates(boolean status)
Should be used only for testing. void
send(@NonNull() Request request)
Send. WebAPITransfer
setTimeout(int timeoutInMillis)
Sets timeout. -
-
Method Detail
-
getReadTimeout
int getReadTimeout()
Gets read timeout.
-
setReadTimeout
WebAPITransfer setReadTimeout(int readTimeoutInMillis)
Sets read timeout.
- Parameters:
readTimeoutInMillis
- the read timeout in millis
-
getConnectionTimeout
int getConnectionTimeout()
Gets connection timeout.
-
setConnectionTimeout
WebAPITransfer setConnectionTimeout(int connectionTimeoutInMillis)
Sets connection timeout.
- Parameters:
connectionTimeoutInMillis
- the connection timeout in millis
-
forDeviceEngagement
WebAPITransfer forDeviceEngagement(@NonNull() DeviceEngagement deviceEngagement)
For device engagement device engagement dependent.
- Parameters:
deviceEngagement
- the device engagement
-
setTransferProgressListener
@NonNull() WebAPITransfer setTransferProgressListener(@NonNull() TransferProgressListener transferProgressListener)
Sets transfer progress listener.
-
unsetTransferProgressListener
@NonNull() WebAPITransfer unsetTransferProgressListener()
Unset transfer progress listener transfer progress listenable.
-
setTransferReceiveCallback
@NonNull() WebAPITransfer setTransferReceiveCallback(@NonNull() TransferReceiveCallback callback)
Sets transfer receive callback.
- Parameters:
callback
- the callback
-
trustAllCertificates
@NonNull() WebAPITransfer trustAllCertificates(boolean status)
Should be used only for testing.
- Parameters:
status
- if true, all certificates are trusted
-
setTimeout
WebAPITransfer setTimeout(int timeoutInMillis)
Sets timeout.
- Parameters:
timeoutInMillis
- the timeout in millis
-
-
-
-