Skip to content

[CT-01] Implement submit_document handler #533

@mftee

Description

@mftee

Problem

The POST /submit endpoint in the Rust service returns a hardcoded BAD_REQUEST with not yet implemented. Documents submitted through this route are never anchored on Stellar, making the submission flow non-functional.

Proposed Solution

Implement the submit_document handler inside contract/module/submit/. The implementation must call the existing StellarClient to anchor the document hash and persist the submission record in Redis.

Acceptance Criteria

  • Handler validates that the document_hash is a valid 64-character lowercase hex string using HashValidator::validate_sha256
  • Calls StellarClient::anchor_hash() with the document hash
  • On successful anchoring, stores the submission record in Redis under key submit:{document_hash} with fields: document_id, submitter, txHash, and anchored_at (Unix timestamp)
  • Returns 200 with a SubmitResponse containing success=true, transaction_id, and anchored_at
  • Returns 400 for invalid hash format with a descriptive error message
  • Returns 409 Conflict if the hash has already been submitted (key already exists in Redis)
  • Implementation files live inside contract/module/submit/

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