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

New dart library for onboarding flow logic #342

Open
murali-shris opened this issue May 10, 2023 · 1 comment
Open

New dart library for onboarding flow logic #342

murali-shris opened this issue May 10, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@murali-shris
Copy link
Member

Is your feature request related to a problem? Please describe.

We have onboarding logic duplication in at_onboarding_cli (at_onboarding_service_impl.dart
) and at_client_mobile (at_client_service.dart)

Describe the solution you'd like

Create a common package that eliminates code duplication at_onboarding_cli and at_client_mobile

Describe alternatives you've considered

No response

Additional context

No response

@murali-shris murali-shris added the enhancement New feature or request label May 10, 2023
@murali-shris murali-shris self-assigned this May 10, 2023
@murali-shris murali-shris changed the title New dart library for onboarding New dart library for onboarding flow logic May 10, 2023
@murali-shris
Copy link
Member Author

Code duplication between at_onboarding_cli, at_onboarding_flutter, at_client_service

At_onboarding_flutter → onboarding_service.dart
Onboard method
Calls at_client_service.onboard(..)
Authenticate method
Check atsign server status
Calls at_client_service.authenticate

At_onboarding_cli → at_onboarding_service_impl.dart
Onboard method

  • Checks for secondary address in root server
  • Cram authentication using at_lookup
  • If cram auth is successful
  • Generate encryption key pair and self encryption key
  • If auth mode is sim, read public key from at_chops
  • Create .atKeys file from key pairs
  • Update pkam public key to remote secondary
  • Create atchops(if not injected) and init at_client
  • Try pkam auth to server
  • If pkam auth is success, update encryption public key to server. Delete cram from server

authenticate method

  • Read atKeysfile
  • init at_chops(if not injected) and at_client
  • Pkam auth to server
  • Persist keys to local secondary

At_client_mobile → at_client_service.dart (trunk code - no support for pkam secure element)

onboard method //wrong method naming. This method does auth from biometric/atkeys file

  • Create at_chops from atKeys file
  • Create at_client
  • Read keys from biometric and store to local secondary
  • getKeyRestorePolicy. If activate or restore throw exception

Authenticate method

  • If cram secret is not set in preference, read keys from .atKeys file, perform pkam auth, store keys to biometric storage
  • If cram secret is set,
  • Perform cram auth
  • Generate pkam key pair
  • Update pkam public key to server
  • Perform pkam auth
  • If pkam is success, store keys to biometric, generate encryption keypair, generate self encryption key, delete cram secret from server
  • Create at_chops and at client
  • Persist keys to local secondary

Feature specific to flutter in at_client mobile

  • Persisting to biometric storage
  • Reading from biometric storage

Features common to at_client_service and at_onboarding_cli

  • Cram auth
  • Keypair generation
  • Pkam auth
  • Persisting to local secondary
  • Generating .atKeysFile
  • Reading from .atKeysFile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant