diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..0ac7f53 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,38 @@ +name: Pages + +# Publishes site/ (the privacy policy) to GitHub Pages: +# https://htpdevs.github.io/birthmark/privacy-policy/ is the privacy policy URL +# for the Play Console and App Store Connect. site/privacy-policy/index.html is +# generated from src/legal/privacyPolicy.ts; tests/privacyPolicy.test.ts (run by +# ci.yml on every PR) fails if it drifts from the in-app text. + +on: + push: + branches: [main] + paths: ['site/**', '.github/workflows/pages.yml'] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + timeout-minutes: 10 + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/checkout@v4 + - uses: actions/configure-pages@v5 + - uses: actions/upload-pages-artifact@v3 + with: + path: site + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/CLAUDE.md b/CLAUDE.md index 65d688d..909c855 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -46,7 +46,7 @@ Routes are in `src/app/`. Path alias: `@/*` -> `src/*` (tests use it, and jest m - `writeQueue.ts`: serial FIFO. A failed op stays at the head and blocks later ops until `retry()`. - `src/report/`: `buildReport()` returns one model, used by both the report screen and `renderReportHtml()` (escaped, no external assets) for expo-print. - `src/platform/`: the only React Native / Expo-module code outside the UI (`clock`, `database`, `phone`, `exportPdf`). -- `src/legal/privacyPolicy.ts`: privacy policy text, shown in-app at `/privacy` (linked from Home) and mirrored to `docs/privacy-policy.md` for the Play Console URL. `tests/privacyPolicy.test.ts` fails if the doc drifts or a claim (backup, permissions, no network or analytics SDKs) stops matching the app. Edit the TS, then `UPDATE_PRIVACY_MD=1 npx jest tests/privacyPolicy.test.ts`. +- `src/legal/privacyPolicy.ts`: privacy policy text, shown in-app at `/privacy` (linked from Home) and mirrored to `docs/privacy-policy.md` and `site/privacy-policy/index.html` (built by `privacyPolicyHtml.ts`, published by `.github/workflows/pages.yml` at https://htpdevs.github.io/birthmark/privacy-policy/, the store listings' privacy URL). `tests/privacyPolicy.test.ts` fails if either copy drifts or a claim (backup, permissions, no network or analytics SDKs) stops matching the app. Edit the TS, then `UPDATE_PRIVACY_MD=1 npx jest tests/privacyPolicy.test.ts`. - `src/state/store.ts`: `appStore` singleton (DB, active controller, controller cache, session list, clock-format pref) plus hooks. `useClockTick` is display-only at 4 Hz. - `modules/clock-snapshot/`: Swift (`mach_continuous_time`, `kern.boottime` boot id, `isExcludedFromBackup`) and Kotlin (`elapsedRealtimeNanos`, `Settings.Global.BOOT_COUNT`). Loaded with `requireOptionalNativeModule`. - Tests: `tests/helpers/sqlite.ts` wraps better-sqlite3 in the `Db` interface. It includes `failNext(regex)` to simulate disk-full errors. `tests/helpers/fakeClock.ts` provides `advance`, `setWallBy`, and `reboot`. Name tests after spec IDs. diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000..6308820 --- /dev/null +++ b/site/index.html @@ -0,0 +1,12 @@ + + + + +Birthmark + + + + +

Birthmark privacy policy

+ + diff --git a/site/privacy-policy/index.html b/site/privacy-policy/index.html new file mode 100644 index 0000000..579c4a2 --- /dev/null +++ b/site/privacy-policy/index.html @@ -0,0 +1,45 @@ + + + + + +Birthmark privacy policy + + + +
+

Birthmark privacy policy

+

Effective 2026-10-10

+

This policy explains how the Birthmark app, published by HTPdevs, handles information. Birthmark works offline on one device. It has no accounts, no backend server, no advertising, and no analytics.

+

What the app stores

+

Birthmark stores what you record during a session: the time of each captured moment, milestone names, optional labels you type (up to 80 characters), event timers, APGAR scores, corrections and their history, and timing details from the device clock (timezone, UTC offset, and a boot identifier used to recover elapsed time after a restart). It also stores your 12-hour or 24-hour clock display preference.

+

Birthmark does not ask for names, dates of birth, addresses, medical record numbers, or any patient profile. A label is free text, so it can still contain identifying details if you type them. Do not enter names or identifying details in labels.

+

Where it is stored

+

All records are kept in a database inside the app on this device. Birthmark does not send session data to HTPdevs or to anyone else, and it has no account or cloud sync.

+

Session data is excluded from automatic device backups: Android app backup is turned off, and on iOS the database folder is excluded from iCloud and computer backups.

+

What the app does not use

+

Birthmark does not use the microphone, camera, location, contacts, or photos. It does not record audio. It contains no advertising, analytics, crash-reporting, or tracking services.

+

Exported reports

+

When you export a report, Birthmark creates a PDF on the device and opens your device's share sheet. You choose where it goes, for example a file location or another app. Nothing is sent automatically.

+

Once you save or share a PDF outside Birthmark, that copy is handled by the destination you chose and its own privacy terms. Deleting a session in Birthmark cannot remove copies saved elsewhere. Birthmark clears its own cached export files when a session is deleted.

+

Emergency button

+

After you confirm, the Emergency button opens your device's phone app with 911 entered. The call is placed by your phone app and carrier, not by Birthmark. Birthmark does not record that you used it.

+

Keeping and deleting data

+

Records stay on the device until you delete them. You can delete a finished session from its report. This removes its database records and cached exports. Uninstalling Birthmark removes all of its data from the device.

+

Security and medical use

+

Records are protected by the security of your device, such as its screen lock. Birthmark does not make records anonymous, and it is not certified for HIPAA or any other medical records standard. It records observations you choose and gives no clinical guidance.

+

Changes to this policy

+

If this policy changes, the updated version will ship in the app with a new effective date.

+

Contact

+

Questions about this policy: support@htpdevs.tech

+
+ + diff --git a/src/legal/privacyPolicy.ts b/src/legal/privacyPolicy.ts index 14dc330..0447879 100644 --- a/src/legal/privacyPolicy.ts +++ b/src/legal/privacyPolicy.ts @@ -1,9 +1,10 @@ /** - * Privacy policy text. Single source for the in-app Privacy screen and - * docs/privacy-policy.md (the copy hosted for the Play Console URL field). - * tests/privacyPolicy.test.ts fails when the two drift, and checks each claim + * Privacy policy text. Single source for the in-app Privacy screen, + * docs/privacy-policy.md, and site/privacy-policy/index.html (published by + * .github/workflows/pages.yml as the store listings' privacy policy URL). + * tests/privacyPolicy.test.ts fails when they drift, and checks each claim * below against the code and config it describes. Change the text here, then - * regenerate the doc: UPDATE_PRIVACY_MD=1 npx jest tests/privacyPolicy.test.ts + * regenerate both: UPDATE_PRIVACY_MD=1 npx jest tests/privacyPolicy.test.ts */ export const PRIVACY_DEVELOPER = 'HTPdevs'; diff --git a/src/legal/privacyPolicyHtml.ts b/src/legal/privacyPolicyHtml.ts new file mode 100644 index 0000000..15ae724 --- /dev/null +++ b/src/legal/privacyPolicyHtml.ts @@ -0,0 +1,51 @@ +import { colors } from '../ui/theme'; +import { PRIVACY_EFFECTIVE_DATE, PRIVACY_INTRO, PRIVACY_SECTIONS, PRIVACY_TITLE } from './privacyPolicy'; + +/** + * The privacy policy as a standalone HTML page: site/privacy-policy/index.html, + * published by .github/workflows/pages.yml as the public URL for the Play + * Console and App Store privacy policy fields. Same text as the in-app screen. + * tests/privacyPolicy.test.ts fails if the committed file drifts; regenerate + * with UPDATE_PRIVACY_MD=1 npx jest tests/privacyPolicy.test.ts + */ + +const escape = (s: string) => + s.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); + +const EMAIL = /([^\s@]+@[^\s@]+\.[a-z]{2,})/g; + +/** Escapes a paragraph and links any email address in it. */ +const paragraph = (text: string) => + `

${escape(text).replace(EMAIL, (m) => `${m}`)}

`; + +export function privacyPolicyHtml(): string { + const sections = PRIVACY_SECTIONS.map( + (s) => `

${escape(s.heading)}

\n${s.paragraphs.map(paragraph).join('\n')}`, + ).join('\n'); + return ` + + + + +${escape(PRIVACY_TITLE)} + + + +
+

${escape(PRIVACY_TITLE)}

+

Effective ${escape(PRIVACY_EFFECTIVE_DATE)}

+${paragraph(PRIVACY_INTRO)} +${sections} +
+ + +`; +} diff --git a/tests/privacyPolicy.test.ts b/tests/privacyPolicy.test.ts index 378c6bf..e2e4dec 100644 --- a/tests/privacyPolicy.test.ts +++ b/tests/privacyPolicy.test.ts @@ -1,5 +1,5 @@ import { execSync } from 'child_process'; -import { readFileSync, writeFileSync } from 'fs'; +import { mkdirSync, readFileSync, writeFileSync } from 'fs'; import { join } from 'path'; import { EMERGENCY_NUMBER } from '@/domain/emergency'; @@ -12,6 +12,7 @@ import { PRIVACY_SECTIONS, privacyPolicyMarkdown, } from '@/legal/privacyPolicy'; +import { privacyPolicyHtml } from '@/legal/privacyPolicyHtml'; const ROOT = join(__dirname, '..'); const DOC = join(ROOT, 'docs', 'privacy-policy.md'); @@ -26,6 +27,39 @@ describe('privacy policy', () => { expect(readFileSync(DOC, 'utf8')).toBe(md); }); + // The public URL for the store listings (GitHub Pages, .github/workflows/pages.yml). + describe('published page', () => { + const PAGE = join(ROOT, 'site', 'privacy-policy', 'index.html'); + const html = privacyPolicyHtml(); + + it('site/privacy-policy/index.html matches the in-app text', () => { + if (process.env.UPDATE_PRIVACY_MD) { + mkdirSync(join(ROOT, 'site', 'privacy-policy'), { recursive: true }); + writeFileSync(PAGE, html); + } + // On failure: UPDATE_PRIVACY_MD=1 npx jest tests/privacyPolicy.test.ts + expect(readFileSync(PAGE, 'utf8')).toBe(html); + }); + + it('contains every heading and paragraph, escaped', () => { + const esc = (s: string) => s.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); + for (const s of PRIVACY_SECTIONS) { + expect(html).toContain(`

${esc(s.heading)}

`); + for (const p of s.paragraphs) expect(html).toContain(esc(p).replace(PRIVACY_CONTACT, '')); + } + expect(html).toContain(`${PRIVACY_CONTACT}`); + expect(html).toContain(`Effective ${PRIVACY_EFFECTIVE_DATE}`); + }); + + it('is self-contained: no scripts and no external requests', () => { + expect(html).not.toMatch(/ { + expect(read('site/index.html')).toContain('url=privacy-policy/'); + }); + }); + // Google Play User Data policy: the policy must name the developer and a // privacy point of contact. it('names the developer and a contact address', () => {