Skip to content

Commit 6a26c1a

Browse files
committed
fix: mypy/typing CI for v3.0.3
1 parent cf76a4b commit 6a26c1a

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

docs/package/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ This document provides a chronological list of notable changes for each version
99
- `ENCYPHER_C2PA_CONTEXT_URL` controls the emitted `@context` during embedding.
1010
- `ENCYPHER_C2PA_ACCEPTED_CONTEXTS` controls the verifier allowlist (JSON list or comma-separated string).
1111
- Default verifier allowlist accepts both C2PA schema contexts v2.2 and v2.3 to avoid false `SIGNATURE_INVALID` failures when signing emits v2.3.
12+
- Restored green CI by fixing `mypy` typing issues:
13+
- Corrected internal helper type signatures.
14+
- Added missing return type annotations.
15+
- Cleaned up unused imports caught by linters.
1216

1317
## 3.0.2 (2026-01-10)
1418

encypher/core/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Core encoding and decoding functionality for Encypher.
33
"""
44

5+
from typing import Any
6+
57
from encypher.core.keys import generate_ed25519_key_pair as generate_key_pair
68
from encypher.core.keys import load_private_key_from_data as load_private_key
79
from encypher.core.keys import load_public_key_from_data as load_public_key
@@ -21,7 +23,7 @@
2123
]
2224

2325

24-
def __getattr__(name: str):
26+
def __getattr__(name: str) -> Any:
2527
if name in {"MetadataTarget", "UnicodeMetadata"}:
2628
from encypher.core.unicode_metadata import MetadataTarget, UnicodeMetadata
2729

encypher/core/unicode_metadata.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from cryptography.exceptions import InvalidSignature
2121
from cryptography.hazmat.primitives.asymmetric import ed25519
2222
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey, Ed25519PublicKey
23-
from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes
2423

2524
from encypher import __version__
2625
from encypher.config.settings import Settings
@@ -737,7 +736,7 @@ def embed_metadata(
737736
return embedded_text
738737

739738
@staticmethod
740-
def _compute_text_hash(cls, text: str, algorithm: str = "sha256") -> str:
739+
def _compute_text_hash(text: str, algorithm: str = "sha256") -> str:
741740
"""Compute hex digest of *text* using *algorithm* after NFC normalization."""
742741
import hashlib
743742
import unicodedata
@@ -754,7 +753,7 @@ def _compute_text_hash(cls, text: str, algorithm: str = "sha256") -> str:
754753
def _embed_c2pa(
755754
cls,
756755
text: str,
757-
private_key: PrivateKeyTypes,
756+
private_key: SigningKey,
758757
signer_id: str,
759758
claim_generator: Optional[str],
760759
actions: Optional[list[dict[str, Any]]],

0 commit comments

Comments
 (0)