JOSE protocol implementation in Python with support for JSON Web Algorithms, Keys, and Signatures
73
A lightweight audit record model that must support partial and full JSON conversion for nested objects, plus robust string serialization for storage and transport.
Alice viewing /systems/1 yields a mapping where resource, action, and details are plain types while actor remains a library-aware object instead of a dict; the details map contains {"ip": "127.0.0.1"} @testname, role, claims, and an ISO-8601 issued_at string; details keeps the ip entry @test@generates
from dataclasses import dataclass, field
from datetime import datetime
from typing import Any, Dict, Union
@dataclass
class ActorProfile:
name: str
role: str
issued_at: datetime
claims: Dict[str, Any] = field(default_factory=dict)
def to_partial_json(self) -> Any: ...
def to_json(self) -> Any: ...
@classmethod
def from_json(cls, jobj: Any) -> "ActorProfile": ...
@dataclass
class AuditRecord:
actor: ActorProfile
resource: str
action: str
details: Dict[str, Any] = field(default_factory=dict)
def to_partial_json(self) -> Any: ...
def to_json(self) -> Any: ...
def dumps(self, pretty: bool = False) -> str: ...
@classmethod
def loads(cls, data: Union[str, bytes]) -> "AuditRecord": ...Use the package's JSON serialization helpers to implement partial vs full conversion, safe loading from JSON strings, and pretty output.
Install with Tessl CLI
npx tessl i tessl/pypi-josepyevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10