Main password encrypted in memory
This commit is contained in:
@@ -216,7 +216,10 @@ func (id *Identity) FinalizeInvitation(ReceivedContact *meowlib.ContactCard) err
|
||||
// LoadIdentity loads an identity from an encrypted file
|
||||
func LoadIdentity(filename string, password string) (*Identity, error) {
|
||||
var id Identity
|
||||
GetConfig().memoryPassword = password
|
||||
err := GetConfig().SetMemPass(password)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
GetConfig().IdentityFile = filename
|
||||
indata, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
@@ -242,7 +245,11 @@ func (id *Identity) Save() error {
|
||||
return errors.New("identity filename empty")
|
||||
}
|
||||
b, _ := json.Marshal(id)
|
||||
armor, err := helper.EncryptMessageWithPassword([]byte(GetConfig().memoryPassword), string(b))
|
||||
password, err := GetConfig().GetMemPass()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
armor, err := helper.EncryptMessageWithPassword([]byte(password), string(b))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user