CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-josepy

tessl install tessl/pypi-josepy@2.1.0

JOSE protocol implementation in Python with support for JSON Web Algorithms, Keys, and Signatures

Agent Success

Agent success rate when using this tile

73%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.16x

Baseline

Agent success rate without this tile

63%

task.mdevals/scenario-5/

JOSE Payload Codec

Utility for encoding and decoding payloads using JOSE-style, URL-safe Base64 without padding.

Capabilities

Encode bytes to JOSE Base64

  • Encoding a simple payload like b"hello" returns a URL-safe Base64 string with no = padding. @test

Decode JOSE Base64 to bytes

  • Decoding a JOSE Base64 string produced by encode_compact yields the original bytes even when padding is absent. @test

Validate inputs

  • Encoding rejects inputs that are not bytes or ASCII text, raising a ValueError. @test
  • Decoding rejects strings containing invalid Base64 URL-safe characters, raising a ValueError. @test

Implementation

@generates

API

def encode_compact(payload: bytes) -> str:
    """Convert bytes to a JOSE-compatible Base64 URL-safe string without padding."""

def decode_compact(data: str) -> bytes:
    """Return bytes from a JOSE Base64 string, accepting missing padding and rejecting invalid characters."""

def encode_ascii_text(text: str) -> str:
    """Accept ASCII-only text, encode to bytes using ASCII, then return its JOSE Base64 representation."""

Dependencies { .dependencies }

josepy { .dependency }

Provides JOSE Base64 helpers for URL-safe encoding/decoding without padding.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/josepy@2.1.x
tile.json