changePassword #414

Merged
sarah merged 4 commits from changePassword into master 2021-12-19 01:12:25 +00:00
1 changed files with 3 additions and 0 deletions
Showing only changes of commit 8a273d3310 - Show all commits

View File

@ -763,6 +763,9 @@ func (cps *CwtchProfileStorage) Delete() {
}
}
// Rekey re-encrypts the datastore with the new key.
// **note* this is technically a very dangerous API and should only be called after
// checks on the current password and the derived new password.
func (cps *CwtchProfileStorage) Rekey(newkey [32]byte) error {
// PRAGMA queries don't allow subs...
_, err := cps.db.Exec(fmt.Sprintf(`PRAGMA rekey="x'%x'";`, newkey))