identity: Add multi-document presentation support.
This new IPresentationSession interface enables an application to do a
multi-document presentation, something which isn't possible with the
existing API. As a practical example of this consider presenting both
your Mobile Driving License and your Vaccination Certificate in a single
transaction.
Bug: 197965513
Test: New CTS tests and new screen in CtsVerifier
Change-Id: I11712dca35df7f1224debf454731bc17ea9bfb37
diff --git a/identity/aidl/default/common/IdentityCredential.h b/identity/aidl/default/common/IdentityCredential.h
index ef9d133..2935fb8 100644
--- a/identity/aidl/default/common/IdentityCredential.h
+++ b/identity/aidl/default/common/IdentityCredential.h
@@ -30,6 +30,7 @@
#include <cppbor.h>
#include "IdentityCredentialStore.h"
+#include "PresentationSession.h"
#include "SecureHardwareProxy.h"
namespace aidl::android::hardware::identity {
@@ -46,11 +47,11 @@
class IdentityCredential : public BnIdentityCredential {
public:
IdentityCredential(sp<SecureHardwareProxyFactory> hwProxyFactory,
- sp<SecureHardwarePresentationProxy> hwProxy,
- const vector<uint8_t>& credentialData)
+ const vector<uint8_t>& credentialData,
+ std::shared_ptr<PresentationSession> session)
: hwProxyFactory_(hwProxyFactory),
- hwProxy_(hwProxy),
credentialData_(credentialData),
+ session_(std::move(session)),
numStartRetrievalCalls_(0),
expectedDeviceNameSpacesSize_(0) {}
@@ -94,10 +95,13 @@
bool includeChallenge,
vector<uint8_t>* outProofOfDeletionSignature);
+ // Creates and initializes hwProxy_.
+ ndk::ScopedAStatus ensureHwProxy();
+
// Set by constructor
sp<SecureHardwareProxyFactory> hwProxyFactory_;
- sp<SecureHardwarePresentationProxy> hwProxy_;
vector<uint8_t> credentialData_;
+ shared_ptr<PresentationSession> session_;
int numStartRetrievalCalls_;
// Set by initialize()
@@ -105,6 +109,9 @@
bool testCredential_;
vector<uint8_t> encryptedCredentialKeys_;
+ // Set by ensureHwProxy()
+ sp<SecureHardwarePresentationProxy> hwProxy_;
+
// Set by createEphemeralKeyPair()
vector<uint8_t> ephemeralPublicKey_;