Skip to content
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

CP-9607: update android passkey implementation #2192

Merged
merged 11 commits into from
Jan 22, 2025
Merged

Conversation

ruijialin-avalabs
Copy link
Contributor

@ruijialin-avalabs ruijialin-avalabs commented Jan 16, 2025

Description

Changes done outside of mobile repo

  • PR to update assetlink.json in core-identity-frontend
  • Seedless org policy has been updated to include the Android apk-key-hash as origins under identity.core.app (this can be queried with cubesigner cli via cs org get (you will need to authenticate first) *we will need to make sure these org policy update is deploy from gamma to production prior to releasing this update

Ticket: CP-9607

  • use native Android passkey implementation
  • remove passkeyService.android.ts
  • add Passkey/Yubikey screen for k2-alpine
  • upgrade react-native-passkey
  • update passkeyService implementation to correctly convert buffer<->base64, and in case the base64 data is missing, fallback to use empty string to avoid conversion error

Screenshots/Videos

onboarding with android passkey and verifying android passkey

az_recorder_20250117_102851.mp4

Checklist

Please check all that apply (if applicable)

  • I have performed a self-review of my code
  • I have verified the code works
  • I have added/updated necessary unit tests
  • I have updated the documentation

@@ -182,7 +182,7 @@ export const useSeedlessRegister = (): ReturnType => {
await SeedlessService.sessionManager.approveFido(
oidcAuth.oidcToken,
oidcAuth.mfaId,
false
true
Copy link
Contributor Author

@ruijialin-avalabs ruijialin-avalabs Jan 16, 2025

Choose a reason for hiding this comment

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

this should be true instead, if we don't know it is yubikey/passkey, we want to prompt both options to them.

await sessionManager.approveFido(
oidcToken,
mfaId,
false //FIXME: this parameter is not needed, should refactor approveFido to remove it,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should be true instead, if we don't know it is yubikey/passkey, we want to prompt both options to them.

? decodedResult.response.signature
: ''
) as Buffer,
userHandle: base64UrlToBuffer(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

userHandle is null when authenticating with yubikey, so we check userhandle is in the reponse, if not, simply use empty string to convert to empty buffer.

packages/core-mobile/app/services/passkey/types.ts Outdated Show resolved Hide resolved
export default function FidoLayout(): JSX.Element {
return (
<Stack>
<Stack.Screen name="fidoNameInput" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have separate layouts for (fido) and (totp)? I was wondering if we could just include them in the seedless stack and show a page indicator based on each type. However, this might be challenging since the total number of steps could vary depending on the user’s decisions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean we should show X + 1 (fido) and X + 4 (totp) for the onboarding flow?

Copy link
Contributor

@onghwan onghwan Jan 22, 2025

Choose a reason for hiding this comment

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

Theoretically, yes. But I’m skeptical about how well we can implement it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like this is going to over complicate the logic, we need to re-render the pageControl if we are onboarding user who has existing seedless account but hasn't setup recovery method, or if user chooses to skip the recovery method setup or chose totp and back to addRecoveryMethod screen and chooses fido instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Exactly. The number of flow screens changes dynamically based on user actions, so implementing it could get complex. So, did the design team approve doing it this way?

Copy link
Contributor

@onghwan onghwan left a comment

Choose a reason for hiding this comment

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

🔥

@ruijialin-avalabs ruijialin-avalabs merged commit 50e6018 into main Jan 22, 2025
4 checks passed
@ruijialin-avalabs ruijialin-avalabs deleted the cp-9607 branch January 22, 2025 19:22
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