| Crates.io | oriko-core |
| lib.rs | oriko-core |
| version | 0.1.1 |
| created_at | 2025-12-29 22:27:37.475252+00 |
| updated_at | 2025-12-31 21:50:43.960645+00 |
| description | Voudo Oriko core utilities - database, auth, and encryption |
| homepage | |
| repository | https://github.com/your-org/email-apps |
| max_upload_size | |
| id | 2011588 |
| size | 83,099 |
Voudo Oriko core utilities - database, authentication, and encryption.
Add to your Cargo.toml:
[dependencies]
oriko-core = { path = "../packages/oriko-core" }
# Or from crates.io (when published)
# oriko-core = "0.1.0"
use oriko_core::Database;
// Create or open a database
let mut db = Database::new("/path/to/database.db")?;
// Get connection
let conn = db.connection();
use oriko_core::{OAuthFlow, OAuthProvider, GmailCredentials, run_gmail_oauth_flow};
// Run OAuth flow
let credentials = GmailCredentials::from_env()
.ok_or("Missing credentials")?;
let (tokens, user_info) = run_gmail_oauth_flow(credentials).await?;
use oriko_core::{encrypt_tokens, decrypt_tokens};
use std::path::Path;
let app_data_dir = Path::new("/app/data");
let tokens_json = r#"{"access_token": "..."}"#;
// Encrypt
let encrypted = encrypt_tokens(app_data_dir, tokens_json)?;
// Decrypt
let decrypted = decrypt_tokens(app_data_dir, &encrypted)?;
Database::new(path) - Create or open databaseDatabase::connection() - Get read-only connectionDatabase::connection_mut() - Get mutable connectionOAuthFlow::new(provider, credentials, redirect_port) - Create OAuth flowOAuthFlow::generate_auth_url() - Generate authorization URLOAuthFlow::exchange_code(code) - Exchange authorization code for tokensrun_gmail_oauth_flow(credentials) - Complete Gmail OAuth flowfetch_user_info(access_token) - Fetch user informationrefresh_access_token(refresh_token, credentials) - Refresh access tokenencrypt_tokens(app_data_dir, tokens_json) - Encrypt tokensdecrypt_tokens(app_data_dir, encrypted_hex) - Decrypt tokens