-
Notifications
You must be signed in to change notification settings - Fork 267
Implement conditional create in Shrine #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @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
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this 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.
Shrine/app/src/main/java/com/authentication/shrine/ui/AuthenticationScreen.kt
Outdated
Show resolved
Hide resolved
Shrine/app/src/main/java/com/authentication/shrine/ui/viewmodel/AuthenticationViewModel.kt
Outdated
Show resolved
Hide resolved
Shrine/app/src/main/java/com/authentication/shrine/ui/viewmodel/AuthenticationViewModel.kt
Outdated
Show resolved
Hide resolved
…ditional create to work with create restore key, and ensure CreatePasskeyScreen isn't shown on passkey login
niharika2810
left a comment
There was a problem hiding this 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.") |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit : createRestoreCredObject to createRestoreCredentialsObject?
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).