Skip to content

SyncClipboard S3 sync protocol specification ​

This specification describes how SyncClipboard stores clipboard metadata and attachments in an S3-compatible bucket and which S3 operations a client needs to implement.

1. S3 configuration ​

ParameterDescriptionRequiredDefault
ServiceURLS3-compatible endpoint URL. Leave empty for AWS S3.NoEmpty
RegionAWS region, such as us-east-1 or ap-northeast-1.Nous-east-1
BucketNameName of the bucket.Yes—
ObjectPrefixPrefix shared by all object keys. Use separate prefixes to isolate groups of clients or other uses of the same bucket.NoEmpty
ForcePathStyleUse path-style addressing (endpoint/bucket/key). Many S3-compatible services require this.Nofalse
AccessKeyIdAccess key ID.Yes—
SecretAccessKeySecret access key.Yes—

For AWS S3, leave ServiceURL empty. The SDK resolves the endpoint from Region. For an S3-compatible provider such as MinIO, Cloudflare R2, or Alibaba Cloud OSS, set ServiceURL to the provider's endpoint (for example, https://s3.example.com). These services commonly use ForcePathStyle = true.

Authenticate requests with AWS Signature Version 4.

2. Object storage layout ​

Trim leading and trailing slashes from ObjectPrefix. When the prefix is empty, store the objects at the root of the bucket.

text
{BucketName}/
  └── {ObjectPrefix}/           # Omit this level when empty
       ├── SyncClipboard.json   # Clipboard profile metadata
       └── file/                # Zero or more attachments
            ├── {dataName1}     # e.g. Text_2025-04-15_08-45-23_abc12345.tmp.txt
            └── {dataName2}     # e.g. screenshot.png

3. Profile metadata ​

See the SyncClipboard.json field definitions.

4. S3 API operations ​

All operations target the configured bucket and use AWS Signature Version 4. The keys below are relative to the configured object prefix.

OperationS3 requestParameters and behavior
Test the connectionListObjectsV2Set Prefix to the configured object prefix and MaxKeys to 1. A successful response confirms access to the bucket.
Initialize storageHeadObject (GetObjectMetadata)Check the file/ marker. If the service returns 404 or NoSuchKey, create the marker with PutObject, an empty body, and content type application/x-directory.
Read a profileGetObjectRead SyncClipboard.json and deserialize the JSON body into a ProfileDto. A 404 or NoSuchKey response indicates there is no profile yet.
Write a profilePutObjectWrite the serialized ProfileDto to SyncClipboard.json with content type application/json; charset=utf-8.
Upload an attachmentPutObjectWrite the file bytes to file/{dataName}, using the dataName field from the profile.
Download an attachmentGetObjectRead file/{dataName} using the same profile field.

Clean up old files ​

List objects with ListObjectsV2, using the full file/ prefix and MaxKeys = 1000. Follow the continuation tokens until all keys have been listed. Pass the listed keys to DeleteObjects in batches.

5. S3-compatible providers ​

Signing and encoding ​

Some S3-compatible gateways do not support the streaming trailers used by AWS SDKs. For PUT requests to these gateways, use the following settings.

SettingRequest behavior
Disable chunked transfer encodingOmit Transfer-Encoding: chunked.
Disable payload signingUse UNSIGNED-PAYLOAD for the request body.
Disable trailer checksumsOmit x-amz-checksum-* trailers.

Addressing style ​

AWS S3 uses virtual-hosted-style addresses such as {bucket}.s3.{region}.amazonaws.com/{key}. For services that use path-style addresses such as {endpoint}/{bucket}/{key}, enable ForcePathStyle.

HTTP and HTTPS ​

A custom ServiceURL starting with http:// uses HTTP. Other endpoints use HTTPS. The native AWS endpoint always uses HTTPS.