master

laravel/framework

Last updated at: 29/12/2023 09:21

StringEncrypter.php

TLDR

This file contains an interface StringEncrypter that defines two methods: encryptString and decryptString. These methods are used for encrypting and decrypting strings without serialization or unserialization.

Methods

encryptString

This method encrypts the given string without serialization. It takes a string as a parameter and returns the encrypted string. If encryption fails, it throws an EncryptException.

decryptString

This method decrypts the given string without unserialization. It takes an encrypted string as a parameter and returns the decrypted string. If decryption fails, it throws a DecryptException.

<?php

namespace Illuminate\Contracts\Encryption;

interface StringEncrypter
{
    /**
     * Encrypt a string without serialization.
     *
     * @param  string  $value
     * @return string
     *
     * @throws \Illuminate\Contracts\Encryption\EncryptException
     */
    public function encryptString($value);

    /**
     * Decrypt the given string without unserialization.
     *
     * @param  string  $payload
     * @return string
     *
     * @throws \Illuminate\Contracts\Encryption\DecryptException
     */
    public function decryptString($payload);
}