Skip to content

Show AP2 spending permissions in the consent prompt. - #48

Draft
TheBlackBit wants to merge 1 commit into
openwallet-foundation:mainfrom
TheBlackBit:feat/ap2-delegate-consent
Draft

TheBlackBit wants to merge 1 commit into
openwallet-foundation:mainfrom
TheBlackBit:feat/ap2-delegate-consent

Conversation

@TheBlackBit

@TheBlackBit TheBlackBit commented Nov 9, 2026 •

Copy link
Copy Markdown

Draft: depends on openwallet-foundation/multipaz#2178 and openwallet-foundation/multipaz#2196. CI fails until both are merged and a new snapshot is published.

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.kt and ViewModel.swift add the type with addDelegateTransactionType(), since the utopia types leave it out, and pass walletTransactionDataRenderers to promptModelRequestConsent().
  • WalletTransactionDataRenderers (Kotlin and Swift) registers DelegateTransactionRendererCompose and DelegateTransactionRendererSwiftUi for delegate.
  • The screen itself now lives in the SDK: limits in large text, then merchant, items, expiry and agent, with every mandate in full on "View details".

Testing

@dzuluaga dzuluaga left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 dzuluaga self-assigned this Nov 13, 2026
@dzuluaga dzuluaga moved this to In progress in CredentAgent Nov 13, 2026
@dzuluaga dzuluaga assigned TheBlackBit and unassigned dzuluaga Nov 13, 2026

@dzuluaga dzuluaga left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL @ my last comment.

@TheBlackBit

Copy link
Copy Markdown
Author

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 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants