Skip to content

Commit

Permalink
Update freedom.go
Browse files Browse the repository at this point in the history
  • Loading branch information
RPRX committed Jan 2, 2025
1 parent a00cdac commit a620910
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions infra/conf/freedom.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,25 +167,25 @@ func ParseNoise(noise *Noise) (*freedom.Noise, error) {
}

case "str":
//user input string
// user input string
NConfig.Packet = []byte(strings.TrimSpace(noise.Packet))

case "hex":
// user input hex - Decode hex string into byte slice
NConfig.StrNoise, err = hex.DecodeString(noise.Packet)
// user input hex
NConfig.Packet, err = hex.DecodeString(noise.Packet)
if err != nil {
return nil, errors.New("Invalid hex string: ", err)
return nil, errors.New("Invalid hex string").Base(err)
}

case "base64":
//user input base64
// user input base64
NConfig.Packet, err = base64.StdEncoding.DecodeString(strings.TrimSpace(noise.Packet))
if err != nil {
return nil, errors.New("Invalid base64 string")
return nil, errors.New("Invalid base64 string").Base(err)
}

default:
return nil, errors.New("Invalid packet, only rand/str/base64 are supported")
return nil, errors.New("Invalid packet, only rand/str/hex/base64 are supported")
}

if noise.Delay != nil {
Expand Down

0 comments on commit a620910

Please sign in to comment.