SyncLimits.kt
1package com.peachpasswords.sync23import java.io.IOException45/**6 * Cloudflare Workers caps one WebSocket message at 32 MiB. Keep a generous7 * margin for the Noise authentication tag and platform framing overhead.8 */9const val MAX_SYNC_FRAME_BYTES: Int = 24 * 1024 * 10241011class SyncFrameTooLargeException(12 message: String = "sync frame too large (WebSocket close 1009)",13) : IOException(message)1415fun requireSyncFrameSize(size: Int) {16 if (size > MAX_SYNC_FRAME_BYTES) {17 throw SyncFrameTooLargeException("sync frame exceeds $MAX_SYNC_FRAME_BYTES bytes")18 }19}