Skip to content
  • David Zeuthen's avatar
    Rework presentment. (#1510) · 967f391b
    David Zeuthen authored
    
    
    This is a large PR which touches a lot of code.
    
    Get rid of `PresentmentMechanism` and `PresentmentModel` and instead make
    the presentment mechanisms available via simple suspend functions:
    
    - `digitalCredentialsPresentment()` for W3C Digital Credentials presentment
    - `uriSchemePresentment()` for OpenID4VP 1.0 URI Scheme presentment
    - `Iso18013Presentment()` for ISO/IEC 18013-5:2021 proximity presentment.
    
    Also introduce a new `PresentmentModel` which can be used for coupling
    the mechanism with the UI/UX. Introduce `PresentmentActivity` with
    nice UI and animations and use this for both NFC and QR engagement and
    include it in the `AndroidManifest.xml` file for the library.
    
    Beef up `PromptModel` so UIs can track if prompts are currently
    showing. This is used in `PresentmentActivity` for moving the card to
    the top when this is so. Add `PromptDialogModel.waitUntilBound()`
    which is needed by `PresentmentActivity` to wait until the activity is
    up and running.
    
    Add `PromptModel.requestConsent()` to show consent screens and
    `ShowConsentPromptFn` as a typealias with actual implementations
    `promptModelSilentConsent()` and `promptModelRequestConsent()` where
    the latter calls into `PromptModel.requestConsent()`. Make
    `PresentmentSource` take a `ShowConsentPromptFn` so the application
    has full control of where the consent moment happens.
    
    Minor UI improvements in the Consent prompt.
    
    Introduce new `Branding` object so the application can specify which
    theme, app icon, and application name to use in various UI elements in
    the library (for example, the consent prompt), and missing card
    art. Add example use of this in Test App with a Lime Green theme which
    can be set on the Settings screen.
    
    Mark `buildXyz()` functions as inline so they work both from suspend
    and normal contexts.
    
    Make proximity presentment _always_ wait for the reader to end the
    session, instead of sending the session termination along with the
    response. This fixes a long-standing problem where connections are
    closed too early which we worked around by long timeouts on e.g. L2CAP
    sockets (causing other problems). This behavior is also recommended in
    the latest ISO/IEC 18013-5 Second Edition drafts.
    
    Fix compilation on iOS.
    
    Test: Unit tests.
    Test: Manually tested on Android and iOS.
    
    Signed-off-by: default avatarDavid Zeuthen <zeuthen@google.com>
    967f391b
This project manages its dependencies using Yarn. Learn more
Loading