Skip to content

feat: add hash_operator_token helper - #22

Merged
vvillait88 merged 2 commits into
mainfrom
tec-302-hash-operator-token
May 14, 2026
Merged

feat: add hash_operator_token helper#22
vvillait88 merged 2 commits into
mainfrom
tec-302-hash-operator-token

Conversation

@vvillait88

Copy link
Copy Markdown
Contributor

Summary

  • Canonical sha256 hex digest for plaintext operator tokens, exported from agentscore_commerce.identity.hash_operator_token.
  • Merchants hash before storing in DB columns and before comparing against persisted hashes, so plaintext tokens never land in durable storage.

Tests

  • 6-fixture corpus with hardcoded digests locked as the cross-language contract with the Node sibling at @agent-score/commerce.
  • Parametrized so multiple drifts surface independently rather than short-circuiting.

Test plan

  • uv run pytest tests/test_tokens.py — 9 tests pass
  • uv run pytest — full suite 891 pass / 3 skip, coverage 95.02%
  • uv run ruff check, uv run ruff format --check, uv run ty check — green

🤖 Generated with Claude Code

vvillait88 and others added 2 commits May 14, 2026 07:33
Canonical sha256 hex digest for plaintext operator tokens. Merchants hash
them before storing in DB columns and before comparing against persisted
hashes, so plaintext tokens never land in durable storage.

Tests lock 6 fixtures with hardcoded digests as the cross-language
contract with the Node sibling at @agent-score/commerce. Parametrized
so multiple drifts surface independently rather than short-circuiting.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…atches)

uv lock --upgrade picked up:
- x402 2.9.0 -> 2.10.0 (minor)
- cdp-sdk 1.45.0 -> 1.45.1
- ruff 0.15.12 -> 0.15.13
- solana 0.36.11 -> 0.36.12
- requests 2.34.0 -> 2.34.1

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vvillait88
vvillait88 merged commit 7a2e4ce into main May 14, 2026
7 checks passed
@vvillait88
vvillait88 deleted the tec-302-hash-operator-token branch May 14, 2026 14:41
vvillait88 added a commit that referenced this pull request May 14, 2026
## Summary

Additive update to the README inventory table — documents the helpers
that landed in PRs #22#29 + the public-surface guard in #30. Pure docs,
no code changes.

## What was added

**`agentscore_commerce.identity` (package level)** row:
- `load_ucp_signing_key_from_env` + `LoadUCPSigningKeyOptions`
(env-driven UCP signing key loader; cached, alg-detected, sanitized
errors)
- `hash_operator_token` (sha256 hex of plaintext `opc_...` for merchants
persisting `operator_token_id` to their own DB)

**`agentscore_commerce.payment`** row:
- `extract_payment_signer` now documents both the positional
`x402_payment_header` path AND the `authorization_header=` MPP kwarg
(`did:pkh:eip155` / `did:pkh:solana` source DIDs)
- `detect_rail_from_headers` (returns `"x402"` / `"mpp"` / `None`)
- `classify_orchestration_error` (companion to
`classify_x402_settle_result` for orchestration-time exceptions)
- `zero_amount_carve_out` (skip CDP/pympp upstream when settle_cents ==
0)
- `usd_to_atomic` (Decimal-based USD → atomic int, ROUND_HALF_UP)

## Test plan

Docs-only; no code changes. Markdown renders cleanly in the existing
table.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant