Skip to content

Commit

Permalink
remove some un-neccessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
ziming committed Dec 8, 2024
1 parent d8ed664 commit abbca9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/LaravelMyinfoSg.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,18 @@ private function createTokenRequest(
}
}

$response = $guzzleClient->post(config('laravel-myinfo-sg.api_token_url'), [
return $guzzleClient->post(config('laravel-myinfo-sg.api_token_url'), [
'form_params' => $params,
'headers' => $headers,
]);

return $response;
}

/**
* Call Person API.
*
* @return array<string, mixed>|array<string, array>
* @throws GuzzleException
* @throws Exception
*/
private function callPersonAPI(
#[\SensitiveParameter]
Expand Down
6 changes: 5 additions & 1 deletion src/Services/MyinfoSecurityService.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static function decryptJWE(
string $personDataToken,
#[\SensitiveParameter]
string $passphrase = null
): array|string
): ?string
{
// $passphrase is by default null for backward compatibility purpose as I want to avoid a major version bump
$passphrase = ($passphrase === null) ? config('laravel-myinfo-sg.client_secret') : $passphrase;
Expand Down Expand Up @@ -179,6 +179,10 @@ public static function decryptJWE(

$payload = $jwe->getPayload();

if ($payload === null) {
return null;
}

return str_replace('"', '', $payload);
}
}

0 comments on commit abbca9b

Please sign in to comment.