Skip to content

Latest commit

 

History

History
87 lines (67 loc) · 2.74 KB

README.md

File metadata and controls

87 lines (67 loc) · 2.74 KB

BankID SDK library

A SDK for providing BankID services as a RP (Relying party). Supports the latest v5 features.

PHP7.1 Ready Latest Stable Version Latest Unstable Version Build Status License

Installation

The library can be installed through composer

composer require nicklasw/bankid-sdk

Features

  • Supports all v5 features
  • Supports asynchronous and parallel requests

Examples

Initiate authenticate request

$client = new Client(new Config(<CERTFICATE>));

$authenticationResponse = $client->authenticate(new AuthenticationPayload(<PERSONAL NUMBER>, <IP ADDRESS>));

if (!$authenticationResponse->isSuccess()) {
    var_dump($authenticationResponse->getErrorCode(), $authenticationResponse->getDetails());

    return;
}

$collectResponse = $authenticationResponse->collect(); 

Execute parallel requests

$client = new ClientAsynchronous(new Config(<CERTFICATE>));

$promises[] = $client->authenticate(new AuthenticationPayload(<PERSONAL NUMBER>, <IP ADDRESS>));
$promises[] = $client->authenticate(new AuthenticationPayload(<PERSONAL NUMBER>, <IP ADDRESS>));

// Parallel requests, authenticate users
foreach (unwrap($promises) as $result) {
    /**
     * @var AuthenticationResponse $result
     */
    var_dump($result->isSuccess());
}

Certificates

The web service API can only be accessed by a RP that has a valid SSL client certificate. The RP certificate is obtained from the bank that the RP has purchased the BankID service from.

Generate PEM certificate

openssl pkcs12 -in <filename>.pfx -out <cert>.pem -nodes

Docker

make && make bash

Unit tests

composer run test

Contributing

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'Useful information about your new features'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request

Contributors