Consent
A composable used for obtaining consent when presenting one or more credentials.
Purpose Classification (classifyPurposesFn)
Consent evaluates the active credential selection using classifyPurposesFn, which returns a set of PresentmentPurposes:
Subtitle text: The classified purposes are localized and formatted into the purpose subtitle displayed under the relying party header (e.g., "is requesting your age", "is requesting your driving privileges and identity"). When multiple purposes are returned, they are joined into a localized list in enum declaration order. If an empty set is returned, a fallback unknown purpose phrase is shown.
Forwarded to risk assessment: The returned purposes set is forwarded directly as the
purposesargument to classifyRiskFn.
Defaults to defaultClassifyPurposes.
Risk Assessment (classifyRiskFn)
Consent evaluates the active credential selection and classified purposes using classifyRiskFn, which returns a ConsentRiskAssessment containing a ConsentRiskLevel and a set of ConsentRiskReasons.
Risk Levels
The evaluated ConsentRiskLevel governs the placement, visual styling, and confirmation safeguards of the RP-info box:
Placement & styling: Placed at the bottom of the scrollable content using a neutral surface container (no colored fill or border) with an info (
ⓘ) icon. When there is only a single use-case, the RP-info box is attached as the bottom segment of that use-case's segmented container group; when there are multiple use-cases, it appears as a standalone segmented container below all use-cases.Confirmation: The "Continue" button is immediately enabled without any cool-off delay.
Placement & styling: Placed at the top of the scrollable content (directly below the relying party header and above the credentials) in a yellow/amber warning box with a warning (
⚠) icon.Confirmation: The "Continue" button is immediately enabled without any cool-off delay.
Placement & styling: Placed at the top of the scrollable content (directly below the relying party header and above the credentials) in a red danger box with a warning (
⚠) icon.Confirmation: Enforces a 5-second cool-off timer on the primary button ("Wait..." transitioning to "Continue"). The user must scroll to the bottom of the prompt before the timer begins.
Risk Reasons
Any ConsentRiskReasons in ConsentRiskAssessment.reasons generate corresponding explanatory copy inside the RP-info box (or warning/danger box):
ConsentRiskReason.UNTRUSTED_REQUESTER: Displays copy indicating that the relying party is unknown or not in the wallet's trust list. (Rendered as informational copy in the bottom RP-info container when risk level is ConsentRiskLevel.NORMAL, or as a warning when ConsentRiskLevel.WARNING or ConsentRiskLevel.HIGH_RISK).
ConsentRiskReason.ANONYMOUS_REQUESTER: Displays copy indicating that the relying party is anonymous (did not provide a digital signature or certificate). (Rendered as informational copy in the bottom RP-info container when risk level is ConsentRiskLevel.NORMAL, or as a warning when ConsentRiskLevel.WARNING or ConsentRiskLevel.HIGH_RISK).
ConsentRiskReason.UNUSUAL_REQUEST: Displays an alert that the requested claims are unrecognized, over-broad, or not accounted for by standard schemas or purpose hints.
ConsentRiskReason.PII_REQUESTED: Displays an alert that personally identifiable information has been requested.
ConsentRiskReason.UNTRUSTED_ENCRYPTION_TARGET: Displays an alert that parts of the response are requested to be encrypted for a recipient not in the trust list.
ConsentRiskReason.INTENT_TO_RETAIN: Displays an alert that the requester intends to store or retain the disclosed data.
ConsentRiskReason.TRANSACTION_DATA: Displays an alert that the request authorizes a transaction.
In addition to reason-specific alerts, the RP-info box displays share history (first-time vs. returning share, if requesterHistory is provided), a link to the relying party's privacy policy (if available), and any TrustMetadata.disclaimer.
Defaults to defaultClassifyRisk.
Parameters
a Modifier.
the relying party which is requesting the data.
conveys the level of trust in the requester, if any.
the combinations of credentials and claims that the user can select.
the list of documents the user may have preselected earlier (for example an OS-provided credential picker like Android's Credential Manager) or the empty list if the user didn't preselect.
a ImageLoader.
the TransactionDataRendererRepository to find renderers for transaction data in, or null to use only the built-in rendering.
an optional RequesterHistory used to query whether the user has shared credentials with requester before.
function used to classify the PresentmentPurposes of the request.
function used to evaluate the ConsentRiskAssessment of the request.
called with the documents currently selected for the user, including when first shown. If the user selects a different set of documents in the prompt, this will be called again.
called when the user presses the "Continue" button, returns the user's selection.
called when the sheet is dismissed.