mirror of
https://github.com/mitchell/selfpass.git
synced 2025-12-14 13:27:21 +00:00
Modify sp and services to use the protobuf module
This commit is contained in:
parent
66ec035ee0
commit
4fc74b0994
23 changed files with 59 additions and 1025 deletions
|
|
@ -7,7 +7,6 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"github.com/spf13/viper"
|
||||
|
|
@ -67,15 +66,15 @@ func (mgr *ConfigManager) OpenConfig() (output string, v *viper.Viper, err error
|
|||
}
|
||||
|
||||
contents, err = decryptConfig(mgr.masterpass, cfg)
|
||||
if err != nil && err == errConfigDecrypted {
|
||||
if err == errConfigDecrypted {
|
||||
configDecrypted = true
|
||||
} else if err != nil && err.Error() == crypto.ErrAuthenticationFailed.Error() {
|
||||
return output, nil, errors.New("incorrect masterpass")
|
||||
} else if err != nil {
|
||||
return output, nil, err
|
||||
}
|
||||
|
||||
if err = mgr.v.ReadConfig(bytes.NewBuffer(contents)); err != nil && strings.HasPrefix(err.Error(), "While parsing config") {
|
||||
return output, nil, fmt.Errorf("incorrect master password")
|
||||
} else if err != nil {
|
||||
if err = mgr.v.ReadConfig(bytes.NewBuffer(contents)); err != nil {
|
||||
return output, nil, err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue