nicklasw / bankid-sdk
BankID SDK API client
1.1.0
2019-01-04 09:36 UTC
Requires
- php: ^7.1
- ext-curl: *
- ext-json: *
- doctrine/annotations: ^1.6
- guzzlehttp/guzzle: ^6.3
- tebru/gson-php: ^0.6.2
Requires (Dev)
- phan/phan: dev-master
- phpunit/phpunit: ^7.3
- squizlabs/php_codesniffer: ^3.3
- symfony/intl: ^4.1
- symfony/validator: ^4.1
This package is not auto-updated.
Last update: 2024-12-28 17:47:43 UTC
README
A SDK for providing BankID services as a RP (Relying party). Supports the latest v5 features.
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