Repository navigation
feat(FGI-2846): Adds helper method to construct challenge-response - #216
Draft
sam-muncke wants to merge 6 commits into
Draft
sam-muncke wants to merge 6 commits into
sam-muncke wants to merge 6 commits into
Conversation
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>
4 tasks done
seand52
reviewed
Dec 3, 2026
| * @throws GuardianException when signing with private key fails | ||
| */ | ||
| @NonNull | ||
| public String constructChallengeResponse(@NonNull Uri url, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Is there a reason for this to be public?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Exposes the SDK's existing challenge-response signing so apps can build the signed
challenge_responseJWT 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.createAccessApprovalJWTis renamed toconstructChallengeResponseand 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.allow()/reject()behave as before.References
Testing
Checklist