Metadata-Version: 2.1
Name: idin
Version: 0.2.0
Summary: IDIN Module
Home-page: https://github.com/labd/python-idin
Author: Lab Digital
Author-email: opensource@labdigital.nl
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Description-Content-Type: text/markdown
Requires-Dist: attrs (>=18.0.0)
Requires-Dist: cached-property (>=1.5.0)
Requires-Dist: cryptography (>=2.8)
Requires-Dist: lxml (>3.0)
Requires-Dist: pytz
Requires-Dist: python-dateutil (>=2.0.0)
Requires-Dist: requests (>=2.22.0)
Requires-Dist: pytz (>=2019.3)
Requires-Dist: xmlsec (>=1.3.0)
Provides-Extra: docs
Provides-Extra: test
Requires-Dist: freezegun (==0.3.15) ; extra == 'test'
Requires-Dist: requests-mock (==1.8.0) ; extra == 'test'
Requires-Dist: pytest-cov (==2.8.1) ; extra == 'test'
Requires-Dist: pytest (>=6.0.0rc1) ; extra == 'test'
Requires-Dist: coverage[toml] (==5.2) ; extra == 'test'
Requires-Dist: isort (==4.2.5) ; extra == 'test'
Requires-Dist: flake8 (==3.8.3) ; extra == 'test'
Requires-Dist: flake8-blind-except (==0.1.1) ; extra == 'test'
Requires-Dist: flake8-debugger (==1.4.0) ; extra == 'test'
Requires-Dist: flake8-imports ; extra == 'test'

# python-idin

This is a Python library to authenticate users via iDIN
(https://www.idin.nl/). iDIN is a service offered by banks which allows
consumers to use their bank’s secure and reliable login methods to either
identify, login or confirm their age on your platform.

## Requirements

Requires Python 3.7, xmlsec1 and libxml2-dev libraries

## Installation

Not released yet

## Usage

First intialize the idin client object:

```python
import idin

client = idin.Client(
    language="nl",
    merchant_id="<your merchant id>",
    merchant_sub_id="<optional merchant subaccount id>",
    endpoint="<endpoint of acquirer>",
    certificate=idin.Certificate(
        private_key="<private key (content)>",
        certificate="<certificate data (content)>",
        password="<optional private key password>",
    ),
    certificate_acquirer=idin.Certificate(
        certificate="<certificate data (acquirer)>"
    )
)
```

Now you can start a transaction using:
```python
transaction = client.start_transaction(
    issuer="<ISSUER ID>",
    service_id=idin.ServiceID.ConsumerID | idin.ServiceID.Name,
    merchant_return_url="<URL to redirect the user to after identification>",
)
assert transaction.redirect_url
assert transaction.transaction_id
```

After the user finished the transaction you can retrieve the status using:
```python
status = client.get_status(
    transaction_id="<transaction id>",
    entrance_code="<entrance code>"
)

print(status.user)
```

## Error handling

The following exceptions might be raised:
- `idin.IdinException` - Error raised at the IDIN system
- `idin.RequesterException` - Invalid request
- `idin.ValidationError` - The response couldn't be validated


## More information

- [Official Implementation Guide EN](https://betaalvereniging.atlassian.net/wiki/spaces/IIDIFMD/pages/588284049/iDIN+Merchant+Implemention+Guide+EN)
- [Official Implementation Guide NL](https://betaalvereniging.atlassian.net/wiki/spaces/IIDIFMD/pages/588579051/iDIN+Acceptant+Implementatie+Gids+NL)
- [Python-xmlsec documentation](https://pythonhosted.org/xmlsec/index.html)


