ledgix-python 0.1.3__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/PKG-INFO +2 -2
  2. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/README.md +1 -1
  3. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/pyproject.toml +1 -1
  4. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/src/ledgix_python/__init__.py +1 -1
  5. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/src/ledgix_python/client.py +25 -2
  6. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/src/ledgix_python/models.py +2 -0
  7. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/.gitignore +0 -0
  8. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/demo.py +0 -0
  9. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/requirements.txt +0 -0
  10. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/src/ledgix_python/adapters/__init__.py +0 -0
  11. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/src/ledgix_python/adapters/crewai.py +0 -0
  12. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/src/ledgix_python/adapters/langchain.py +0 -0
  13. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/src/ledgix_python/adapters/llamaindex.py +0 -0
  14. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/src/ledgix_python/config.py +0 -0
  15. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/src/ledgix_python/enforce.py +0 -0
  16. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/src/ledgix_python/exceptions.py +0 -0
  17. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/tests/__init__.py +0 -0
  18. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/tests/conftest.py +0 -0
  19. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/tests/test_adapters.py +0 -0
  20. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/tests/test_client.py +0 -0
  21. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/tests/test_enforce.py +0 -0
  22. {ledgix_python-0.1.3 → ledgix_python-0.1.4}/tests/test_models.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ledgix-python
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Agent-agnostic compliance shim for SOX 404 policy enforcement via the ALCV Vault
5
5
  Project-URL: Homepage, https://github.com/ledgix-dev/python-sdk
6
6
  Project-URL: Documentation, https://docs.ledgix.dev
@@ -40,7 +40,7 @@ Description-Content-Type: text/markdown
40
40
 
41
41
  # Ledgix ALCV — Python SDK
42
42
 
43
- [![PyPI](https://img.shields.io/badge/pypi-v0.1.3-blue)](https://pypi.org/project/ledgix-python/)
43
+ [![PyPI](https://img.shields.io/badge/pypi-v0.1.4-blue)](https://pypi.org/project/ledgix-python/)
44
44
  [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)](https://python.org)
45
45
  [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
46
46
 
@@ -1,6 +1,6 @@
1
1
  # Ledgix ALCV — Python SDK
2
2
 
3
- [![PyPI](https://img.shields.io/badge/pypi-v0.1.3-blue)](https://pypi.org/project/ledgix-python/)
3
+ [![PyPI](https://img.shields.io/badge/pypi-v0.1.4-blue)](https://pypi.org/project/ledgix-python/)
4
4
  [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)](https://python.org)
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
6
6
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ledgix-python"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "Agent-agnostic compliance shim for SOX 404 policy enforcement via the ALCV Vault"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -34,7 +34,7 @@ from .models import (
34
34
  PolicyRegistrationResponse,
35
35
  )
36
36
 
37
- __version__ = "0.1.1"
37
+ __version__ = "0.1.4"
38
38
 
39
39
  __all__ = [
40
40
  # Core
@@ -526,6 +526,21 @@ class LedgixClient:
526
526
  for entry in sorted_entries:
527
527
  if entry.prev_row_hash != previous_row_hash:
528
528
  raise TokenVerificationError(f"Ledger chain broken at seq {entry.seq}")
529
+ previous_row_hash = entry.row_hash
530
+
531
+ first_signed_entry_index = next(
532
+ (
533
+ index
534
+ for index, entry in enumerate(sorted_entries)
535
+ if entry.receipt_payload and entry.row_signature and entry.signer_key_id
536
+ ),
537
+ -1,
538
+ )
539
+ if first_signed_entry_index == -1:
540
+ raise TokenVerificationError("No signed receipt proof data is available for this ledger yet")
541
+
542
+ signed_entries = sorted_entries[first_signed_entry_index:]
543
+ for entry in signed_entries:
529
544
  if not entry.receipt_payload or not entry.row_signature or not entry.signer_key_id:
530
545
  raise TokenVerificationError(f"Missing receipt proof data at seq {entry.seq}")
531
546
  if not algorithm.verify(
@@ -534,7 +549,6 @@ class LedgixClient:
534
549
  self._decode_base64url(entry.row_signature),
535
550
  ):
536
551
  raise TokenVerificationError(f"Ledger receipt signature invalid at seq {entry.seq}")
537
- previous_row_hash = entry.row_hash
538
552
 
539
553
  previous_manifest_hash = "sha256:" + ("0" * 64)
540
554
  sorted_manifests = sorted(manifests, key=lambda item: item.period_start)
@@ -565,10 +579,17 @@ class LedgixClient:
565
579
 
566
580
  return LedgerVerificationResult(
567
581
  intact=True,
568
- verified_entries=len(sorted_entries),
582
+ verified_entries=len(signed_entries),
569
583
  verified_manifests=len(sorted_manifests),
570
584
  latest_row_hash=sorted_entries[-1].row_hash if sorted_entries else None,
571
585
  latest_manifest_hash=sorted_manifests[-1].manifest_hash if sorted_manifests else None,
586
+ legacy_unsigned_entries=first_signed_entry_index,
587
+ coverage_note=(
588
+ f"Verified signed receipts from seq {signed_entries[0].seq} onward. "
589
+ f"{first_signed_entry_index} earlier {'entry predates' if first_signed_entry_index == 1 else 'entries predate'} signed receipt proofs."
590
+ if first_signed_entry_index > 0
591
+ else None
592
+ ),
572
593
  )
573
594
  except Exception as exc:
574
595
  return LedgerVerificationResult(
@@ -577,6 +598,8 @@ class LedgixClient:
577
598
  verified_manifests=0,
578
599
  latest_row_hash=None,
579
600
  latest_manifest_hash=None,
601
+ legacy_unsigned_entries=0,
602
+ coverage_note=None,
580
603
  error=str(exc),
581
604
  )
582
605
 
@@ -116,4 +116,6 @@ class LedgerVerificationResult(BaseModel):
116
116
  verified_manifests: int
117
117
  latest_row_hash: str | None = None
118
118
  latest_manifest_hash: str | None = None
119
+ legacy_unsigned_entries: int = 0
120
+ coverage_note: str | None = None
119
121
  error: str | None = None
File without changes
File without changes