challange -> challenge

This commit is contained in:
lenforiee 2023-04-19 21:34:15 +02:00
parent 7fe89a34b3
commit 6169450ab5
2 changed files with 8 additions and 8 deletions

View file

@ -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

View file

@ -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"))