Skip to main content

Server-side SDK for the YadaCoin KEL Agent Auth Protocol

Project description

yadacoin-agent-auth (Python)

Server-side Python SDK for the YadaCoin KEL Agent Auth Protocol.

Implements protocol version 1.2.

Install

# Core (uses public REST API for KEL lookup — no local node required)
pip install yadacoin-agent-auth[rest]

# With a locally running YadaCoin node
pip install yadacoin-agent-auth[node]

Quick start (Tornado)

import os
from yadacoin_agent_auth import AgentAuthValidator, YadaCoinRestKelProvider, AuthError

validator = AgentAuthValidator(
    challenge_secret=os.environ["YADACOIN_AGENT_SECRET"].encode(),
    kel_provider=YadaCoinRestKelProvider("https://yadacoin.io"),
)

# GET /challenge?public_key=<hex>
class ChallengeHandler(BaseHandler):
    async def get(self):
        public_key = self.get_argument("public_key")
        self.write(validator.make_challenge(public_key))

# POST /action
class ActionHandler(BaseHandler):
    async def post(self):
        body = json.loads(self.request.body)
        try:
            auth = await validator.validate(
                public_key=body["public_key"],
                challenge=body["challenge"],
                signature=body["signature"],
            )
        except AuthError as exc:
            self.set_status(exc.http_status)
            return self.write({"error": str(exc)})

        # auth.scope — normalised from W3C VC 2.0 or legacy flat format
        # auth.address — P2PKH address of the verified agent key
        validator.enforce_scope(auth, services=body.get("services"), dest=body.get("dest"))
        # ... your service logic ...

Credential status modes

VCs issued with credentialStatus.mode: "rotation" (default) are one-time-use — the key is revoked once it appears in the KEL. VCs with mode: "temporal" survive key rotations; the verifier instead checks that the VP is signed with the current active key per the KEL.

See §5.1 of the spec for full semantics.

Related

License

YadaCoin Open Source License (YOSL) v1.1 — Copyright © 2017-2026 Matthew Vogel, Inc.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yadacoin_agent_auth-1.3.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yadacoin_agent_auth-1.3.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file yadacoin_agent_auth-1.3.0.tar.gz.

File metadata

  • Download URL: yadacoin_agent_auth-1.3.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yadacoin_agent_auth-1.3.0.tar.gz
Algorithm Hash digest
SHA256 fe6fc2baa32273b3f9d50799b44cf6287f31bad77e834227b811d40fd5c42377
MD5 ecc058bc97f318df0d7dc1cd5ee0f884
BLAKE2b-256 f6ff058429f3965061fad55afada2466b8faca8c5b53c251f79f47298918594a

See more details on using hashes here.

Provenance

The following attestation bundles were made for yadacoin_agent_auth-1.3.0.tar.gz:

Publisher: ci.yml on pdxwebdev/yadacoin-agent-auth-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yadacoin_agent_auth-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for yadacoin_agent_auth-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e7c875af0002f37afa9e3077171d1cb1915d4585d2ba11994280309389a4165
MD5 2d04557cce8f9262b804bb4730590ef7
BLAKE2b-256 c5476f820c919dba6cde7980749fd889aabb59c4d6267c204535837f85dad7d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for yadacoin_agent_auth-1.3.0-py3-none-any.whl:

Publisher: ci.yml on pdxwebdev/yadacoin-agent-auth-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page