Skip to content

Conversation

@cy245
Copy link
Contributor

@cy245 cy245 commented Jan 30, 2026

Implements Conditional Create (also called Automatic Passkey Upgrade) in Shrine

Also fixes login function to use more correct server endpoint (original returns an empty object which was causing a bug).

@gemini-code-assist
Copy link

Summary of Changes

Hello @cy245, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the capability for conditional passkey creation within the Shrine application. It refactors the existing authentication mechanism to support a unified username and password login, which then seamlessly allows for the creation of a passkey if the user has logged in with traditional credentials. This change improves the security and convenience of user authentication by promoting passkey adoption after a successful password-based sign-in.

Highlights

  • Conditional Passkey Creation: The createPasskey function in CredentialManagerUtils.kt now accepts an isConditional parameter, enabling conditional passkey creation based on the authentication context.
  • Authentication API Refactoring: The AuthApiService.kt has been updated to replace separate setUsername and setPassword endpoints with a single loginWithUsernamePassword endpoint for a more unified authentication process.
  • Login Request Model Update: The LoginRequest.kt file now defines a LoginUsernamePasswordRequest data class, which includes both username and password, replacing the older EditUsernameRequest and PasswordRequest models for login operations.
  • Repository Authentication Logic Streamlining: The AuthRepository.kt has been modified to utilize the new loginWithUsernamePassword API, streamlining the login process and removing the deprecated setSessionWithPassword function.
  • UI/ViewModel Integration for Passkey Adoption: The AuthenticationScreen.kt and AuthenticationViewModel.kt now incorporate logic to trigger conditional passkey creation immediately following a successful password-based login, enhancing user experience by promoting passkey adoption.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@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 successfully implements conditional passkey creation after a password-based login, which is a great step towards encouraging passkey adoption. The refactoring of the login flow into a single API call is also a significant improvement for both code clarity and efficiency. I've identified a couple of potential issues related to error handling and a possible race condition in the UI flow that could lead to a confusing user experience. Addressing these points will make the implementation more robust.

…ditional create to work with create restore key, and ensure CreatePasskeyScreen isn't shown on passkey login
@cy245 cy245 marked this pull request as ready for review February 6, 2026 21:54
@cy245 cy245 requested a review from niharika2810 as a code owner February 6, 2026 21:54
Copy link
Contributor

@niharika2810 niharika2810 left a comment

Choose a reason for hiding this comment

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

Minor comments, Kindly check

}
}
): Boolean {
return registerPasskey(createRestoreKeyOnCredMan, "Error creating restore key.")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : Add in string res

): Boolean {
return when (val result = repository.registerPasskeyCreationRequest()) {
is AuthResult.Success -> {
val createPasskeyResponse = createPasskeyOnCredMan(result.data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have a better for createPasskeyOnCredMan method? Also CredMan might not be the external term we want to use :)

val conditionalSuccess = viewModel.conditionalCreatePasskey(
createPasskeyOnCredMan = { createPasskeyRequestObj: JSONObject ->
credentialManagerUtils.createPasskey(
requestResult = createPasskeyRequestObj,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : createPasskeyRequestObj to createPasskeyRequestObject?

createRestoreKeyOnCredMan = { createRestoreCredObject ->
credentialManagerUtils.createRestoreKey(
context = context,
requestResult = createRestoreCredObject,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : createRestoreCredObject to createRestoreCredentialsObject?

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