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);
    }
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);
    }
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 ) ; }
For migrating from an older version of the library

@param string $password
@param string $ciphertext
@param string $oldKey
@param Key $newKey
@return string
@throws \Exception
For migrating from an older version of the library