Skip to content

Commit

Permalink
get stored nonce function added
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan-DPC committed Nov 3, 2017
1 parent 9fe7eb0 commit c8a9f6d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/NonceContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Dpc\HashVerifier;



interface NonceContract
{
/**
Expand All @@ -30,4 +29,11 @@ public function store(string $nonce);
* @return bool
*/
public function matches(string $nonce, string $stored): bool;

/**
* Returns the nonce stored in the session by calling store()
*
* @return string
*/
public function getStoredNonce(): string;
}
10 changes: 10 additions & 0 deletions src/NonceGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,14 @@ public function matches(string $nonce, string $stored): bool
{
return $nonce && $stored === $nonce;
}

/**
* Returns the nonce stored in the session by calling store()
*
* @return string
*/
public function getStoredNonce(): string
{
return session('nonce');
}
}

0 comments on commit c8a9f6d

Please sign in to comment.