{"library":"pyseto","title":"PySETO","description":"PySETO is a Python implementation of PASETO (Platform-Agnostic SEcurity TOkens) and PASERK (Platform-Agnostic Serialized Keys). It supports all PASETO versions (v1, v2, v3, and v4) and purposes (local and public), having passed all official tests. The library is currently at version 1.9.1 and maintains a regular release cadence.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install pyseto"],"cli":null},"imports":["import pyseto","from pyseto import Key"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nimport pyseto\nfrom pyseto import Key\n\n# --- Example for v4.public (Asymmetric Signature) ---\n# In a real application, keys should be loaded securely, e.g., from environment variables or a KMS.\n# For demonstration, we use hardcoded keys. DO NOT USE IN PRODUCTION AS IS.\n# These PEMs are for Ed25519 (v4.public)\nprivate_key_pem = os.environ.get(\n    'PSETO_V4_PRIVATE_KEY_PEM',\n    b\"\"\"-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2VwBCIEILTL+0PfTOIQcn2VPkpxMwf6Gbt9n4UEFDjZ4RuUKjd0\n-----END PRIVATE KEY-----\n\"\"\").encode('utf-8')\n\npublic_key_pem = os.environ.get(\n    'PSETO_V4_PUBLIC_KEY_PEM',\n    b\"\"\"-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAHrnbu7wEfAP9cGBOAHHwmH4Wsot1ciXBHwBBXQ4gsaI=\n-----END PUBLIC KEY-----\n\"\"\").encode('utf-8')\n\n# 1. Create a private key for signing\nprivate_key = Key.new(version=4, purpose=\"public\", key=private_key_pem)\n\n# 2. Encode/Sign a PASETO token\npayload = {\"data\": \"this is a signed message\", \"user_id\": \"123\"}\nfooter = {\"kid\": \"v4-public-key-001\"}\ntoken = pyseto.encode(private_key, payload, footer=footer, serializer=pyseto.json_serializer)\nprint(f\"Generated Token: {token.decode()}\")\n\n# 3. Create a public key for verification\npublic_key = Key.new(version=4, purpose=\"public\", key=public_key_pem)\n\n# 4. Decode and verify the token\ndecoded_token = pyseto.decode(public_key, token, deserializer=pyseto.json_deserializer)\n\n# The payload and footer are accessible as dictionary-like objects if deserializer is used\nprint(f\"Decoded Payload: {decoded_token.payload}\")\nprint(f\"Decoded Footer: {decoded_token.footer}\")\n\nassert decoded_token.payload['data'] == \"this is a signed message\"\nassert decoded_token.footer['kid'] == \"v4-public-key-001\"\nprint(\"Token verified successfully!\")\n","lang":"python","description":"This quickstart demonstrates how to create and verify a PASETO token using the v4.public protocol for asymmetric signatures. It covers key generation from PEM bytes, encoding a payload with a footer, and decoding/verifying the token. It uses the built-in `json_serializer`/`json_deserializer` for dictionary payloads.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"1.8.5","pypi_latest":"1.9.3","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":3.1,"avg_import_s":0.24,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyseto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.21,"mem_mb":5.6,"disk_size":"43.6M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyseto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.2,"import_time_s":0.16,"mem_mb":5.6,"disk_size":"45M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyseto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.35,"mem_mb":6.5,"disk_size":"46.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyseto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3,"import_time_s":0.28,"mem_mb":6.5,"disk_size":"48M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyseto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.25,"mem_mb":6,"disk_size":"38.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyseto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.7,"import_time_s":0.26,"mem_mb":6,"disk_size":"39M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyseto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.24,"mem_mb":6.5,"disk_size":"38.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyseto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.9,"import_time_s":0.25,"mem_mb":6.4,"disk_size":"39M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyseto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.21,"mem_mb":6.6,"disk_size":"42.8M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyseto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.9,"import_time_s":0.21,"mem_mb":6.6,"disk_size":"44M"}]}}