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
| Parameter | Description | Required | Default |
|---|---|---|---|
ServiceURL | S3-compatible endpoint URL. Leave empty for AWS S3. | No | Empty |
Region | AWS region, such as us-east-1 or ap-northeast-1. | No | us-east-1 |
BucketName | Name of the bucket. | Yes | — |
ObjectPrefix | Prefix shared by all object keys. Use separate prefixes to isolate groups of clients or other uses of the same bucket. | No | Empty |
ForcePathStyle | Use path-style addressing (endpoint/bucket/key). Many S3-compatible services require this. | No | false |
AccessKeyId | Access key ID. | Yes | — |
SecretAccessKey | Secret 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.
{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.png3. 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.
| Operation | S3 request | Parameters and behavior |
|---|---|---|
| Test the connection | ListObjectsV2 | Set Prefix to the configured object prefix and MaxKeys to 1. A successful response confirms access to the bucket. |
| Initialize storage | HeadObject (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 profile | GetObject | Read SyncClipboard.json and deserialize the JSON body into a ProfileDto. A 404 or NoSuchKey response indicates there is no profile yet. |
| Write a profile | PutObject | Write the serialized ProfileDto to SyncClipboard.json with content type application/json; charset=utf-8. |
| Upload an attachment | PutObject | Write the file bytes to file/{dataName}, using the dataName field from the profile. |
| Download an attachment | GetObject | Read 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.
| Setting | Request behavior |
|---|---|
| Disable chunked transfer encoding | Omit Transfer-Encoding: chunked. |
| Disable payload signing | Use UNSIGNED-PAYLOAD for the request body. |
| Disable trailer checksums | Omit 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.