Skip to content

Commit

Permalink
Don't check Salt on Windows (#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgagniere authored Mar 31, 2023
1 parent 69e4c07 commit e43926a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/pkg/config/v1/context_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v1

import (
"regexp"
"runtime"

"github.com/confluentinc/cli/internal/pkg/secret"
)
Expand All @@ -21,7 +22,7 @@ type ContextState struct {

func (c *ContextState) DecryptContextStateAuthToken(ctxName string) error {
reg := regexp.MustCompile(authTokenRegex)
if !reg.MatchString(c.AuthToken) && c.AuthToken != "" && c.Salt != nil {
if !reg.MatchString(c.AuthToken) && c.AuthToken != "" && (c.Salt != nil || runtime.GOOS == "windows") {
decryptedAuthToken, err := secret.Decrypt(ctxName, c.AuthToken, c.Salt, c.Nonce)
if err != nil {
return err
Expand All @@ -34,7 +35,7 @@ func (c *ContextState) DecryptContextStateAuthToken(ctxName string) error {

func (c *ContextState) DecryptContextStateAuthRefreshToken(ctxName string) error {
reg := regexp.MustCompile(authRefreshTokenRegex)
if !reg.MatchString(c.AuthRefreshToken) && c.AuthRefreshToken != "" && c.Salt != nil {
if !reg.MatchString(c.AuthRefreshToken) && c.AuthRefreshToken != "" && (c.Salt != nil || runtime.GOOS == "windows") {
decryptedAuthRefreshToken, err := secret.Decrypt(ctxName, c.AuthRefreshToken, c.Salt, c.Nonce)
if err != nil {
return err
Expand Down

0 comments on commit e43926a

Please sign in to comment.