Skip to content

Commit ba1c207

Browse files
author
Carl Julian Sauter
committed
feat: Added encryption documentation
1 parent 6a80104 commit ba1c207

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,22 @@ NitroSQLite.loadFileAsync('myDatabase', '/absolute/path/to/file.sql').then(
287287
);
288288
```
289289

290+
## Encryption
291+
292+
Database encryption is supported through [SQLite Encryption Extension](https://sqlite.org/see) (SEE).
293+
294+
As SEE is a paid product, you need to patch the files `react-native-nitro-sqlite/cpp/sqlite/sqlite3.c` and `react-native-nitro-sqlite/cpp/sqlite/sqlite3.h` after installation using `bun patch react-native-nitro-sqlite`. Replace them with the `sqlite.h` and `sqlite3-see-<algorithm>.c` files from the SEE sources.
295+
296+
In addition, the [pre-processor flag](#enable-compile-time-options) `SQLITE_ENABLE_SEE` needs to be specified.
297+
298+
You can then use encryption, by passing an encryption key when opening the database
299+
300+
```typescript
301+
import {open} from 'react-native-nitro-sqlite'
302+
303+
const db = open({name: 'myDb.sqlite', encryptionKey: 'SUPER_SECURE_ENCRYPTION_KEY'})
304+
```
305+
290306
# TypeORM
291307

292308
This library is pretty barebones, you can write all your SQL queries manually but for any large application, an ORM is recommended.

0 commit comments

Comments
 (0)