aiveth
Aiveth by Gooclaim for Python (3.10 or later).
from aiveth import Aiveth, verify_webhook
aiveth = Aiveth("https://aiveth.example.com", api_key=os.environ["AIVETH_API_KEY"])
claims = aiveth.tokens.verify_id_token(id_token, client_id="your-app-client-id")
user = aiveth.tokens.user_from_access_token(access_token) # None once it has ended
machine = aiveth.tokens.verify_machine_token(token, org_id="your-organization-id")
event = verify_webhook(request.body, request.headers, os.environ["AIVETH_WEBHOOK_SECRET"])
people = aiveth.people.list()
aiveth.invitations.send("new.person@example.com")
report = aiveth.people.import_all(people_from_your_old_system)
Every refusal is a AivethError with Aiveth's own words and status.
A webhook may arrive twice within its 5 minutes: keep the webhook-ids you've handled and skip repeats.
Protect an MCP server (AI agents)
Register your MCP server in the console (AI agents → MCP servers) with its address and permissions. Then, in your server:
from aiveth import Aiveth, InsufficientScopeError, TokenVerificationError, challenge, protected_resource_metadata
MCP = "https://mcp.acme.com/mcp"
aiveth = Aiveth(base_url="https://aiveth.gooclaim.com")
# GET /.well-known/oauth-protected-resource/mcp
metadata = protected_resource_metadata(resource=MCP, base_url="https://aiveth.gooclaim.com", scopes=["files:read"])
# every MCP request
try:
who = aiveth.tokens.verify_mcp_token(bearer, resource=MCP, scopes=("files:read",))
except InsufficientScopeError:
status, header = 403, challenge(resource=MCP, scope=["files:read"], error="insufficient_scope")
except TokenVerificationError:
status, header = 401, challenge(resource=MCP, scope=["files:read"])
A token is for ONE MCP server (its aud); it lasts 10 minutes and the agent renews it.
Feature flags and the person's photo
from aiveth import has_flag
user = aiveth.tokens.verify_id_token(id_token, client_id=CLIENT_ID)
if has_flag(user, "new-billing"):
... # show the new billing page
user.get("picture") # their photo's address on Aiveth (with the `profile` scope)
A person's Google, Microsoft or GitHub token (connected accounts)
Turn on "Connected accounts" for the app in Aiveth, and let the person connect the account (Account → Connected for apps). Then, on your server:
google = aiveth.tokens.connected_token(access_token=access_token, connection="google",
client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
google["access_token"] # call Google as the person
Roles on parts of your organization (fine-grained permissions)
Make the types of part (like region → branch) and the roles for them in the console (Parts &
access). Then your server registers each part as it makes it, gives roles on parts, and asks:
aiveth.authorization.register(type="branch", external_id="mumbai", name="Mumbai",
parent_type="region", parent_external_id="west")
aiveth.authorization.give("branch", "mumbai", "branch_approver", person_id=ravi)
answer = aiveth.authorization.check(ravi, "claim:approve", "branch", "mumbai")
answer["allowed"], answer["via"]
A role on a part covers everything under it. The key needs authorization:read for the check,
resources:write to register parts and authorization:write to give roles.
Consent (India's DPDP Act) from your app's own screens
Publish your consent notice in the console (Privacy). If your app asks on its own screen instead of Aiveth's, record the answers, check before you use the data, and let people withdraw:
aiveth.consents.record(person_id, notice_version, {"service": True, "news": False})
if aiveth.consents.allows(person_id, "news"):
send_newsletter()
aiveth.consents.withdraw(person_id, "news")
receipt = aiveth.consents.receipt(person_id)["receipt"] # signed, checkable with your JWKS
aiveth.consents.import_all(notice_version, earlier_consents) # given before Aiveth
A yes with a time limit stops counting on its day, so always ask allows rather than keeping
the answer. The key needs consent:read to check and consent:write to record.
Development and production
Each environment has its own keys: aiveth_sk_test_… and apps okc_test_… for your Development
environment, aiveth_sk_live_… and okc_live_… for production.
A machine app's token, data to erase, AI agent actions (0.2.0)
token = aiveth.tokens.machine_token(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, scope="reports:read")
for task in aiveth.erasures.list():
... # erase it in your app
aiveth.erasures.done(task["id"])
aiveth.agent_actions.report(token=agent_token, action="claims.approve", idempotency_key=request_id)
Metadata
Release files for aiveth 0.4.1
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 |
|---|---|---|---|---|
| aiveth-0.4.1.tar.gz | 21.5 kB | Without provenance | Details for aiveth-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiveth-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for aiveth-0.4.1-py3-none-any.whl |
Total release size: 41.1 kB
Release files / aiveth-0.4.1.tar.gz
| Download URL | aiveth-0.4.1.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2075c3be710ea3fcef0949c7b288cb4de010d89edba05776f58c2330055216fa
|
|
BLAKE2b-256 checksum How to use checksums |
45db9fcabcb714bc4e1ef654662635889bc2076c90ae67198c6c110613a3e259
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.20
|
Release files / aiveth-0.4.1-py3-none-any.whl
| Download URL | aiveth-0.4.1-py3-none-any.whl |
|---|---|
| Size | 19.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ce025562ffd0a72eaa47f8f0fef5f29b79b6bb2e58393ce75f5989f57576c8f
|
|
BLAKE2b-256 checksum How to use checksums |
159d9442c2dd9fc1178e094b11c49f65dce156262cb97c68f0615b50926b972e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.20
|
Security for aiveth 0.4.1
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.