Ejemplo n.º 1
0
 /** @test */
 public function it_does_not_fail_on_empty_message_for_encryption()
 {
     $crypter = new Crypter();
     $hasher = new Hasher($this->siteToken);
     $this->assertNotEmpty($crypter->encrypt('', $hasher->key($this->email)));
     $this->assertNotEmpty($crypter->encrypt(null, $hasher->key($this->email)));
 }
 /**
  * decrypts a given encrypted message container
  * e.g.: "slowaes:11 41bc1eacf6ce685c8eb7649da0d080995223165277af8bc068c90f7eb831d5ae
  * 97be775203f003fef3c808e4b588c69b"
  *
  * @param string $text
  * @param string $email
  *
  * @return string
  * @throws Exception
  */
 public function decrypt($text, $email)
 {
     $key = $this->hasher->key($email);
     return $this->crypter->decrypt($text, $key);
 }