public static function upgradeFromVersion1(string $password, string $ciphertext, string $oldKey, Key $newKey) : string
{
if (!self::decryptAndVerifyLegacy($password, $ciphertext, $oldKey)) {
throw new \Exception('The correct password is necessary for legacy migration.');
}
$plaintext = Crypto::legacyDecrypt($ciphertext, $oldKey);
return self::hashAndEncrypt($plaintext, $newKey);
}