Skip to content

Commit

Permalink
Documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hbldh committed Apr 15, 2024
1 parent 6380923 commit 151d30b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

![Build and Test](https://github.com/hbldh/pybankid/workflows/Build%20and%20Test/badge.svg)
![Documentation Status](https://readthedocs.org/projects/pybankid/badge/?version=latest)
![PyPI Version](http://img.shields.io/pypi/v/pybankid.svg)
![PyPI License](http://img.shields.io/pypi/l/pybankid.svg)
![Coverage](https://coveralls.io/repos/github/hbldh/pybankid/badge.svg?branch=master)
![PyPI Version](https://img.shields.io/pypi/v/pybankid)
![PyPI License](https://img.shields.io/pypi/l/pybankid)

PyBankID is a client for providing BankID services as a Relying Party, i.e., providing authentication and signing functionality to end users. This package provides a simplifying interface for initiating authentication and signing orders and then collecting the results from the BankID servers.

Expand All @@ -22,7 +21,7 @@ pip install pybankid

## Usage

PyBankID provides both a synchronous and an asynchronous client for communication with BankID services. The example below will use the asynchronous client, but the synchronous client is used in the same way by merely omitting the `await` keyword.
PyBankID provides both a synchronous and an asynchronous client for communication with BankID services. The example below will use the synchronous client, but the asynchronous client is used in an identical fashion, only using the `await` keyword before each function call.

### Synchronous client

Expand All @@ -36,7 +35,7 @@ client = BankIDClient(certificates=(

Connection to the production server is the default in the client. If a test server is desired, send in the `test_server=True` keyword in the init of the client.

When using the JSON client, authentication and signing calls require the end user's IP address to be included in all calls. An authentication order is initiated as such:
All authentication and signing calls require the end user's IP address to be included. An authentication order is initiated as such:

```python
client.authenticate(end_user_ip='194.168.2.25')
Expand Down Expand Up @@ -79,7 +78,7 @@ client.sign(
}
```

If someone else than the one you specified tries to authenticate or sign, the BankID app will state that the request is not intended for the user.
If someone other than the one you specified tries to authenticate or sign, the BankID app will state that the request is not intended for the user.

The status of an order can then be studied by polling with the `collect` method using the received `orderRef`:

Expand Down Expand Up @@ -126,20 +125,22 @@ client.collect(order_ref="a9b791c3-459f-492b-bf61-23027876140b")
}
```


Please note that the `collect` method should be used sparingly: in the [BankID Integration Guide](https://www.bankid.com/en/utvecklare/guider/teknisk-integrationsguide) it is specified that *"collect should be called every two seconds and must not be called more frequent than once per second"*.

### Asynchronous client
PyBankID also implements the `phone/auth` and `phone/sign` methods, for performing authentication and signing with
users that are contacted through phone. For documentation on this, see [PyBankID's Read the Docs page](https://pybankid.readthedocs.io/en/latest/).

### Asynchronous client

The asynchronous client is used in the same way as the synchronous client, but the methods are blocking.
The asynchronous client is used in the same way as the synchronous client, with the difference that all request are performed asynchronously.

The synchronous guide above can be used as a reference for the asynchronous client as well, by simply adding the `await` keyword:

```python
from bankid import BankIDClientAsync
client = BankIDClientAsync(certificates=(
'path/to/certificate.pem',
'path/to/key.pem',
from bankid import BankIDAsyncClient
client = BankIDAsyncClient(certificates=(
'path/to/certificate.pem',
'path/to/key.pem',
))

await client.authenticate(end_user_ip='194.168.2.25')
Expand All @@ -151,10 +152,12 @@ await client.authenticate(end_user_ip='194.168.2.25')
}
```


## PyBankID and QR codes

PyBankID can generate QR codes for you, and there is an example application in the [examples folder of the repo](https://github.com/hbldh/pybankid/tree/master/examples) where a Flask application called `qrdemo` shows one way to do authentication with animated QR codes.
PyBankID can generate QR codes for you, and there is an example application in the [examples folder of the repo](https://github.com/hbldh/pybankid/tree/master/examples), where a Flask application called `qrdemo` shows one way to do authentication with animated QR codes.

The QR code content generation is done with the `generate_qr_code_content` method on the BankID Client instances, or directly
through the identically named method in `bankid.qr` module.

## Certificates

Expand Down
2 changes: 1 addition & 1 deletion docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PyBankID can generate QR codes for you. There is an demo application in the
`examples folder of the repo <https://github.com/hbldh/pybankid/tree/master/examples>`_ where a
Flask application called ``qrdemo`` shows one way to do authentication with animated QR codes.

The QR code content generation is done with the ``generate_qr_code_content`` method on the BankID Client instances, or diectly
The QR code content generation is done with the ``generate_qr_code_content`` method on the BankID Client instances, or directly
through the identically named method in ``bankid.qr`` module.

Below follows the app's README file, for your convenience.
Expand Down
8 changes: 3 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ PyBankID Documentation
.. image:: https://github.com/hbldh/pybankid/workflows/Build%20and%20Test/badge.svg
:target: https://github.com/hbldh/pybankid/actions?query=workflow%3A%22Build+and+Test%22
.. image:: https://readthedocs.org/projects/pybankid/badge/?version=latest
:target: http://pybankid.readthedocs.org/en/latest/?badge=latest
:target: https://pybankid.readthedocs.org/en/latest/?badge=latest
:alt: Documentation Status
.. image:: http://img.shields.io/pypi/v/pybankid.svg
.. image:: https://img.shields.io/pypi/v/pybankid.svg
:target: https://pypi.python.org/pypi/pybankid/
.. image:: http://img.shields.io/pypi/l/pybankid.svg
.. image:: https://img.shields.io/pypi/l/pybankid.svg
:target: https://pypi.python.org/pypi/pybankid/
.. image:: https://coveralls.io/repos/github/hbldh/pybankid/badge.svg?branch=master
:target: https://coveralls.io/github/hbldh/pybankid?branch=master

PyBankID is a client for providing BankID services as a Relying Party, i.e.
providing authentication and signing functionality to end users. This package
Expand Down

0 comments on commit 151d30b

Please sign in to comment.