Skip to content

Commit

Permalink
Merge pull request #18 from privacybydesign/fix/use-stored-publickey
Browse files Browse the repository at this point in the history
revert to use stored public key
  • Loading branch information
saravahdatipour authored Dec 3, 2024
2 parents e6d2d87 + f97dbb5 commit abac850
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
define('IRMA_SERVER_URL', getenv('IRMA_SERVER_URL') ?: 'http://localhost:8088');
define('API_TOKEN', getenv('API_TOKEN') ?: '');
define('DEMO', false);
define('JWT_ENABLED', true);
define('JWT_ENABLED', getenv('JWT_ENABLED')?: false);

if (DEMO) {
define('ISSUER', 'irma-demo');
define('BASE_URL', 'http://localhost');
define('IRMATUBE_NEXT_SESSION_URL', BASE_URL . '/nl/get_session_request.php');
define('BASE_URL', 'http://localhost:8080');
define('IRMATUBE_NEXT_SESSION_URL', BASE_URL . '/get_session_request.php');
define('IRMATUBE_CREDENTIAL', 'irma-demo.IRMATube.member');
} else {
define('ISSUER', 'pbdf');
define('BASE_URL', 'https://privacybydesign.foundation');
define('IRMATUBE_NEXT_SESSION_URL', BASE_URL . '/demo/get_session_request.php');
define('IRMATUBE_CREDENTIAL', 'pbdf.pbdf.irmatube');
define('ISSUER',getenv('ISSUER') ?: 'pbdf');
define('BASE_URL', getenv('BASE_URL') ?: 'https://privacybydesign.foundation');
define('IRMATUBE_NEXT_SESSION_URL',getenv('IRMATUBE_NEXT_SESSION_URL') ?: BASE_URL . '/get_session_request.php');
define('IRMATUBE_CREDENTIAL', getenv('IRMATUBE_CREDENTIAL') ?: 'pbdf.pbdf.irmatube');
}

if (JWT_ENABLED) {
define('IRMA_SERVER_PUBLICKEY',getenv('IRMA_SERVER_PUBLICKEY') ?: __DIR__ . '/../data/pk.pem');
}
2 changes: 1 addition & 1 deletion get_session_request.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
function get_session_request($contents)
{
if (JWT_ENABLED) {
$jwt_pk = file_get_contents(IRMA_SERVER_URL . './publickey');
$jwt_pk = file_get_contents(IRMA_SERVER_PUBLICKEY);
try {
$decoded = JWT::decode($contents, new Key($jwt_pk, 'RS256'));
} catch (Exception $e) {
Expand Down

0 comments on commit abac850

Please sign in to comment.