Skip to content

DSorlov/phpFreja

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpFreja

Simple PHP wrapper to talk to Freja eID REST API for use both in test and production enviroment.

  • Supports validation of the JWS but requires external library for that part (thanks to php-jws).
  • Supports both directed and inferred authentication, for use with qr-code and app.
  • Supports authentication and signature api but not the assertion service.
  • Well behaved functions that do not throw (atleast not by design) but always return objects for simpler handling.
  • Not developed, supported or endorsed by Verisec.

To setup your test enviroment, and then basic agreement (free!!) read this information Freja eID

Example

Init connection to API (test)

require_once('freja.php');

$frejaAPI = new phpFreja('testCertificate.pfx','SuperSecretPassword',false);

Create URL for QR-Code

$qrInfo = $frejaAPI->createAuthQRCode();

if ($qrInfo->success)
    $imageUrl = $qrInfo->url;

Init, monitor and cancel authentication request

$authResponse = $frejaAPI->initAuthentication('EMAIL','[email protected]');

if ($authResponse->success)
    $authStatus = $frejaAPI->checkAuthRequest($authResponse->authRef);
    
$frejaAPI->cancelAuthentication($authResponse->authRef);

Init, monitor and cancel signature request

$signResponse = $frejaAPI->initSignatureRequest('EMAIL','[email protected]','Testsign','This is the agreement text');

if ($signResponse->success)
    $signStatus = $frejaAPI->checkSignatureRequest($signResponse->signRef);

$frejaAPI->cancelSignatureRequest($authResponse->signRef);