Checks receipt integrity, hash validity, optional Ed25519 signature, or remote verification; returns True only on definitive success.
# Source: https://github.com/yvgude/lean-ctx | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
def verify(self) -> bool:
"""Return only affirmative verification; all uncertainty is ``False``."""
if self.integrity_status != "sealed" or not self._canonical_json:
return False
if not isinstance(self.canonical_hash, str) or not _SHA256.fullmatch(self.canonical_hash):
return False
digest = "sha256:" + hashlib.sha256(self._canonical_json).hexdigest()
if digest != self.canonical_hash:
return False
public_key = getattr(self, "_public_key", None)
if self.signature and public_key:
return
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key