Skip to content

Commit c882aa0

Browse files
committed
update sync example to pass remote encryption params
1 parent 9ea40e9 commit c882aa0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

examples/sync/example.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ if (!url) {
88
const authToken = process.env.LIBSQL_AUTH_TOKEN;
99

1010
const options = { syncUrl: url, authToken: authToken };
11+
12+
// Sync also supports Turso Cloud encryption.
13+
//
14+
// Documentation: https://docs.turso.tech/cloud/encryption
15+
//
16+
//
17+
// export LIBSQL_ENCRYPTION_KEY="encryption key in base64 format"
18+
//
19+
// The encryption key must be encoded in base64 format.
20+
21+
const encryptionKey = process.env.LIBSQL_ENCRYPTION_KEY;
22+
23+
if (encryptionKey) {
24+
options.remoteEncryptionKey = encryptionKey;
25+
}
26+
1127
const db = new Database("hello.db", options);
1228

1329
db.sync();

0 commit comments

Comments
 (0)