idswyft
idswyft is the Python SDK for IDSwyft. It gives
your backend a typed way to issue and verify identity assertions, hand off
SSO flows, and exchange short-lived tokens for the user's verified attributes.
Use it to add "login with IDS" to a Flask/FastAPI app, or to verify an
assertion your service receives from a partner system.
Features
Client(client_id=, client_secret=)with typed request/response models.Authorization.begin(...)— return the redirect URL for a login handoff.Authorization.exchange(code)— swap the callback code for anAssertion.Client.verify(assertion)— verify signature, expiry, and audience.- Attribute accessors on an
Assertion:sub,email,scopes,expires_at. - Sync and async APIs; thread-safe single client instance.
Installation
pip install idswyft
# with FastAPI helpers (SignIn callback, session cookie):
pip install "idswyft[fastapi]"
Quick start
from idswyft import Client
client = Client(client_id="ic_...", client_secret="cs_...")
# Step 1: send the user to IDS
auth_url = client.authorization.begin(
redirect_uri="https://app.example.com/auth/callback",
scope=["openid", "email"],
)
# Step 2: on the callback, exchange the code:
assertion = client.authorization.exchange(code=request.args["code"])
print(assertion.sub, assertion.email, assertion.expires_at)
# Step 3: verify a token you received later:
verified = client.verify(assertion_token)
API
idswyft.Client.authorization.begin(redirect_uri, scope=)— return a URL.idswyft.Client.authorization.exchange(code)— return anAssertion.idswyft.Client.verify(token)— return a verifiedAssertionor raise.idswyft.fastapi.install(app, client, callback_path=)— wire the callback.
Configuration
Client reads IDSWYFT_CLIENT_ID, IDSWYFT_CLIENT_SECRET, and
IDSWYFT_ISSUER from the environment. The FastAPI helper also reads
IDSWYFT_COOKIE_NAME (default idswyft_session).
License
MIT
Metadata
Release files for idswyft 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| idswyft-0.1.0.tar.gz | 5.8 kB | Without provenance | Details for idswyft-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| idswyft-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for idswyft-0.1.0-py3-none-any.whl |
Total release size: 12.4 kB
Release files / idswyft-0.1.0.tar.gz
| Download URL | idswyft-0.1.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7f7b345217bba8e7010f18e25d880b4ac0923ac86b10eafe1edeba925e90fac
|
|
BLAKE2b-256 checksum How to use checksums |
45dc19cb2d9d01f2b357111009dafa2719b3d507efe977a418116b92884ebcce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / idswyft-0.1.0-py3-none-any.whl
| Download URL | idswyft-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ddda627130bffcd6cdd00edb26a92643ca39caa8b3078e8b5fc08e669e238f4
|
|
BLAKE2b-256 checksum How to use checksums |
5edcd5b35f1a878afdf807b1392b8e9005e1021126d01dbdebfbf1686f8cbdc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for idswyft 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.