{"id":47898118,"url":"https://github.com/kormax/python-aliro-reader","last_synced_at":"2026-04-04T03:56:32.483Z","repository":{"id":340854441,"uuid":"1167800136","full_name":"kormax/python-aliro-reader","owner":"kormax","description":"Aliro reader POC in python","archived":false,"fork":false,"pushed_at":"2026-03-14T20:43:06.000Z","size":850,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-04T03:56:31.546Z","etag":null,"topics":["aliro","connectivity-standards-alliance","copernicus","csa","ecp","lyon","nfc","pn532","unified-access","wallet"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kormax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-26T17:40:51.000Z","updated_at":"2026-03-25T23:39:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kormax/python-aliro-reader","commit_stats":null,"previous_names":["kormax/python-aliro-reader"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kormax/python-aliro-reader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kormax%2Fpython-aliro-reader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kormax%2Fpython-aliro-reader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kormax%2Fpython-aliro-reader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kormax%2Fpython-aliro-reader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kormax","download_url":"https://codeload.github.com/kormax/python-aliro-reader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kormax%2Fpython-aliro-reader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31387024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T01:22:39.193Z","status":"online","status_checked_at":"2026-04-04T02:00:07.569Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliro","connectivity-standards-alliance","copernicus","csa","ecp","lyon","nfc","pn532","unified-access","wallet"],"created_at":"2026-04-04T03:56:32.053Z","updated_at":"2026-04-04T03:56:32.471Z","avatar_url":"https://github.com/kormax.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Aliro Reader\n\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"./assets/ALIRO.SCREEN.PHONE.DEMO.webp\" alt=\"Aliro-based key on an iPhone\" width=\"250px\"\u003e\n\u003c/p\u003e\n\n\u003e [!CAUTION]\n\u003e At the current moment, this project **does not** provide built-in credential issuance/provisioning for user devices.\n\u003e Users are fully responsible for procuring valid Aliro credentials and reader configuration material at this time.\n\n## Overview\n\nThis project provides a Python-based implementation of the NFC part of the Aliro protocol, including the following commands:\n- AUTH0;\n- AUTH1;\n- EXCHANGE;\n- ENVELOPE.\n\n## Requirements\n\n- **A way to procure valid credentials/reader configuration material externally (not provided by this project at this moment)**;\n- Linux or macOS;\n- Python 3.10+;\n- PN532 connected over UART or USB (recommended/tested path);\n\nFor PC usage with PN532 via UART connect as follows:\n\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"./assets/PN532.CONNECTION.DEMO.webp\" alt=\"Connecting PN532\" width=\"500px\"\u003e\n\u003c/p\u003e\n\n## Installation And Running\n\n| Step                    | `uv` (recommended)        | `pip`                                                                   |\n|-------------------------|---------------------------|-------------------------------------------------------------------------|\n| 1. Install dependencies | `uv sync`                 | `python3 -m pip install --upgrade pip`\u003cbr\u003e`python3 -m pip install -e .` |\n| 2. Configure            | `nano configuration.json` | `nano configuration.json`                                               |\n| 3. Run                  | `uv run python main.py`   | `python3 main.py`                                                       |\n\n## Configuration\n\nConfiguration lives in [`configuration.json`](./configuration.json).\n\n\n### `logging`\n\n- `level`: Python logging level integer (for example `20` for INFO).\n\n### `nfc`\n\n- `path`: NFC frontend path string.\n\nExamples:\n\n- PN532 serial: `tty:usbserial-0001:pn532`\n- ACR122U USB: `usb:072f:2200`\n\nIf you need to discover serial ports:\n\n```bash\n# Linux\nls /dev/*\n\n# macOS\nls /dev/tty.*\n```\n\n### `aliro`\n\n- `persist`: path to JSON state file used by repository storage;\n- `flow`: preferred minimum authentication flow. Supported values:\n  - `expedited` / `fast` -\u003e `FAST`,\n  - `standard` -\u003e `STANDARD`,\n  - `attestation` / `step_up` / `stepup` -\u003e `STEP_UP`;\n- `version`: optional Aliro protocol version preference (`AUTH0` tag `0x5C`) as either a single code or ordered priority list:\n  - single code examples: `\"1.0\"`, `\"0100\"`, `\"0x0100\"`, `256`;\n  - list example: `[\"0100\", \"0009\"]`;\n  - omitted / `\"default\"` / `null` / `[]`: default behavior, prefer `1.0` (`0100`) if supported by the endpoint, otherwise use the highest endpoint-advertised version.\n- `authentication_policy`: user authentication policy string; supported values:\n  - `user_device_setting` / `user` / `original` / `express` -\u003e `USER_DEVICE_SETTING` (0x01),\n  - `secure` -\u003e `USER_DEVICE_SETTING_SECURE_ACTION` (0x02),\n  - `force` -\u003e `FORCE_USER_AUTHENTICATION` (0x03),\n  defaults to `user`;\n- `reader_certificate`: optional `LOAD CERT` source used before `AUTH1` when transaction goes through Standard/Step-up path:\n  - `false` / omitted: do not send `LOAD CERT`;\n  - `true`: generate a profile0000 certificate once at startup from `reader_private_key` using a generated intermediate subject key; active `reader_private_key` is then replaced with that intermediate private key for authentication;\n  - `string`: profile0000 certificate bytes encoded as hex or base64;\n  configured certificates are validated locally for profile format, and subject key is checked against `reader_private_key`;\n- `step_up_scopes`: optional scope request map used in Step-up DeviceRequest for requested docTypes (`aliro-a` / `aliro-r` selected automatically from signaling bitmask):\n  - string/array of strings: all scopes are sent with `keep=true`;\n  - object map `scope -\u003e keep marker`: each marker can be boolean or string (`keep` / `nokeep`);\n  - defaults to `{\"matter1\": true}` when omitted.\n- `reader_private_key`: reader private key as hex;\n- `reader_group_identifier`: group identifier as hex;\n- `reader_group_sub_identifier`: reader group sub-identifier as hex.\n\n\n## Project Structure\n\n- [`main.py`](./main.py): runtime entrypoint, configuration loading, NFC loop, signal handling;\n- [`aliro/`](./aliro): core Aliro protocol/authentication logic module;\n- [`repository.py`](./repository.py): state persistence for reader metadata/endpoints;\n- [`util/afclf.py`](./util/afclf.py): modified contactless frontend transport helpers;\n- [`util/`](./util): cryptography, ISO7816, TLV, ECP helpers.\n\n## Runtime Artifacts\n\nBy default, the following state file is used:\n\n- `persist.json`: stored endpoint data and reader identifiers.\n\n## Current Limitations\n\n- The project currently does not offer built-in Aliro credential provisioning or generation;\n- Because of this, credential issuer validation is also currently omitted;\n- Implementation predates the published Aliro specification and is only partially aligned, although sufficient for Fast and Standard flow.\n\n## Contributing\n\nIf you've encountered an issue or would like to help improve this project, feel free to open an issue or submit a pull request.\n\nUse of AI-assisted tools for contributions is welcome. However, as AI is a powerful tool that is subject to abuse, any wide-reaching or architectural changes made with AI assistance should be consulted with the maintainers beforehand.\n\n## Security Notes\n\n- This code is provided as-is. Considering the sensitive nature of authentication and security, the maintainers assume no responsibility for any issues that may arise while using this project;\n- Logs and state files can contain sensitive data (keys, identifiers, endpoint metadata);\n- Do not publish raw logs or state files from real environments.\n\n## References\n\n- [Specifications - Connectivity Standards Alliance](https://csa-iot.org/developer-resource/specifications-download-request/) - official Aliro specification;\n- [Aliro - kormax](https://github.com/kormax/aliro) - aliro protocol info based on wallet app research;\n- [Apple Home Key Reader - kormax](https://github.com/kormax/apple-home-key-reader) - original Apple Home Key implementation used as the base for this project;\n- [Enhanced Contactless Polling](https://github.com/kormax/apple-enhanced-contactless-polling) - Polling Loop Annotations, ECP.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkormax%2Fpython-aliro-reader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkormax%2Fpython-aliro-reader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkormax%2Fpython-aliro-reader/lists"}