// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /** * StarPostSeal — Tamper-proof timestamping for Star Post letters. * * Each postcard sealed by Star Post emits a permanent on-chain record containing: * - The order ID (e.g. "SP-XXXXXX") * - A SHA-256 hash of the encrypted postcard content * - The scheduled delivery date (Unix timestamp) * - The seal timestamp (block.timestamp) * * Anyone can verify a postcard's integrity by: * 1. Looking up the order ID on Polygonscan * 2. Checking the dataHash matches the encrypted file they hold * 3. Confirming the delivery date was set at sealing time * * This creates a 50-year-proof public record that no one — * including Star Post — can alter after sealing. */ contract StarPostSeal { event PostcardSealed( string indexed orderId, bytes32 dataHash, uint256 deliveryDate, uint256 sealedAt ); address public immutable owner; constructor() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner, "StarPostSeal: not owner"); _; } /** * Seal a postcard on-chain. * * @param orderId Star Post order ID, e.g. "SP-AB12CD" * @param dataHash SHA-256 hash of (orderId + encryptedImageHex + deliveryDateISO) * @param deliveryDate Scheduled delivery as Unix timestamp */ function seal( string calldata orderId, bytes32 dataHash, uint256 deliveryDate ) external onlyOwner { emit PostcardSealed(orderId, dataHash, deliveryDate, block.timestamp); } }