Metadata-Version: 2.4
Name: identiblok-authid
Version: 0.1.0a1
Summary: Server SDK for Identiblok AuthID, SAML, OIDC and signed permissions
License-Expression: MIT
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography<51,>=46
Requires-Dist: requests<3,>=2.32.4
Requires-Dist: PyJWT[crypto]<3,>=2.10.1
Requires-Dist: python3-saml<2,>=1.16
Dynamic: license-file

# Identiblok AuthID Python SDK · 0.1.0 alpha


Five languages, three integrations: OIDC, SAML, and signed permission decisions.
These are backend integration modules, not complete web applications. Your framework
supplies routes, cookies, CSRF protection and an authenticated application session.

## Configuration

Use your developer workspace to verify a website, register SAML entity/ACS/public
certificate or an OIDC callback, and create a least-privilege server API key.
Keep all private keys and API/client secrets in your backend's secret manager.

Environment names in the examples:

- AUTHID_APPLICATION_ID: application UUID from the workspace.
- AUTHID_API_KEY: server API key scoped to permissions:read.
- AUTHID_STATE_DB: absolute path to a persistent local SQLite database.
- AUTHID_CHECKPOINT_DIR: persistent checkpoint directory for the Node permission client.
- AUTHID_SAML_ENTITY_ID, AUTHID_SAML_ACS_URL: exact registered SP identifiers.
- AUTHID_IDP_CERT_FILE: pinned customer IdP public certificate from app metadata.
- AUTHID_SP_KEY_FILE, AUTHID_SP_CERT_FILE: matching SP RSA private key and public certificate files.
- AUTHID_OIDC_CLIENT_ID, AUTHID_OIDC_CLIENT_SECRET, AUTHID_OIDC_REDIRECT_URI: confidential client settings.

Customer issuer: https://auth.identiblok.com. Do not use staff SSO metadata.
Use OIDC scopes `openid profile`, not `email`. Callbacks must be HTTPS, without
fragments; these examples use callback URLs without query parameters.

## Browser and session contract

Generate 32 random bytes, encode as unpadded base64url (43 characters), and set a
five-minute `__Host-authid-tx` cookie: Secure, HttpOnly, Path=/, no Domain attribute.
SAML requires SameSite=None for its cross-site POST; OIDC GET can use SameSite=Lax.
Pass that cookie value into begin and complete. Reject missing cookies and duplicate
callback fields. Never accept a binding supplied through query or form parameters.

Do not create your app session until complete returns a verified AuthID. Rotate the
app session ID, delete the transaction cookie, and use a separate protected session
cookie. Keep normal CSRF protection on app actions. SAML single logout is not
supported; logging out of your app requires clearing its own session.

Permission subjects must come from the verified server session. `require` or
`require_permission` throws on denied access, invalid signatures, stale responses,
wrong request parameters, rollback or unavailable checkpoint storage. Propagate
failures as access denied. Do not cache positive permission decisions.

## Storage contract

SQLite and Node file adapters are for one persistent host. They are unsuitable for
Vercel ephemeral filesystems. Multi-host/serverless users must supply shared durable
storage. Login transaction operations:

- put(key, value, ttl_seconds): insert only if absent; return true on success.
- get(key): return the unexpired string or null/None.
- take(key): atomically delete and return the unexpired string; one caller wins.

Permission checkpoint `advance(scope, height, block_hash)` must atomically reject a
lower height or a conflicting hash at the same height. Persist the accepted value
before returning true. Node's existing CheckpointStore receives a `{height, hash}`
object instead. Store outages must throw or fail closed, never reset checkpoints.
Protect database files with OS permissions and backups. Transaction values include
OIDC PKCE secrets; never log them. A failed OIDC callback consumes its transaction;
start a fresh login instead of retrying the same authorization code.

## Packages

Node.js/TypeScript: published @identiblok/authid 0.1.0 for SAML/permissions,
openid-client 6 for OIDC. Node examples require Node 24 for node:sqlite.
Python, Ruby and Rust: new alpha SDKs downloaded with this guide, not registry releases.
The APIs provide verified sign-in and permission checks plus a bounded generic
/v1 API request helper. Webhook and ledger-block helpers are currently Node-only.
The network remains a single-authority signed ledger, not decentralized consensus.
