variable change to private types

This commit is contained in:
yincong 2024-06-11 18:47:30 +08:00
parent b6a923fef8
commit 176f0ab9c9

View file

@ -75,10 +75,10 @@ var (
var ( var (
// PinRegexp is the regular expression used to validate PIN codes. // PinRegexp is the regular expression used to validate PIN codes.
PinRegexp = regexp.MustCompile(`^[0-9]{6,}$`) pinRegexp = regexp.MustCompile(`^[0-9]{6,}$`)
// PukRegexp is the regular expression used to validate PUK codes. // PukRegexp is the regular expression used to validate PUK codes.
PukRegexp = regexp.MustCompile(`^[0-9]{12,}$`) pukRegexp = regexp.MustCompile(`^[0-9]{12,}$`)
) )
// List of APDU command-related constants // List of APDU command-related constants
@ -388,7 +388,7 @@ func (w *Wallet) Open(passphrase string) error {
case passphrase == "": case passphrase == "":
return ErrPINUnblockNeeded return ErrPINUnblockNeeded
case status.PinRetryCount > 0: case status.PinRetryCount > 0:
if !PinRegexp.MatchString(passphrase) { if !pinRegexp.MatchString(passphrase) {
w.log.Error("PIN needs to be at least 6 digits") w.log.Error("PIN needs to be at least 6 digits")
return ErrPINNeeded return ErrPINNeeded
} }
@ -396,7 +396,7 @@ func (w *Wallet) Open(passphrase string) error {
return err return err
} }
default: default:
if !PukRegexp.MatchString(passphrase) { if !pukRegexp.MatchString(passphrase) {
w.log.Error("PUK needs to be at least 12 digits") w.log.Error("PUK needs to be at least 12 digits")
return ErrPINUnblockNeeded return ErrPINUnblockNeeded
} }