feat(contract): implement POST /revoke — record document revocation on Stellar [CT-02]#958
Merged
Merged
Conversation
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
force-pushed
the
feature/implement-post-revoke
branch
from
July 21, 2026 13:10
5d71303 to
64a651e
Compare
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.
mftee
approved these changes
Jul 21, 2026
…ost-revoke # Conflicts: # contract/src/stellar.rs
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the
POST /revokeendpoint in the Rust verifier microservice, which was previously returning404 Not Foundwith"revoke endpoint not yet implemented".Approach
Rather than clearing the
doc_entry (which would erase the audit trail), revocation writes a newManageDataentry alongside the original:"revoked_" + &hash[..56](max 64 bytes, within the Stellar ManageData limit){ revokedAt, reason, revokedBy }JSON (truncated to 64 bytes)The original
doc_anchor is preserved so the full history remains auditable.Changes
contract/src/stellar.rsStellarClient::anchor_revocation(hash, revocation_json, public_key, secret_key)ManageDatatransaction, submits to Horizonbuild_revocation_key()helpercontract/src/lib.rsrevoke_document()now takesState<AppState>404if the hash has no prior anchor record in Redis (cannot revoke what was never anchored)stellar.anchor_revocation()to write the revocation marker on-chainstellar:verify:{hash}) to include{ revoked: true, revoked_at }so subsequentGET /verify/:hashcalls reflect the revocation502with error detailrevokedandrevoked_atoptional fields toVerifyResponse(omitted whenNone)DeserializetoSubmitResponseandRevokeResponsecontract/Cargo.tomlstellar-base = "0.5"and pinnedsodiumoxide = "=0.2.6"forstellar-basecompatibilityTesting
cargo build— clean ✓GET /verify/:hashafter revocation returns{ verified: true, revoked: true, revokedAt }via the updated cache entryCloses #855