Package com.android.identity
Class DeviceRequestGenerator
- java.lang.Object
-
- com.android.identity.DeviceRequestGenerator
-
public final class DeviceRequestGenerator extends java.lang.ObjectHelper class for buildingDeviceRequestCBOR as specified in ISO/IEC 18013-5 section 8.3 Device Retrieval.This class supports requesting data for multiple documents in a single presentation.
-
-
Constructor Summary
Constructors Constructor Description DeviceRequestGenerator()Constructs a newDeviceRequestGenerator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeviceRequestGeneratoraddDocumentRequest(java.lang.String docType, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>> itemsToRequest, java.util.Map<java.lang.String,byte[]> requestInfo, java.security.Signature readerKeySignature, java.util.Collection<java.security.cert.X509Certificate> readerKeyCertificateChain)Adds a request for a document and which data elements to request.byte[]generate()Builds theDeviceRequestCBOR.DeviceRequestGeneratorsetSessionTranscript(byte[] encodedSessionTranscript)Sets the bytes of theSessionTranscriptCBOR.
-
-
-
Constructor Detail
-
DeviceRequestGenerator
public DeviceRequestGenerator()
Constructs a newDeviceRequestGenerator.
-
-
Method Detail
-
setSessionTranscript
@NonNull public DeviceRequestGenerator setSessionTranscript(@NonNull byte[] encodedSessionTranscript)
Sets the bytes of theSessionTranscriptCBOR. This must be called if any of the document requests use reader authentication.- Parameters:
encodedSessionTranscript- the bytes ofSessionTranscript.- Returns:
- the
DeviceRequestGenerator.
-
addDocumentRequest
@NonNull public DeviceRequestGenerator addDocumentRequest(@NonNull java.lang.String docType, @NonNull java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>> itemsToRequest, @Nullable java.util.Map<java.lang.String,byte[]> requestInfo, @Nullable java.security.Signature readerKeySignature, @Nullable java.util.Collection<java.security.cert.X509Certificate> readerKeyCertificateChain)
Adds a request for a document and which data elements to request.- Parameters:
docType- the document type.itemsToRequest- the items to request as a map of namespaces into data element names into the intent-to-retain for each data element.requestInfo-nullor additional information provided. This is a map from keys and the values must be valid CBOR.readerKeySignature-nullif not signing the request, otherwise aSignatureto be used for signing the request.readerKeyCertificateChain-nullifreaderKeySignatureisnull, otherwise a chain of X.509 certificates forreaderKey.- Returns:
- the
DeviceRequestGenerator.
-
generate
@NonNull public byte[] generate()
Builds theDeviceRequestCBOR.- Returns:
- the bytes of
DeviceRequestCBOR.
-
-