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/go.mod b/go.mod index fc5efc2..d406a20 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/alessio/shellescape v1.4.1 - github.com/passbolt/go-passbolt v0.5.8 + github.com/passbolt/go-passbolt v0.6.0 github.com/pterm/pterm v0.12.51 github.com/spf13/cobra v1.6.1 github.com/spf13/viper v1.14.0 diff --git a/go.sum b/go.sum index 613842b..670424e 100644 --- a/go.sum +++ b/go.sum @@ -203,6 +203,8 @@ github.com/passbolt/go-passbolt v0.5.7 h1:qpFZBcuyjcqUqnptnrCYTCOzzjtv7a8qTeohRU github.com/passbolt/go-passbolt v0.5.7/go.mod h1:drZXAx/5iLqH9MH46HCgy+taTkJ0Akw3igoBV8TnbF4= github.com/passbolt/go-passbolt v0.5.8 h1:cKogZ1w2qY/MHdwwG5Ppef+xLoQw+w8djUBCsYvoUw8= github.com/passbolt/go-passbolt v0.5.8/go.mod h1:86tXSTxBwbjg9Qmt2LiTAoMJqIFgHX15BVReRtbKiyE= +github.com/passbolt/go-passbolt v0.6.0 h1:qTrFPWwcE6Q8Ss238ph3LortnlPkx0R31WPgmiYrd48= +github.com/passbolt/go-passbolt v0.6.0/go.mod h1:86tXSTxBwbjg9Qmt2LiTAoMJqIFgHX15BVReRtbKiyE= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= 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"))