Skip to content

core: send badge ZK-proofs to XFTP servers, add file expiry time - #7430

Open
epoberezkin wants to merge 10 commits into
masterfrom
ep/badges-xftp
Open

core: send badge ZK-proofs to XFTP servers, add file expiry time#7430
epoberezkin wants to merge 10 commits into
masterfrom
ep/badges-xftp

Conversation

@epoberezkin

Copy link
Copy Markdown
Member

No description provided.

@epoberezkin epoberezkin changed the title core: send badge ZK-proofs to XFTP servers core: send badge ZK-proofs to XFTP servers, add file expiry time Aug 28, 2026
@epoberezkin
epoberezkin changed the base branch from badges to master August 28, 2026 18:40
simplex-chat-agent[bot]
simplex-chat-agent Bot previously approved these changes Aug 28, 2026

@simplex-chat-agent simplex-chat-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • XMsgFileDescr gains an optional fileExpires; encode uses .=?, decode uses opt, no version bump — older peers omit/skip it. All 8 constructor/pattern sites are updated.
  • CIFile gains fileExpires :: Maybe UTCTime; the files.file_expires_at column is added with matching SQLite/Postgres migrations and schema snapshots, and read back in exactly the three CIFile-bearing queries (getDirectChatItem, getGroupChatItem, getLocalChatItem) — MaybeCIFIleRow and all three to*ChatItem parsers 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 epochSecondsUTCTime) via setSndFTPrivateSndDescr and threads it into every XMsgFileDescr; recipient path stores the received expiry via setFileExpiration inside the same transaction as appendRcvFD. All the transient CIFile { fileExpires = Nothing } constructions are pre-descriptor states that are re-read from the DB when displayed — correct.
  • Client side (iOS/Kotlin) derives expired from fileExpires < now, gates the rcvInvitation icon and showFileErrorAlert on it, and both FileError types 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 XMsgFileDescr receipt 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 expired is computed eagerly at construction against Clock.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.

Comment thread src/Simplex/Chat.hs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants