|
|
|
@ -12,7 +12,6 @@ import (
|
|
|
|
|
"golang.org/x/crypto/pbkdf2"
|
|
|
|
|
"golang.org/x/crypto/sha3"
|
|
|
|
|
"io"
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"os"
|
|
|
|
|
"path"
|
|
|
|
|
"path/filepath"
|
|
|
|
@ -56,12 +55,12 @@ func initV2Directory(directory, password string) ([32]byte, [128]byte, error) {
|
|
|
|
|
return [32]byte{}, [128]byte{}, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err = ioutil.WriteFile(path.Join(directory, versionFile), []byte(version), 0600); err != nil {
|
|
|
|
|
if err = os.WriteFile(path.Join(directory, versionFile), []byte(version), 0600); err != nil {
|
|
|
|
|
log.Errorf("Could not write version file: %v", err)
|
|
|
|
|
return [32]byte{}, [128]byte{}, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err = ioutil.WriteFile(path.Join(directory, saltFile), salt[:], 0600); err != nil {
|
|
|
|
|
if err = os.WriteFile(path.Join(directory, saltFile), salt[:], 0600); err != nil {
|
|
|
|
|
log.Errorf("Could not write salt file: %v", err)
|
|
|
|
|
return [32]byte{}, [128]byte{}, err
|
|
|
|
|
}
|
|
|
|
@ -70,7 +69,7 @@ func initV2Directory(directory, password string) ([32]byte, [128]byte, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func openEncryptedDatabase(profileDirectory string, password string, createIfNotExists bool) (*sql.DB, error) {
|
|
|
|
|
salt, err := ioutil.ReadFile(path.Join(profileDirectory, saltFile))
|
|
|
|
|
salt, err := os.ReadFile(path.Join(profileDirectory, saltFile))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|