Skip to content

feat(FGI-2846): Adds helper method to construct challenge-response - #216

Draft
sam-muncke wants to merge 6 commits into
masterfrom
FGI-2846
Draft

sam-muncke wants to merge 6 commits into
masterfrom
FGI-2846

Conversation

@sam-muncke

@sam-muncke sam-muncke commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Exposes the SDK's existing challenge-response signing so apps can build the signed challenge_response JWT for a push transaction without the SDK sending it. This lets another backend resolve the transaction on the app's behalf, for example when a push notification approves an Auth0 consent through the My Account API.

  • GuardianAPIClient.createAccessApprovalJWT is renamed to constructChallengeResponse and made public. The caller supplies the audience URL, since it depends on which service verifies the response. The existing resolve path still passes <baseUrl>/api/resolve-transaction.
  • Guardian.constructChallengeResponse(Uri url, Enrollment enrollment, String challenge, boolean accepted, @Nullable String reason) is a convenience wrapper that uses the enrollment's device identifier and signing key.
  • The JWT construction is unchanged, allow() / reject() behave as before.

References

Testing

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not the default branch

sam-muncke and others added 6 commits October 13, 2026 14:01
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…ing it

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
* @throws GuardianException when signing with private key fails
*/
@NonNull
public String constructChallengeResponse(@NonNull Uri url,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One issue I see is that a caller doing this would compile guardian.constructChallengeResponse(url, enrollment, challenge, true, "some reason"); which is wouldn't make sense since reason only applies to rejections. It's not a big deal since reason would simply be ignored but we could try to avoid that. We are also forced to pass null as the final param when approved

To avoid that I think we could follow the overload pattern used above, so we could have something like:

public String constructAllowChallengeResponse(Uri url, Enrollment enrollment, String challenge)
public String constructRejectChallengeResponse(Uri url, Enrollment enrollment, String challenge, @Nullable String reason)
public String constructRejectChallengeResponse(Uri url, Enrollment enrollment, String challenge)

* @return the signed challenge response
* @throws GuardianException when signing with private key fails
*/
public String constructChallengeResponse(@NonNull PrivateKey privateKey,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a reason for this to be public?

This branch has not been deployed

No deployments
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