CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-josepy

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

73

1.15x
Overview
Eval results
Files

task.mdevals/scenario-9/

Key Registry Helpers

Utilities for deduplicating asymmetric keys and exposing immutable connection settings for secure clients. Use the dependency's built-in comparable key wrappers for equality and hashing, and its immutable mapping utility for frozen configuration state.

Capabilities

Deduplicate keys by material

  • Loading the same RSA private key from PEM twice results in one stored entry after initialization; mixing with a different RSA key keeps two unique entries. @test

Public-only view

  • Requesting public keys returns unique public variants matching stored private keys and ignores duplicate material. @test

Metadata lookup by key

  • A mapping from key to label allows retrieving the label using another object representing the same underlying RSA key material. @test

Immutable connection options

  • Creating connection options with host/port/timeouts yields attribute access; calling merge returns a new instance with overrides while the original remains unchanged and both are hashable. @test

Implementation

@generates

API

from typing import Any, Iterable, Mapping, Sequence

class KeyRegistry:
    def __init__(self, keys: Sequence[Any] = ()): ...
    def add(self, key: Any, label: str = "") -> None: ...
    def keys(self) -> Iterable[Any]: ...
    def public_keys(self) -> Iterable[Any]: ...
    def key_labels(self) -> Mapping[Any, str]: ...

class ConnectionOptions:
    def __init__(self, **kwargs): ...
    def merge(self, **kwargs) -> "ConnectionOptions": ...
    def as_mapping(self) -> Mapping[str, Any]: ...

Dependencies { .dependencies }

josepy { .dependency }

Provides comparable wrappers for cryptography keys and immutable mapping utilities. @satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-josepy

tile.json