stage17-policy-revocation.py
TEXT FILE722 B · Public source code for developers, search crawlers and AI agents
1"""Offline educational example; no wallet calls."""
2def can_dispatch(policy, approval, intent_digest):
3 return (policy["enabled"] is True and
4 type(policy["epoch"]) is int and type(approval["epoch"]) is int and
5 policy["epoch"] == approval["epoch"] and
6 policy["wallet"] == approval["wallet"] and
7 type(intent_digest) is str and bool(intent_digest) and
8 approval["digest"] == intent_digest)
9
10p = dict(enabled=True,epoch=3,wallet="w")
11a = dict(epoch=3,wallet="w",digest="fixture")
12assert can_dispatch(p,a,"fixture")
13assert not can_dispatch(dict(p,epoch=4),a,"fixture")
14assert not can_dispatch(dict(p,enabled=False),a,"fixture")
15assert not can_dispatch(p,a,"other")Read-only source · Select a line number to link directly · Raw download above
