mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 03:27:15 +00:00
Refactor login cmd
This commit is contained in:
@@ -33,12 +33,6 @@ type params struct {
|
|||||||
keyLength uint32
|
keyLength uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateFromPassword(password string, salt []byte, p *params) (hash []byte, err error) {
|
|
||||||
hash = argon2.IDKey([]byte(password), salt, p.iterations, p.memory, p.parallelism, p.keyLength)
|
|
||||||
|
|
||||||
return hash, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// loginCmd represents the login command
|
// loginCmd represents the login command
|
||||||
var loginCmd = &cobra.Command{
|
var loginCmd = &cobra.Command{
|
||||||
Use: "login",
|
Use: "login",
|
||||||
@@ -151,7 +145,6 @@ var loginCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
decryptedPrivateKey, err = crypto.DecryptSymmetric(decryptedProtectedKeyInHex, encryptedPrivateKey, nonProtectedTag, nonProtectedIv)
|
decryptedPrivateKey, err = crypto.DecryptSymmetric(decryptedProtectedKeyInHex, encryptedPrivateKey, nonProtectedTag, nonProtectedIv)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err)
|
util.HandleError(err)
|
||||||
}
|
}
|
||||||
@@ -292,3 +285,8 @@ func shouldOverrideLoginPrompt(currentLoggedInUserEmail string) (bool, error) {
|
|||||||
}
|
}
|
||||||
return result == "Yes", err
|
return result == "Yes", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func generateFromPassword(password string, salt []byte, p *params) (hash []byte, err error) {
|
||||||
|
hash = argon2.IDKey([]byte(password), salt, p.iterations, p.memory, p.parallelism, p.keyLength)
|
||||||
|
return hash, nil
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user