core: send badge ZK-proofs to XFTP servers, add file expiry time - #7430
core: send badge ZK-proofs to XFTP servers, add file expiry time#7430epoberezkin wants to merge 10 commits into
Conversation
42965d9 to
228431b
Compare
There was a problem hiding this comment.
Two orthogonal changes: (1) send badge/entitlement ZK-proofs to XFTP servers via the updated xftpSendFile credential argument, and (2) surface the server-granted file storage expiry to sender and recipients.
I traced the file-expiry change end to end and it is consistent:
XMsgFileDescrgains an optionalfileExpires; encode uses.=?, decode usesopt, no version bump — older peers omit/skip it. All 8 constructor/pattern sites are updated.CIFilegainsfileExpires :: Maybe UTCTime; thefiles.file_expires_atcolumn is added with matching SQLite/Postgres migrations and schema snapshots, and read back in exactly the three CIFile-bearing queries (getDirectChatItem,getGroupChatItem,getLocalChatItem) —MaybeCIFIleRowand all threeto*ChatItemparsers stay in sync, and those parsers have no other callers, so no query is left selecting the wrong column count.- Sender path stores the granted expiry from
SFDONE(GSTExpires epochSeconds→UTCTime) viasetSndFTPrivateSndDescrand threads it into everyXMsgFileDescr; recipient path stores the received expiry viasetFileExpirationinside the same transaction asappendRcvFD. All the transientCIFile { fileExpires = Nothing }constructions are pre-descriptor states that are re-read from the DB when displayed — correct. - Client side (iOS/Kotlin) derives
expiredfromfileExpires < now, gates thercvInvitationicon andshowFileErrorAlerton it, and bothFileErrortypes are Equatable/sealed as needed. SDK type files (TS/Python/TYPES.md) are updated. Strings added.
Two behavioral notes, not blocking:
- The recipient's expiry is stored on
XMsgFileDescrreceipt but no chat-item update event is emitted at that point, so the expiry icon/info only appears after the item is next loaded. Matches the plan; acceptable. - Kotlin's
val expiredis computed eagerly at construction againstClock.System.now(), so it is a snapshot per load (iOS recomputes per access). A file that expires while the view is open won't flip until reload. Minor.
The badge/entitlement change swaps the hardcoded badgePublicKeys map and bbsBadgeHeader for entitlementIssuerKeys / entitlementBBSHeader from the bumped simplexmq, and adds badgeServerCredential. Correctness of the header constant and key set depends on the paired simplexmq tag (6541745f…), which I could not inspect from this repo — assuming that side matches, the wiring here is straightforward.
One trivial nit inline (import ordering). Otherwise this is a clean, minimal, well-scoped change.
No description provided.