Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@ Welcome to the PowerSync documentation repository! Our docs are powered by [Mint
git clone https://github.com/YOUR-USERNAME/powersync-docs.git
cd powersync-docs
```
2. **Install Mintlify CLI:**
2. **Install dependencies:**
```
npx mintlify install
pnpm install
Copy link
Copy Markdown
Contributor

@simolus3 simolus3 Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love not having to install mintlify as a global tool 👍 To ensure this works, maybe we should also update the workflow in .github/workflows/check.yaml (we can even cache pnpm dependencies automatically after upgrading actions/setup-node).

```
3. **Start the local docs server:**
- Run the following command at the root of the repo (where docs.json is):
```
npx mintlify dev
```

- If you see the error `✖ Must be run in a directory where a mint.json file exists.`, update Mintlify:
```
npx mintlify@latest dev
npm run dev
```

## Contributing
Expand Down Expand Up @@ -83,5 +77,5 @@ We use the following icons for supported backend databases and SDKs:

## Troubleshooting

- **Mintlify dev isn't running:** Run `npx mintlify install` to re-install dependencies.
- **Mintlify dev isn't running:** Run `pnpm install` to re-install dependencies.
- **Page loads as a 404:** Make sure you are running in a folder with `docs.json`.
30 changes: 30 additions & 0 deletions client-sdks/advanced/data-encryption.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
The PowerSync SDK supports [SQLite3MultipleCiphers](https://utelle.github.io/SQLite3MultipleCiphers)
on all native platforms and the web, which can be used to encrypt databases.

<Note>Setting up encryption has changed in version 2.0 of the PowerSync SDK. When upgrading, follow these steps and remove dependencies on `powersync_sqlcipher`.</Note>

Check warning on line 18 in client-sdks/advanced/data-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/advanced/data-encryption.mdx#L18

Did you really mean 'powersync_sqlcipher'?

To enable encryption, pass an instance of `EncryptionOptions` to a `PowerSyncDatabase` constructor:

Expand Down Expand Up @@ -87,7 +87,7 @@

2. Add a dependency on `com.powersync:sqlite3multipleciphers`.

3. Since `:core` includes a Ktor client implementation, you'll need to [add one manually](https://ktor.io/docs/client-engines.html) if you're not already using Ktor:

Check warning on line 90 in client-sdks/advanced/data-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/advanced/data-encryption.mdx#L90

Did you really mean 'Ktor'?

Check warning on line 90 in client-sdks/advanced/data-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/advanced/data-encryption.mdx#L90

Did you really mean 'Ktor'?
- Android/JVM: `io.ktor:ktor-client-okhttp`
- Apple targets (Kotlin/Native): `io.ktor:ktor-client-darwin`

Expand Down Expand Up @@ -128,6 +128,36 @@
</Note>

For more details, see the [`sqlite3multipleciphers` README](https://github.com/powersync-ja/powersync-kotlin/tree/main/sqlite3multipleciphers) in the PowerSync Kotlin SDK repository.

**Using encryption with Room:**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. But I wonder if we should put this as a section in the guide on using Room, since:

  • this takes up way more space here in a collapsible with large paddings.
  • it's not relevant for everyone using encryption.

So I think it might be better to move this to the page on Room, and add a link from here to that section perhaps.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Will do that


When using PowerSync [with Room](/client-sdks/orms/kotlin/room), PowerSync wraps the Room database instead of opening its own connection. To use an encrypted database with Room, wrap an encrypted `PersistentConnectionFactory` in a `SQLiteDriver` and pass it to `RoomDatabase.Builder.setDriver`:

```kotlin
class PowerSyncConnectionFactoryAsSqliteDriver(
private val powersyncFactory: PersistentConnectionFactory
) : SQLiteDriver {
override fun open(fileName: String): SQLiteConnection {
if (fileName == ":memory:") {
return powersyncFactory.openInMemoryConnection()
}

return powersyncFactory.openConnection(fileName, null, false)
}
}
```

Depending on your target platform, pass an `AndroidEncryptedDatabaseFactory`, `JavaEncryptedDatabaseFactory`, or `NativeEncryptedDatabaseFactory` to the wrapper. The factory automatically installs the SQLite3MultipleCiphers extension — no manual setup required.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sqlite3mc is a fork, not an extension. But we should mention that the PowerSync extension gets loaded automatically, since it's a manual step with the default Room setup.

Suggested change
Depending on your target platform, pass an `AndroidEncryptedDatabaseFactory`, `JavaEncryptedDatabaseFactory`, or `NativeEncryptedDatabaseFactory` to the wrapper. The factory automatically installs the SQLite3MultipleCiphers extension — no manual setup required.
Depending on your target platform, pass an `AndroidEncryptedDatabaseFactory`, `JavaEncryptedDatabaseFactory`, or `NativeEncryptedDatabaseFactory` to the wrapper. The factory automatically installs the PowerSync SQLite extension, so you can skip the `loadPowerSyncExtension()` step.


```kotlin
val driver = PowerSyncConnectionFactoryAsSqliteDriver(
AndroidEncryptedDatabaseFactory(context, Key.Passphrase("your encryption key"))
)

val roomDb = Room.databaseBuilder<MyDatabase>(context, "your_database")
.setDriver(driver)
.build()
```
</Accordion>

<Accordion title="Swift" icon="swift">
Expand All @@ -138,9 +168,9 @@
The PowerSync Swift SDK depends on [CSQLite](https://github.com/powersync-ja/CSQLite) to build and link SQLite.
That package can be configured to optionally link SQLite3 Multiple Ciphers by enabling the `Encryption` trait. Due to SwiftPM limitations, we can't directly expose that trait on the Swift SDK.

Instead, we recommend directly depending on CSQLite with the encryption trait, which will enable the same for the SDK (since each package can only appear in a build once). Since Xcode doesn't support specifying package traits when adding dependencies, you first need to add a local Swift package as a workaround.

Check warning on line 171 in client-sdks/advanced/data-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/advanced/data-encryption.mdx#L171

Did you really mean 'CSQLite'?

1. Create a local `Package.swift` in your project that depends on CSQLite with the `Encryption` trait:

Check warning on line 173 in client-sdks/advanced/data-encryption.mdx

View check run for this annotation

Mintlify / Mintlify Validation (powersync) - vale-spellcheck

client-sdks/advanced/data-encryption.mdx#L173

Did you really mean 'CSQLite'?

```swift
// swift-tools-version: 6.2
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "powersync-docs",
"version": "1.0.0",
"scripts": {
"dev": "mintlify dev"
},
"devDependencies": {
"mintlify": "^4.2.520"
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably enable corepack as well, to ensure pnpm is used consistently.

}
Loading