Skip to content

[CT-08] Build DocumentRevocationValidator #540

@mftee

Description

@mftee

Problem

The submit and transfer handlers do not check whether a document has already been revoked before processing the request. A revoked document can still be re-submitted or transferred, which creates invalid on-chain records.

Proposed Solution

Create a DocumentRevocationValidator inside contract/module/revocation-check/ as a shared guard function that submit and transfer handlers can call before processing.

Acceptance Criteria

  • is_revoked(cache: &CacheBackend, document_hash: &str) async function checks for a key revoke:{document_hash} in Redis
  • Returns true if the key exists (document is revoked), false if it does not
  • The submit handler (CT-01) calls is_revoked and returns 409 with error document has been revoked when the result is true
  • The transfer handler calls is_revoked and returns 409 with the same message
  • is_revoked returns an error (not a false) when the Redis connection fails, so the calling handler can return 500 rather than silently allowing the operation
  • Unit tests cover: not revoked (key absent), revoked (key present), Redis error case
  • Implementation files live inside contract/module/revocation-check/

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions