From 6169450ab5d13f5fa8badcd0803bffbee4add811 Mon Sep 17 00:00:00 2001 From: lenforiee Date: Wed, 19 Apr 2023 21:34:15 +0200 Subject: [PATCH] challange -> challenge --- README.md | 2 +- util/client.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9083866..cd5abc3 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ For sharing with groups the `--group` argument exists. You can setup MFA also using the configuration sub command, only TOTP is supported, there are multiple modes for MFA: `none`, `interactive-totp` and `noninteractive-totp`. | Mode | Description | | --- | --- | -|`none`|just errors if challanged for MFA. +|`none`|just errors if challenged for MFA. |`interactive-totp` | prompts for interactive entry of TOTP Codes. |`noninteractive-totp` | automatically generates TOTP Codes when challenged, it requires the `totpToken` flag to be set to your totp Secret, you can configure the behavior using the `mfaDelay`, `mfaRetrys` and `totpOffset` flags diff --git a/util/client.go b/util/client.go index 85e8dfc..1d45dfd 100644 --- a/util/client.go +++ b/util/client.go @@ -84,12 +84,12 @@ func GetClient(ctx context.Context) (*api.Client, error) { switch viper.GetString("mfaMode") { case "interactive-totp": client.MFACallback = func(ctx context.Context, c *api.Client, res *api.APIResponse) (http.Cookie, error) { - challange := api.MFAChallange{} - err := json.Unmarshal(res.Body, &challange) + challenge := api.MFAChallenge{} + err := json.Unmarshal(res.Body, &challenge) if err != nil { - return http.Cookie{}, fmt.Errorf("Parsing MFA Challange") + return http.Cookie{}, fmt.Errorf("Parsing MFA Challenge") } - if challange.Provider.TOTP == "" { + if challenge.Provider.TOTP == "" { return http.Cookie{}, fmt.Errorf("Server Provided no TOTP Provider") } for i := 0; i < 3; i++ { @@ -100,14 +100,14 @@ func GetClient(ctx context.Context) (*api.Client, error) { return http.Cookie{}, fmt.Errorf("Reading TOTP: %w", err) } fmt.Printf("\n") - req := api.MFAChallangeResponse{ + req := api.MFAChallengeResponse{ TOTP: code, } var raw *http.Response raw, _, err = c.DoCustomRequestAndReturnRawResponse(ctx, "POST", "mfa/verify/totp.json", "v2", req, nil) if err != nil { if errors.Unwrap(err) != api.ErrAPIResponseErrorStatusCode { - return http.Cookie{}, fmt.Errorf("Doing MFA Challange Response: %w", err) + return http.Cookie{}, fmt.Errorf("Doing MFA Challenge Response: %w", err) } fmt.Println("TOTP Verification Failed") } else { @@ -120,7 +120,7 @@ func GetClient(ctx context.Context) (*api.Client, error) { return http.Cookie{}, fmt.Errorf("Unable to find Passbolt MFA Cookie") } } - return http.Cookie{}, fmt.Errorf("Failed MFA Challange 3 times: %w", err) + return http.Cookie{}, fmt.Errorf("Failed MFA Challenge 3 times: %w", err) } case "noninteractive-totp": helper.AddMFACallbackTOTP(client, viper.GetUint("mfaRetrys"), viper.GetDuration("mfaDelay"), viper.GetDuration("totpOffset"), viper.GetString("totpToken"))