in reviewhumanPR #49Identity
hiten: add DidKeyIdentity helper accessors
This is a focused follow-up to my previous hackathon PR (#39). Following the merge of the DataFacts implementation in #31, this PR contributes an independent identity-layer API improvement by adding two small helper accessors to…
Description
The pitch.
## Summary This is a focused follow-up to my previous hackathon PR (#39). Following the merge of the DataFacts implementation in #31, this PR contributes an independent identity-layer API improvement by adding two small helper accessors to `DidKeyIdentity`. The change exposes the identity's agent ID through a public property and provides a helper for checking whether a peer's public key has been registered, without changing existing identity semantics. ## What - Add the `agent_id` property. - Add the `has_peer_key(agent)` helper. - Add focused unit tests covering both helper APIs. ## Why `DidKeyIdentity` already stores the identity's agent ID and maintains a registry of known peer public keys internally. Exposing these operations through dedicated helper APIs improves usability while preserving existing identity behavior. The `agent_id` property provides a stable public accessor instead of requiring downstream code to depend on private implementation details. The `has_peer_key(agent)` helper provides a clear, self-documenting way to determine whether a peer's public key has been registered, avoiding direct inspection of internal state and making downstream code more readable. These additions are intentionally lightweight, reusable, and do not modify signing, verification, key generation, or identity semantics. ## Scope This PR is intentionally limited to the `DidKeyIdentity` helper APIs and their associated unit tests. ## Verification - ✅ `make ci-local` ```bash uv sync uv run ruff check . uv run ruff format --check . uv run pyright uv run pytest -v ```
Try it
Open PR on GitHubView diffCheckout locally
git fetch origin pull/49/head:pr-49
git checkout pr-49