Skip to content

Add delegation_type support to OpenID4VP presentation matcher - #215

Open
danieljkim1 wants to merge 1 commit into
android:wasmfrom
danieljkim1:wasm-pr-delegation
Open

Add delegation_type support to OpenID4VP presentation matcher#215
danieljkim1 wants to merge 1 commit into
android:wasmfrom
danieljkim1:wasm-pr-delegation

Conversation

@danieljkim1

@danieljkim1 danieljkim1 commented Jul 28, 2026

Copy link
Copy Markdown

This PR adds support for provider delegation_type in the OpenID4VP presentation matcher (matcher-rs).

Summary of Changes:

  • bindings.rs: Declared SetDelegationTypeForEntryInSet FFI function imported from the Android Credential Manager host runtime.
  • openid4vp_models.rs: Defined DelegationType enum (None = 0, Full = 1) with nanoserde::DeJson deserialization (defaulting to None), and added pub delegation_type: DelegationType to RegistryCredential and MatchedCredential.
  • credman.rs: Updated add_entry_to_set and add_payment_entry_to_set_v2 to accept delegation_type: DelegationType, and invoke SetDelegationTypeForEntryInSet gated by if self.get_wasm_version() >= 7 && delegation_type != DelegationType::None.
  • dcql.rs & reporter.rs: Propagated candidate.delegation_type through DCQL matching to reporter.rs when populating presentation entrySet items (both standard verification entries and payment entries) via credman.add_entry_to_set(...) and credman.add_payment_entry_to_set_v2(...).
  • Unit Tests: Added test cases for DelegationType deserialization in openid4vp_models.rs, standard entry reporting with delegation in reporter.rs, and payment entry reporting with delegation in reporter.rs.

TAG=agy

CONV=0b44330c-f824-447d-83ba-c4685a5977a5

@danieljkim1 danieljkim1 changed the title Add multi-provider delegation support in OpenID4VP WASM matcher Add delegation_type support to OpenID4VP presentation matcher Jul 29, 2026
@danjkim

danjkim commented Jul 29, 2026

Copy link
Copy Markdown

Btw, not ready for review yet.

danieljkim1 added a commit to danieljkim1/identity-samples that referenced this pull request Jul 31, 2026
danieljkim1 added a commit to danieljkim1/identity-samples that referenced this pull request Jul 31, 2026
@danjkim

danjkim commented Aug 5, 2026

Copy link
Copy Markdown

Ready for review

@cy245
cy245 requested a review from QZHelen August 5, 2026 13:36

@QZHelen QZHelen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you rebase and make sure only delegation_type related changes are included in this PR?

@danjkim
danjkim force-pushed the wasm-pr-delegation branch from 66f5973 to a41a554 Compare August 5, 2026 21:37
@danjkim

danjkim commented Aug 5, 2026

Copy link
Copy Markdown

Can you rebase and make sure only delegation_type related changes are included in this PR?

Done!

set_index: i32,
delegation_type: i32,
);
fn set_delegation_type_for_entry_in_set(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you need to additionally expose this API? Will the update to add_entry_to_set suffice?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

removed set_delegation_type_for_entry_in_set to use add_entry_to_set only

field_display_value.to_string(),
));
}
fn add_payment_entry_to_set_v2(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Have you made sure that the same support also work for when there's a Payment credential involved?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Haven't verified for payment credential. Did you want to include support for the payment credential as well?

set_id_c.as_ptr(),
set_index,
);
if delegation_type != 0 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Check the wasm version to safely make this call. If the wasm version returns a lower version than when the support is added, invoking this method will cause the the wasm to fail, unable to find the exported wasm function

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

done

id,
matched: vec![MatchedCredential {
id,
delegation_type: 0,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

0 is used as a magic number in multiple places to represent delegation type none. At minimum, make it a constant, or ideally it should be a typed enum.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are there any tests added that test the behavior of non-zero delegation type?

@QZHelen
QZHelen requested a review from netheril96 August 7, 2026 17:33
metadata: &str,
set_id: &str,
set_index: i32,
delegation_type: i32,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How are we handling old GMSCore versions where the function signature is different?

- Define DelegationType enum (None = 0, Full = 1) with DeJson deserialization
- Check get_wasm_version() >= 7 before calling SetDelegationTypeForEntryInSet in add_entry_to_set and add_payment_entry_to_set_v2
- Propagate delegation_type through DCQL to reporter for standard and payment entries
- Add unit tests for DelegationType in openid4vp_models and reporter
@QZHelen
QZHelen self-requested a review August 12, 2026 00:34
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.

4 participants