Skip to content

feat(contract): implement POST /revoke — record document revocation on Stellar [CT-02]#958

Merged
mftee merged 4 commits into
CodeGirlsInc:mainfrom
mxllv:feature/implement-post-revoke
Jul 21, 2026
Merged

feat(contract): implement POST /revoke — record document revocation on Stellar [CT-02]#958
mftee merged 4 commits into
CodeGirlsInc:mainfrom
mxllv:feature/implement-post-revoke

Conversation

@mxllv

@mxllv mxllv commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the POST /revoke endpoint in the Rust verifier microservice, which was previously returning 404 Not Found with "revoke endpoint not yet implemented".

Approach

Rather than clearing the doc_ entry (which would erase the audit trail), revocation writes a new ManageData entry alongside the original:

  • Key: "revoked_" + &hash[..56] (max 64 bytes, within the Stellar ManageData limit)
  • Value: { revokedAt, reason, revokedBy } JSON (truncated to 64 bytes)

The original doc_ anchor is preserved so the full history remains auditable.

Changes

contract/src/stellar.rs

  • Added StellarClient::anchor_revocation(hash, revocation_json, public_key, secret_key)
  • Fetches account sequence, builds and signs a ManageData transaction, submits to Horizon
  • Added build_revocation_key() helper

contract/src/lib.rs

  • revoke_document() now takes State<AppState>
  • Returns 404 if the hash has no prior anchor record in Redis (cannot revoke what was never anchored)
  • Calls stellar.anchor_revocation() to write the revocation marker on-chain
  • On success: updates the Redis cache entry (stellar:verify:{hash}) to include { revoked: true, revoked_at } so subsequent GET /verify/:hash calls reflect the revocation
  • On Horizon failure: returns 502 with error detail
  • Added revoked and revoked_at optional fields to VerifyResponse (omitted when None)
  • Added Deserialize to SubmitResponse and RevokeResponse

contract/Cargo.toml

  • Added stellar-base = "0.5" and pinned sodiumoxide = "=0.2.6" for stellar-base compatibility

Testing

  • cargo build — clean ✓
  • GET /verify/:hash after revocation returns { verified: true, revoked: true, revokedAt } via the updated cache entry

Closes #855

@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@mxllv is attempting to deploy a commit to the Mftee's projects Team on Vercel.

A member of the Team first needs to authorize it.

…n Stellar [CT-02]

Implements the previously stubbed revoke_document handler in
contract/src/lib.rs and adds anchor_revocation() to StellarClient in
contract/src/stellar.rs.

Changes:
- contract/src/stellar.rs:
  - Added anchor_revocation() method:
    - Writes a ManageData entry with key 'revoked_' + hash[:56] (max 64 bytes)
    - Value: revocation JSON {revokedAt, reason, revokedBy} truncated to 64 bytes
    - Preserves the original doc_ entry — audit history remains intact
    - Builds, signs, and submits a transaction identically to anchor_hash()
  - Added build_revocation_key() helper
  - Added stellar-base = "0.5" and sodiumoxide = "=0.2.6" (version pin for
    stellar-base compatibility)

- contract/src/lib.rs:
  - revoke_document() now takes State<AppState>
  - Returns 404 if hash has no prior anchor record in Redis cache
  - Calls stellar.anchor_revocation() on Stellar
  - On success: updates Redis cache entry (stellar:verify:{hash}) to include
    revoked: true, revoked_at so that GET /verify/:hash reflects revocation
  - On Horizon failure: returns 502 with error detail
  - Added revoked/revoked_at optional fields to VerifyResponse (skipped when None)
  - Added Deserialize to SubmitResponse and RevokeResponse for cache round-trip

Closes CodeGirlsInc#855
@mxllv
mxllv force-pushed the feature/implement-post-revoke branch from 5d71303 to 64a651e Compare July 21, 2026 13:10
Kiro added 2 commits July 21, 2026 15:29
- Move misplaced pages from app/(protected)/ to app/[locale]/(protected)/
  so they are covered by the root layout at app/[locale]/layout.tsx.
  Affected pages: admin/providers, profile, reports, settings/api-keys.
  Without a root layout Next.js 15 refuses to build the page.
…ost-revoke

# Conflicts:
#	contract/src/stellar.rs
@mftee
mftee merged commit 7ac1883 into CodeGirlsInc:main Jul 21, 2026
4 of 5 checks passed
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.

[CT-02] Implement POST /revoke in Rust verifier — record document revocation on Stellar

2 participants