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
564 changes: 564 additions & 0 deletions examples/todo-list/bun.lock

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions examples/todo-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,25 @@
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"dependencies": {
"@tailwindcss/postcss": "^4.2.1",
"@tauri-apps/api": "^2.0.0",
"drizzle-orm": "^0.40.0",
"mode-watcher": "^1.1.0",
"svelte-sonner": "^1.0.7",
"tauri-plugin-turso-api": "link:../../"
"tauri-plugin-turso-api": "file:../../"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^6.0.0",
"@tailwindcss/vite": "^4.1.18",
"@tauri-apps/cli": "^2.0.0",
"autoprefixer": "^10.4.27",
"clsx": "^2.1.1",
"drizzle-kit": "^0.31.9",
"postcss": "^8.5.8",
"svelte": "^5.0.0",
"svelte-check": "^4.4.3",
"tailwind-merge": "^3.5.0",
"tailwindcss": "^4.1.18",
"vite": "^7.0.0"
"tailwindcss": "^4.2.1",
"vite": "^7.3.1"
}
}
8 changes: 8 additions & 0 deletions examples/todo-list/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
"@tailwindcss/postcss": {},
},
};

export default config;
5 changes: 3 additions & 2 deletions examples/todo-list/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ repository = ""
edition = "2021"
rust-version = "1.77.2"

[workspace]

[lib]
name = "tauri_app_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
Expand All @@ -19,5 +21,4 @@ tauri-build = { version = "2.5.4", default-features = false , features = [] }

[dependencies]
tauri = { version = "2.10.0", features = [] }
tauri-plugin-turso = { path = "../../../", features = ["replication"] }

tauri-plugin-turso = { path = "../../../"}
33 changes: 14 additions & 19 deletions examples/todo-list/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,25 @@ pub fn run() {
let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));

// Check for optional encryption key from environment variable
// Set LIBSQL_ENCRYPTION_KEY to any string - it will be padded/truncated to 32 bytes
// Example: export LIBSQL_ENCRYPTION_KEY=my-secret-key
// Set LIBSQL_ENCRYPTION_KEY to Hex-encoded encryption key (e.g. 64 hex chars for a 32-byte key)
// Example: export LIBSQL_ENCRYPTION_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
let encryption = std::env::var("LIBSQL_ENCRYPTION_KEY").ok().map(|key_str| {
// Convert string to bytes and pad/truncate to 32 bytes
let mut key_bytes = key_str.as_bytes().to_vec();

if key_bytes.len() < 32 {
// Pad by repeating the key
let original = key_bytes.clone();
while key_bytes.len() < 32 {
let remaining = 32 - key_bytes.len();
let take = remaining.min(original.len());
key_bytes.extend_from_slice(&original[..take]);
let mut hexkey = key_str.clone();
// Pad by repeating the key
if key_str.len() < 64 {
while hexkey.len() < 64 {
let remaining = 64 - hexkey.len();
let take = remaining.min(key_str.len());
hexkey.push_str(&key_str[..take]);
}
eprintln!("LIBSQL_ENCRYPTION_KEY padded to 32 bytes");
} else if key_bytes.len() > 32 {
// Truncate to 32 bytes
key_bytes.truncate(32);
eprintln!("LIBSQL_ENCRYPTION_KEY truncated to 32 bytes");
} else {
hexkey.truncate(64);
}

eprintln!("hexkey: {}", hexkey);
tauri_plugin_turso::EncryptionConfig {
cipher: tauri_plugin_turso::Cipher::Aes256Cbc,
key: key_bytes,
cipher: "aes256gcm".to_string(),
hexkey: hexkey,
}
});

Expand Down
4 changes: 4 additions & 0 deletions examples/todo-list/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export default defineConfig({
plugins: [tailwindcss(), svelte()],
resolve: {
alias: {
"@tauri-apps/api/core": path.resolve(
__dirname,
"./node_modules/@tauri-apps/api/core.js",
),
$lib: path.resolve(__dirname, "./src/lib"),
},
},
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"@tauri-apps/api": "^2.0.0"
},
"devDependencies": {
"@rollup/plugin-typescript": "^12.0.0",
"@rollup/plugin-typescript": "^12.3.0",
"rollup": "^4.9.6",
"tslib": "^2.6.2",
"typescript": "^5.3.3"
"tslib": "^2.8.1",
"typescript": "^5.9.3"
},
"packageManager": "pnpm@10.30.2+sha512.36cdc707e7b7940a988c9c1ecf88d084f8514b5c3f085f53a2e244c2921d3b2545bc20dd4ebe1fc245feec463bb298aecea7a63ed1f7680b877dc6379d8d0cb4"
}