/** * @requires extension libsodium * @expectedException scrothers\laravelsodium\Exceptions\DecryptionException * @expectedExceptionMessage The key provided cannot decrypt the message */ public function testSodiumEncryptionFail() { $encrypted = SodiumLibrary::encrypt('foo', str_repeat('a', 16)); SodiumLibrary::decrypt($encrypted, str_repeat('b', 16)); }
/** * Encrypt the given value. * * @param string $value * * @return string */ public function encrypt($value) { return SodiumLibrary::encrypt($value, $this->key); }