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.2.0.tar.gz (8.1 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.2.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yadacoin_agent_auth-1.2.0.tar.gz
  • Upload date:
  • Size: 8.1 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.2.0.tar.gz
Algorithm Hash digest
SHA256 1dded661d01a61dfa3f740e9a9c2a8e75a44ada03d89f5bde39fbff8d422b80e
MD5 dcabefd98dc9649e1f53cb3d366149cd
BLAKE2b-256 901d5851d52286f173f53fc5e896ea621db9e40b506d53109a0b678bbfc3b55f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for yadacoin_agent_auth-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 446753d6ea1479741a68c81e578f6cba2ed81c3e7b275a1549f41e28d2bfa373
MD5 6a67b1657788c54ff7b06e87d462c6cc
BLAKE2b-256 e432a78d7d6800ccc572275b4ecfd1c64d53c4e0aaa8323549d9ad1bebb1684b

See more details on using hashes here.

Provenance

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