Repository navigation
Show AP2 spending permissions in the consent prompt. - #48
TheBlackBit wants to merge 1 commit into
Conversation
c9817b8 to
2afb035
Compare
dzuluaga
left a comment
There was a problem hiding this comment.
Thanks Ever. The screen itself reads well, and showing every mandate in full on the details page is the right call.
My concern is where the code lives. This is about 590 lines of UI across Android and iOS for one transaction type. The sample app renders payment, transit fare and prescription pickup in 126 lines total. Nothing here is specific to this wallet, and it's written twice.
Could the screen move into the SDK as the default renderer for delegate (multipaz-compose and multipaz-swiftui)? This PR would then be about ten lines: register the type and its default renderer. A wallet that wants its own look could still pass one.
A few specifics:
- Icons are picked by comparing English labels (
"At","Paid to","For") in both files. The SDK should expose the kind of each row so nothing depends on wording. - The Swift strings are hard-coded; Android uses resources.
- There are no iOS tests, and it hasn't run on a device against a live AP2 request yet.
- If resolving the mandates fails, the block renders empty. For a spending approval I'd rather it show an error than nothing.
dzuluaga
left a comment
There was a problem hiding this comment.
PTAL @ my last comment.
@dzuluaga agreed, nothing here is specific to this wallet. I’ll move the screen into the SDK as the default renderer for delegate, in multipaz-compose and multipaz-swiftui, in a separate PR on top of openwallet-foundation/multipaz#2178 · Support AP2 spending mandates…. This PR then only registers the type with that renderer. |
A request carrying AP2 `delegate` transaction data asks the person to let an agent spend for them later, unattended. The SDK's consent prompt would show only a heading for it. The wallet now registers the type together with the SDK's default renderer for it, on Android and iOS: the prompt shows the spending limits set large, then the merchant, the items, the expiry and the agent, and "View details" lists every mandate in full, as AP2 requires. `addUtopiaTypes()` leaves the type out, so `App` and the iOS `ViewModel` add it with `addDelegateTransactionType()`, and pass `walletTransactionDataRenderers`, which holds `DelegateTransactionRendererCompose` on Android and `DelegateTransactionRendererSwiftUi` on iOS, to `promptModelRequestConsent()`. This needs those renderers and `addDelegateTransactionType()`, which are not in a Multipaz release or snapshot yet. They are on the SDK branch feat/ap2-delegate-renderer, on top of feat/ap2-delegate-transaction-utopia. Test: ./gradlew :androidApp:testDebugUnitTest (38 tests, including WalletTransactionDataRenderersTest), :androidApp:assembleDebug and :androidApp:lintDebug, against that SDK branch published to mavenLocal as 0.103.0-SNAPSHOT. On iOS, the registration was type-checked with swiftc against the Multipaz framework built from that branch. The iOS app was not built: this host has Xcode 27.2, and Multipaz needs the iOS 27.3 SDK. Signed-off-by: Ever Morales <ever.morales@koombea.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2afb035 to
5a4b3df
Compare
Summary
With AP2, a website can ask the wallet to let an AI agent spend for the person later, within limits they approve once. On its own, the consent prompt would show only a heading for this request. The wallet now registers the type with the SDK's default renderer for it (openwallet-foundation/multipaz#2196), on Android and iOS.
Changes
App.ktandViewModel.swiftadd the type withaddDelegateTransactionType(), since the utopia types leave it out, and passwalletTransactionDataRendererstopromptModelRequestConsent().WalletTransactionDataRenderers(Kotlin and Swift) registersDelegateTransactionRendererComposeandDelegateTransactionRendererSwiftUifordelegate.Testing
./gradlew :androidApp:testDebugUnitTest(38 tests, includingWalletTransactionDataRenderersTest),:androidApp:assembleDebugand:androidApp:lintDebug, against Draw AP2 spending permissions with default renderers in the SDK. multipaz#2196 published to mavenLocal.WalletTransactionDataRenderers.swiftand the registration type-checked withswiftcagainst the Multipaz framework built from Draw AP2 spending permissions with default renderers in the SDK. multipaz#2196. The app wasn't built (my Xcode is 27.2; Multipaz needs the iOS 27.3 SDK).