-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: Secure atKeys with pass-phrase #703
feat: Secure atKeys with pass-phrase #703
Conversation
Verified backward compatibility of at_auth and at_chops packages with at_client_sdk and looks fine.
|
packages/at_chops/lib/src/algorithm/at_hashing_algo_factory.dart
Outdated
Show resolved
Hide resolved
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.
LGTM - will leave final approval to Murali
…-protected-encryption-ofatkeys-files # Conflicts: # packages/at_chops/lib/at_chops.dart # packages/at_chops/lib/src/algorithm/aes_encryption_algo.dart # packages/at_chops/lib/src/at_keys_crypto.dart
…-protected-encryption-ofatkeys-files
The changes in
At this point, this PR contains changes in at_onboarding_cli. The changes are at_cli_commons are moved to a different branch. |
String? commitLogStoragePathToUse = | ||
('${storageDir?.path}/commit').replaceAll('/', Platform.pathSeparator); | ||
String downloadPathToUse = ('$homeDir!/.atsign/downloads/$atSign/$nameSpace') | ||
.replaceAll('/', Platform.pathSeparator); | ||
|
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 you extract the code below into its own file as a function which will return an AtClient given some args (similar to what we have in the noports repo here)
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.
This change in implemented in 5be8bf9
@@ -50,4 +53,62 @@ class HomeDirectoryUtil { | |||
enrollmentId: enrollmentId), | |||
'hive'); | |||
} | |||
|
|||
/// Generate a path like this: |
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.
I really don't like that we are duplicating this code, again. I think instead we should move these functions to at_utils from at_cli_commons. Rather than delay this PR further, please create another ticket to take care of this.
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.
Created the following ticket: #720
…t_client_cli.dart" and use it in auth_cli.dart
stderr.writeln(); | ||
var msg = 'Failed to connect after $attempts attempts'; | ||
stderr.writeln(chalk.brightRed(msg)); | ||
throw SecondaryServerConnectivityException(msg); |
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.
This may not be connectivity error always. Auth can fail for other reasons.
Can you replace with UnAuthenticatedException
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.
This is addressed in 0bdb5e5
'${Platform.environment['HOME']}/.atsign/keys/${atSign}_key.atKeys') | ||
// Fetched cram key from the at_demos repo. | ||
..cramSecret = | ||
'15cdce8f92bcf7e742d5b75dc51ec06d798952f8bf7e8ff4c2b6448e5f7c2c12b570fe945f04011455fdc49cacdf9393d9c1ac4609ec71c1a0b0c213578e7ec7'); |
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 add dependency to at_demos and remove this hard coded cram 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.
This is addressed in 0bdb5e5
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.
Please address Murali's comments
- What I did
Support the password protected of atKeys file.
- How I did it
Add pass phrase to the AtOnboardingPreference to capture the pass phrase and propagate it the at_auth and at_chops package to decrypt the atKeys.
In auth_cli_args, add parser options to capture "pass phrase" and "hashing algo type"
In at_onboarding_service_impl.dart, in "_generateAtKeysFile", check if the passPhrase is supplied. If supplied, encrypt the keys with the passphrase.
Removed the at_cli_commons dependency from at_onboarding_cli to prevent from cyclic dependency.
- How to verify it
Added a test to verify the encryption and decryption of atKeys using a passphrase with the argon2id algorithm
A functional test to verify password protected of atKeys file
- Description for the changelog