public static function decryptMessage($message, $key, $hashKey = '')
    {
        // Test the message and key for string validity.
        Helpers::isString($message, 'Encryption', 'decryptMessage');
        Helpers::isString($key, 'Encryption', 'decryptMessage');
        Helpers::isString($hashKey, 'Encryption', 'decryptMessage');
        // Create a special hashed key for encryption.
        $key = Hash::hash($key, $hashKey, Constants::SECRETBOX_KEYBYTES);
        // Validate and decode the paylload.
        $payload = self::getJsonPayload($message);
        $nonce = base64_decode($payload['nonce']);
        $ciphertext = base64_decode($payload['ciphertext']);
        // Open the secret box using the data provided.
        $plaintext = \Sodium\crypto_secretbox_open($ciphertext, $nonce, $key);
        // Test if the secret box returned usable data.
        if ($plaintext === false) {
            throw new Exceptions\DecryptionException("Failed to decrypt message using key.");
        }
        return unserialize($plaintext);
    }