# CakeShare

CakeShare is the sharing format used by Cakeday to move birthday data between devices.

## Individual Sharing Modes

When viewing a friend's profile, tapping the Share button offers a **Share Link** and a **Share File** submenu:

1. **Share Link:** Generates an encoded share link in the form `https://cakeday.wbx1.com/share/<token>`. It contains the person's name, date, calendar type, leap month flag, year (if provided), and notes, but does NOT include the avatar or group assignment. When the recipient taps the link on an Apple device, Cakeday opens and shows an **Add Birthday** confirmation (or an **Already Exists** warning, with an **Add Anyway** button, if a matching birthday is already saved). Share links have limits: names up to 200 characters, notes up to 2,000 characters, and the total encoded payload cannot exceed 4 KB.
2. **Share File:** The submenu has **Generate Share File**, which exports a `.cakeshare` for that person using your saved field selection, and **Share Content**, which opens a sheet to choose which fields to include first. Only the avatar is included by default until you pick more — see **Choosing Share Content** below.

## Choosing Share Content

The **Share Content** sheet lets you pick exactly what goes into a single friend's `.cakeshare` file.

- **Always included:** the name and the birthday date.
- **Optional fields**, grouped as Profile (avatar, group), Birth Details (birth time, birthplace, timezone, ascendant), and Notes. A toggle only appears when the friend actually has data for it.
- **More Info:** each of the friend's manually entered extra fields (MBTI, astrology placements, identity, and so on) can be included individually.

Your Profile, Birth Details, and Notes choices are saved on the device and reused for future share files; **More Info** choices apply only to the current file and start off each time. Tap **Save & Generate** to export, or **Done** to save the selection without exporting.

## Opening Share Links

When a recipient taps a share link, the behavior depends on their device and browser:

- **Apple device (Safari or system browser):** The link automatically attempts to open Cakeday. If the app is not installed, a fallback appears after a few seconds with a link to download Cakeday from the App Store.
- **Apple device (in-app browser):** In-app browsers (e.g. WeChat, QQ, LINE, Weibo) cannot open deep links directly. A guide is shown instructing the user to tap the menu and select "Open in Safari."
- **Non-Apple device:** A message explains that the link requires an iPhone, iPad, or Mac. A link to the App Store is provided.

## Share Package (.cakeshare)

The iOS app exports **one friend per `.cakeshare` file**. To bundle multiple friends (including avatars and groups) into a single package, use the [CakeShare Web tool](#cakeshare-web-tool); Cakeday can then import the whole package at once.

When sharing a single friend, the sender chooses which fields to include (see Choosing Share Content above); the extra **More Info** fields, such as MBTI or astrology placements, are off by default and reset for each file. The CakeShare Web tool does not create those extra fields, but files it generates remain compatible with the same format.

## File Protection

Exported `.cakeshare` files are always encrypted before you share them — but only a password provides real protection.

- Without a password, the encryption only obscures the contents; it does not keep them confidential.
- You can optionally add a password so the recipient must enter it before import. This is the only mode that offers real protection.
- Only share files and passwords through channels you trust.

## CakeShare Web Tool

A browser-based tool is available at [https://cakeday.wbx1.com/cakeshare](https://cakeday.wbx1.com/cakeshare) for creating `.cakeshare` packages without the iOS app. With the web tool you can:

- Add friends with names, dates (solar or lunar), groups with colors and icons, avatars, and notes.
- Import from CSV using a downloadable template.
- Crop and compress avatars to 1024px WebP (max 2 MB).
- Export a `.cakeshare` file with optional password protection.

Data processing happens in your browser. Files are not uploaded to a server.

## Inbound Decoding Flow

When a recipient opens a `.cakeshare` file, Cakeday shows the "Import Share Package" interface.

- A list of friends is displayed, and you can select which ones to import.
- If a friend already exists, a duplicate warning is shown.
