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.1.tar.gz (9.6 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.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yadacoin_agent_auth-1.3.1.tar.gz
  • Upload date:
  • Size: 9.6 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.1.tar.gz
Algorithm Hash digest
SHA256 a1637f86f9f53626987aab315aa96e4b3a9e8f5a94bce65aecd245f9abe1c23e
MD5 7fe1f27550fef542596d1d36512a8511
BLAKE2b-256 54b4c14823e0a1c50c9ea1ed632e14d623b5921754947449ee020df030fc5457

See more details on using hashes here.

Provenance

The following attestation bundles were made for yadacoin_agent_auth-1.3.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for yadacoin_agent_auth-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 786f3f7bfcfb133ff833d600779a5992f28e74d6dae3fb76a57f11d324053cbd
MD5 f2f9bb13dc322a21bdef726c4e5f0a80
BLAKE2b-256 16552131189c8bae77c51af3a113d184f7c120ff5bda45237980585475235bfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for yadacoin_agent_auth-1.3.1-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