Skip to main content

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.

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.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiveth 0.3.0
File Size Uploaded Provenance Actions
aiveth-0.3.0.tar.gz 21.5 kB Without provenance Details for aiveth-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiveth 0.3.0
File Interpreter ABI Platform Actions
aiveth-0.3.0-py3-none-any.whl Python 3 none any Details for aiveth-0.3.0-py3-none-any.whl

Total release size: 41.0 kB

Release files / aiveth-0.3.0.tar.gz

Download URL aiveth-0.3.0.tar.gz
Size 21.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3e69e78b21116374e05391351140e7223d456d626a5ab94f26bf5fd96b8de337
BLAKE2b-256 checksum
How to use checksums
2d4a70b56b3cf32e563e9a86edd6780f796f12bf6715692a2b2cc5f2104b8efc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / aiveth-0.3.0-py3-none-any.whl

Download URL aiveth-0.3.0-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb44f687f4b7dd2d22ad27dc513d79a4534daf997f6177e7d40a92c218fdf0e3
BLAKE2b-256 checksum
How to use checksums
2e51544590d350821eb1a067ee33b35050663f97ff9ba885877914f45872d573
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for aiveth 0.3.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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page