-
Notifications
You must be signed in to change notification settings - Fork 343
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
refactor(general): user password hashing and key derivation helpers #3821
refactor(general): user password hashing and key derivation helpers #3821
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3821 +/- ##
==========================================
+ Coverage 75.86% 77.01% +1.15%
==========================================
Files 470 476 +6
Lines 37301 28682 -8619
==========================================
- Hits 28299 22090 -6209
+ Misses 7071 4694 -2377
+ Partials 1931 1898 -33 ☔ View full report in Codecov by Sentry. |
The variable is used in all the implementations of password hashing, not just V1. No functional changes.
The constant is located in the `internal/user` package, this de-couples it from the value in the `crypto` package. This introduces no functional changes.
Objective: remove dependency on `crypto.RecommendedSaltLength()`, with the intent of removing that function and other helpers in the crypto package. No functional change
Adds: - user.DefaultPasswordHashingAlgorithm constant - user.PasswordHashingAlgorithms helper Uses these to set up the CLI for the 'repo server user {add,set}' commands.
Also, removes dependent functions. No functional change.
No functional changes
Also, reorders constant definition order. No functional changes.
No functional change.
…reate flag definition
No longer used outside the package => unexported Renamed to supportedPBKeyDerivationAlgorithms No functional changes
Adds a common prefix `pb_key_deriver_` No functional changes.
It contains the user password hashing implementation for all the password hashing schemes currently supported in kopia.
24a6dfb
to
31259db
Compare
// keys" for the register password-based key derivers in the crypto package. | ||
// This trivial test is a change detector to ensure that the constants defined | ||
// in the user package match those defined in the crypto package. | ||
func TestPasswordHashingConstantMatchCryptoPackage(t *testing.T) { |
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.
@bathina2 This is what I meant by "adding a test to ensure the constants match".
Code movement and simplification, no functional changes.
Objectives:
Changes:
crypto.DeriveKeyFromPassword
now takes a key size.crypto.MasterKeySize
const.crypto.DefaultKeyDerivationAlgorithm
const.Followups to:
The individual commits show the code transformations to simplify the review of the changes.