at_libraries
at_libraries copied to clipboard
New dart library for onboarding flow logic
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
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