Skip to content

Identity add holder issuance snippets#872

Merged
yrezgui merged 7 commits intomainfrom
identity_add_holder_issuance
Apr 17, 2026
Merged

Identity add holder issuance snippets#872
yrezgui merged 7 commits intomainfrom
identity_add_holder_issuance

Conversation

@cy245
Copy link
Copy Markdown
Contributor

@cy245 cy245 commented Apr 16, 2026

No description provided.

@cy245 cy245 requested review from kkuan2011 and yrezgui as code owners April 16, 2026 19:55
@snippet-bot
Copy link
Copy Markdown

snippet-bot Bot commented Apr 16, 2026

Here is the summary of changes.

You are about to add 4 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Credential Manager implementation by modularizing digital credential dependencies and introducing support for credential issuance registration and password-based sign-in. The review feedback identifies a compilation error due to a missing parenthesis in the issuance registration logic, recommends replacing unsafe non-null assertions with safe calls to prevent potential crashes, and suggests removing redundant object wrapping and unnecessary coroutine scopes to improve code clarity and efficiency.

// [START android_identity_handle_issuance_create_option_selected]
val pendingIntentRequest = PendingIntentHandler.retrieveProviderCreateCredentialRequest(intent)
val request = pendingIntentRequest!!.callingRequest
if (request is CreateDigitalCredentialRequest) {
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.

medium

The use of the non-null assertion operator (!!) is unsafe here. If retrieveProviderCreateCredentialRequest returns null, the application will crash. Using a safe call (?.) is recommended to prevent potential NullPointerExceptions.

Suggested change
if (request is CreateDigitalCredentialRequest) {
val request = pendingIntentRequest?.callingRequest

Comment on lines +220 to +223
resultData,
CreateDigitalCredentialResponse(response.responseJson)
)
setResult(RESULT_OK, resultData)
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.

medium

The response parameter is already an instance of CreateDigitalCredentialResponse. Re-wrapping it in a new CreateDigitalCredentialResponse object is redundant and inefficient.

Suggested change
resultData,
CreateDigitalCredentialResponse(response.responseJson)
)
setResult(RESULT_OK, resultData)
PendingIntentHandler.setCreateCredentialResponse(
resultData,
response
)

Comment on lines +150 to +160
coroutineScope {
try {
val result = credentialManager.getCredential(
context = activityContext,
request = credentialRequest
)
handlePasswordSignIn(result)
} catch (e: GetCredentialException) {
// Handle failure
}
}
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.

medium

The coroutineScope builder is redundant here as there is only a single block of suspending code and no concurrent operations are being launched. Removing it simplifies the code without changing its behavior.

            try {
                val result = credentialManager.getCredential(
                    context = activityContext,
                    request = credentialRequest
                )
                handlePasswordSignIn(result)
            } catch (e: GetCredentialException) {
                // Handle failure
            }

@yrezgui yrezgui merged commit 4fe2def into main Apr 17, 2026
6 checks passed
@yrezgui yrezgui deleted the identity_add_holder_issuance branch April 17, 2026 12:43
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