Metadata-Version: 2.4
Name: authlyx-api
Version: 3.0.0b2
Summary: Official Python SDK for AuthlyX: licensing, user sign-in, device locks, offline access and update prompts
Author: AuthlyX
License-Expression: MIT
Project-URL: Homepage, https://authlyx.dev
Project-URL: Documentation, https://docs.authlyx.dev
Project-URL: Source, https://github.com/authlyx/AuthlyX-pip-library
Project-URL: Examples, https://github.com/authlyx/AuthlyX-PY-Example
Keywords: authlyx,licensing,license,authentication,hwid
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography<51,>=50.0.2
Requires-Dist: aiohttp<4,>=3.14.5
Dynamic: license-file

# AuthlyX Python package

The `authlyx-api` package on PyPI. Official Python SDK for AuthlyX V3 (3.0.0 beta).

Full documentation: https://docs.authlyx.dev

## Requirements

- Windows
- Python 3.11 or newer

## Run the example

This repo is the package itself. For a full console example, see [AuthlyX-PY-Example](https://github.com/authlyx/AuthlyX-PY-Example). To try the package from this folder:

```bat
pip install .
```

You can find your app key under your app's credentials in the [dashboard](https://dash.authlyx.dev).

## Add it to your own project

```bat
pip install --pre authlyx-api
```

```python
import asyncio
from authlyx_api import AuthlyX

async def main():
    app = AuthlyX("YOUR_APP_KEY", "1.0.0")
    connected = await app.initialize()
    print("Connected" if connected.ok else connected.message)

asyncio.run(main())
```

Every method can be awaited. You can also pass `completed=` with a callback instead.

## Signing in

```python
await app.login("YOUR_USERNAME", "YOUR_PASSWORD")
await app.login("YOUR_LICENSE_KEY")
await app.deviceLogin()
```

Device login signs in the current Windows user without a form. The device has to be approved in your app first. See [Device login](https://docs.authlyx.dev/guides/device-login).

After signing in, the account details are in `userData`:

```python
username = app.userData["Username"]
plan = app.userData["Plan"]
expiry = app.userData["ExpiryDate"]
```

Every method has its own page with examples under [SDK methods](https://docs.authlyx.dev/sdks/methods/login).

## Starting up and updates

`initialize()` returns one of these codes:

| Code | Success | Meaning |
| --- | --- | --- |
| `APP_INITIALIZED` | Yes | Connected. Continue to sign-in. |
| `OFFLINE_MODE` | Yes | No internet, but this PC has saved offline access. |
| `NETWORK_...` | No | No internet and nothing saved. Offer to try again. |
| `UPDATE_REQUIRED` | No | This version is older than the one set in your dashboard. |
| `VERSION_MISMATCH` | No | This version is newer than the dashboard version and is not allowed. |

On Windows the SDK shows update messages for you: an **Update required** or **Version not supported** box when this version is refused, and an **Update available** box once after sign-in when a newer release exists. Each one shows the release notes and offers to open the download page. Set versions and download links under your app's **Updates** settings in the [dashboard](https://dash.authlyx.dev).

To show your own screen instead, turn the box off:

```python
app = AuthlyX("YOUR_APP_KEY", "1.0.0", update_prompt=False)
```

The failed result's `update` data then has `version`, `notes` and `url`. More in [Updates](https://docs.authlyx.dev/guides/updates) and [Allowed Versions](https://docs.authlyx.dev/guides/allowed-versions).

## Offline access

Once someone is signed in, saving offline access stores a signed permit on that PC:

```python
saved = await app.saveOfflineAccess()
available = await app.hasOfflineAccess()
```

If they open your app later without internet, `initialize()` succeeds with the code `OFFLINE_MODE`, and they sign in with the same username and password or license key, and the SDK checks it against the saved permit. Each permit belongs to one app and one account, and signing out removes it. More in [Offline access](https://docs.authlyx.dev/guides/offline).

## Errors

A failed call gives you a `code` and a `message` you can show to the user. `initialize()` returns a result even without internet. Other calls raise `AuthlyXError` for network problems and setup errors, so wrap them in `try`. All codes are listed in [Errors](https://docs.authlyx.dev/api-reference/errors).

## Coming from 2.4

V3 is a new SDK, not a drop-in update. Apps use an app key instead of the old owner ID, app name and secret, and the method names changed. Read [Move from V2 to V3](https://docs.authlyx.dev/api-reference/migration) before you switch.

## License

MIT. See `LICENSE`.
