Skip to content

Commit d136dfd

Browse files
vvillait88claude
andauthored
feat(assess): optional token identity input + response provenance (#40)
Additive, backward-compatible changes to `assess()`. - New optional identity input on `assess()` — a typed overload plus a request field — alongside the existing wallet / `operatorToken` paths. - New optional response provenance block, an additional `identity_method` value, and a couple of extra `agent_memory` hint fields. - JSDoc + `.claude/CLAUDE.md` touch-ups. - Dev dependency bumps (`lefthook`, `typescript-eslint`). No runtime dependencies; no breaking changes to existing call sites. typecheck / lint / tests all green (149 passing). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 23d7c22 commit d136dfd

5 files changed

Lines changed: 71 additions & 35 deletions

File tree

‎.claude/CLAUDE.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ TypeScript client for the AgentScore APIs.
44

55
## Identity Model
66

7-
Two identity paths: `X-Wallet-Address` (wallet-based) and `X-Operator-Token` (credential-based). Wallet addresses accept both EVM (`0x...` 40-hex) and Solana (base58, 32–44 chars) formats — network is auto-detected from the address shape. `assess()` responses include `resolved_operator` and `linked_wallets[]` (same-operator sibling wallets, normalized per network — EVM lowercased, Solana base58 verbatim; may mix chains for cross-chain operators). `createSession()` and `createCredential()` responses include an `agent_memory` cross-merchant pattern hint. `createSession()` also returns `next_steps.action: "deliver_verify_url_and_poll"` + polling instructions. `pollSession()` returns `next_steps.action` of `continue_polling`, `retry_merchant_request_with_operator_token`, `use_stored_operator_token`, `create_new_session`, `verification_failed`, or `contact_support` depending on state.
7+
Three identity paths: `X-Wallet-Address` (wallet-based), `X-Operator-Token` (credential-based), and an Agent Identity Token (AIP) supplied as the `aip_token` assess input. When `aip_token` is given the policy is evaluated against the token's attested claims and the response carries `identity_method: 'aip_token'` plus an `aip` provenance block (issuer/subject/trust_level). Wallet addresses accept both EVM (`0x...` 40-hex) and Solana (base58, 32–44 chars) formats — network is auto-detected from the address shape. `assess()` responses include `resolved_operator` and `linked_wallets[]` (same-operator sibling wallets, normalized per network — EVM lowercased, Solana base58 verbatim; may mix chains for cross-chain operators). `createSession()` and `createCredential()` responses include an `agent_memory` cross-merchant pattern hint. `createSession()` also returns `next_steps.action: "deliver_verify_url_and_poll"` + polling instructions. `pollSession()` returns `next_steps.action` of `continue_polling`, `retry_merchant_request_with_operator_token`, `use_stored_operator_token`, `create_new_session`, `verification_failed`, or `contact_support` depending on state.
88

99
## Methods
1010

1111
- `getReputation(address, options?)` — cached reputation lookup (free)
12-
- `assess(address, options?)` — identity gate with policy (paid). Accepts `operatorToken` for non-wallet agents. Response includes `linked_wallets[]` and `resolved_operator`. Optional `signer: { address, network }` opts into server-side wallet-signer-match AND OFAC SDN wallet-address screening — the response then carries both a `signer_match` block (wallet-binding verdict: `pass` / `wallet_signer_mismatch` / `wallet_auth_requires_wallet_signing`) and a `signer_sanctions` block (discriminated union: `{ status: 'clear' }` | `{ sanctioned: true, ofac_label, sdn_uid, listed_at }` | `{ status: 'unavailable' }`). Wallet-OFAC SDN enforcement on the `signer` block is unconditional whenever a signer is supplied — no `policy.require_sanctions_clear` opt-in required. A `sanctioned: true` OR `status: 'unavailable'` verdict flips the response `decision` to `deny` with `decision_reasons` including `sanctions_flagged` or `sanctions_check_unavailable` respectively (fail-closed; OFAC strict-liability). `policy.require_sanctions_clear` is the separate NAME-based screen on the resolved operator's KYC identity.
12+
- `assess(address, options?)` — identity gate with policy (paid). Accepts `operatorToken` for non-wallet agents, or `aipToken` to assess an Agent Identity Token (AIP) — pass via `assess(null, { aipToken })`; policy applies to the token's attested claims and the response carries `identity_method: 'aip_token'` + an `aip` provenance block. Response includes `linked_wallets[]` and `resolved_operator`. Optional `signer: { address, network }` opts into server-side wallet-signer-match AND OFAC SDN wallet-address screening — the response then carries both a `signer_match` block (wallet-binding verdict: `pass` / `wallet_signer_mismatch` / `wallet_auth_requires_wallet_signing`) and a `signer_sanctions` block (discriminated union: `{ status: 'clear' }` | `{ sanctioned: true, ofac_label, sdn_uid, listed_at }` | `{ status: 'unavailable' }`). Wallet-OFAC SDN enforcement on the `signer` block is unconditional whenever a signer is supplied — no `policy.require_sanctions_clear` opt-in required. A `sanctioned: true` OR `status: 'unavailable'` verdict flips the response `decision` to `deny` with `decision_reasons` including `sanctions_flagged` or `sanctions_check_unavailable` respectively (fail-closed; OFAC strict-liability). `policy.require_sanctions_clear` is the separate NAME-based screen on the resolved operator's KYC identity.
1313
- `createSession(options?)` — create verification session for identity bootstrapping. Returns `agent_memory` + `next_steps`.
1414
- `pollSession(sessionId, pollSecret)` — poll session status, returns credential when verified, plus `next_steps.action`.
1515
- `createCredential(options?)` — create operator credential (24h TTL default). Response includes `agent_memory`.

0 commit comments

Comments
 (0)