fix gopass dependency change
This commit is contained in:
parent
1a8ae48807
commit
f67e7ba53e
@ -28,13 +28,16 @@ If you want fewer bytes, put some zeroes at the end */
|
|||||||
func LoadKeyFromFileInteractive(filename string) (*[32]byte, error) {
|
func LoadKeyFromFileInteractive(filename string) (*[32]byte, error) {
|
||||||
a, err := os.Stat(filename)
|
a, err := os.Stat(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return new([32]byte), err
|
return nil, err
|
||||||
}
|
}
|
||||||
if a.Size() < 80 { // there can't be a password...
|
if a.Size() < 80 { // there can't be a password...
|
||||||
return LoadKeyFromFileArg(filename, nil)
|
return LoadKeyFromFileArg(filename, nil)
|
||||||
}
|
}
|
||||||
fmt.Printf("passphrase: ")
|
fmt.Printf("passphrase: ")
|
||||||
pass := gopass.GetPasswd()
|
pass, err := gopass.GetPasswd()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
fmt.Printf("\n")
|
fmt.Printf("\n")
|
||||||
return LoadKeyFromFileArg(filename, pass)
|
return LoadKeyFromFileArg(filename, pass)
|
||||||
}
|
}
|
||||||
@ -93,12 +96,19 @@ func LoadKeyFromFileArg(filename string, pass []byte) (*[32]byte, error) {
|
|||||||
// in the clear.
|
// in the clear.
|
||||||
func SaveKeyToFileInteractive(filename string, priv32 *[32]byte) error {
|
func SaveKeyToFileInteractive(filename string, priv32 *[32]byte) error {
|
||||||
var match bool
|
var match bool
|
||||||
|
var err error
|
||||||
var pass1, pass2 []byte
|
var pass1, pass2 []byte
|
||||||
for match != true {
|
for match != true {
|
||||||
fmt.Printf("passphrase: ")
|
fmt.Printf("passphrase: ")
|
||||||
pass1 = gopass.GetPasswd()
|
pass1, err = gopass.GetPasswd()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
fmt.Printf("repeat passphrase: ")
|
fmt.Printf("repeat passphrase: ")
|
||||||
pass2 = gopass.GetPasswd()
|
pass2, err = gopass.GetPasswd()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if string(pass1) == string(pass2) {
|
if string(pass1) == string(pass2) {
|
||||||
match = true
|
match = true
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user