Skip to content

Commit

Permalink
Check secret with hash
Browse files Browse the repository at this point in the history
  • Loading branch information
erfanmola committed Oct 10, 2023
1 parent ac28da3 commit bd18317
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/app/Http/Controllers/DPX.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,20 @@ public static function Verify(string $wallet, string $secret) {

public static function RevokeSecret(string $wallet, string $secret) {

if (Wallet::where([ 'wallet' => $wallet, 'secret' => $secret ])->count() > 0) {
$wallet = Wallet::where('wallet', $wallet)->first();

if ($wallet && Hash::check($secret, $wallet->secret)) {

$new_secret = DPX::GenerateRandomHash();

Wallet::where([ 'wallet' => $wallet, 'secret' => $secret ])->update([ 'secret' => $new_secret ]);
Wallet::where([ 'wallet' => $wallet ])->update([ 'secret' => Hash::make($new_secret) ]);

return $new_secret;

}else{

return false;

}

return false;

}

public static function GetBalance(string $wallet) {
Expand Down

0 comments on commit bd18317

Please sign in to comment.