prereg_seal.anchor

External time anchors — turning "sealed" into "sealed before".

The honest-scope table has always said a digest carries no time, and it is right: nothing about a hash establishes when it was computed. That matters, because the failure preregistration exists to prevent is writing the criteria after seeing the result. A seal alone does not stop that. Only an upper bound on when the seal existed does.

There is no cryptographic trick that produces one offline. Establishing that something existed before a moment requires a witness you do not control — a public log that recorded it. So this module does not invent a bound; it records where the digest was published and then goes and checks.

Three verdicts, and the third is the point:

ANCHORED The digest really is at the locator, and the host reports a time. The bound is only as good as that host's word, which is stated in the record rather than implied.

REFUTED The locator exists and the digest is not there. Somebody's story does not hold up.

UNANCHORED The locator could not be reached, or no time was reported. Abstention. The local claim is never accepted on its own — a record that asserted itself would be exactly the thing this module exists to replace.

Standard library only, and the network is never touched unless you ask for it.

ANCHOR_FORMAT = 'prereg-anchor/1'
ANCHORED = 'ANCHORED'
REFUTED = 'REFUTED'
UNANCHORED = 'UNANCHORED'
KINDS = ('github-commit', 'url')
class AnchorError(builtins.ValueError):

A malformed anchor record or locator.

def make_anchor(digest: str, kind: str, locator: str, *, note: str = '') -> Dict:

Build an unverified anchor record.

It is unverified on purpose. Creating the record proves nothing; only verify_anchor() does, and only by going and looking.

def parse_github_commit(locator: str) -> Dict[str, str]:

Split owner/repo@sha or a github.com commit URL into its parts.

def verify_anchor( record: Dict, *, fetch: Optional[Callable[[str, float], str]] = None, timeout: float = 15.0, allow_network: bool = True) -> Dict:

Check the digest really is where the record says, and when.

fetch(url, timeout) -> text can be supplied to test this without a network, or to route through your own client. With allow_network=False and no fetch, the result is UNANCHORED — never an accepted claim.

def describe(result: Dict) -> str:

A human-readable line that does not overstate what was established.