mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
begin authorization components implementation for gemini protocol
This commit is contained in:
parent
b32a1a297f
commit
f487215ca9
8 changed files with 319 additions and 34 deletions
37
src/profile/identity/gemini/auth.rs
Normal file
37
src/profile/identity/gemini/auth.rs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
mod database;
|
||||
|
||||
use database::Database;
|
||||
|
||||
use sqlite::{Connection, Transaction};
|
||||
use std::{rc::Rc, sync::RwLock};
|
||||
|
||||
/// API for `gemini_id` + `request` auth pairs operations
|
||||
pub struct Auth {
|
||||
pub database: Rc<Database>,
|
||||
}
|
||||
|
||||
impl Auth {
|
||||
// Constructors
|
||||
|
||||
/// Create new `Self`
|
||||
pub fn new(connection: Rc<RwLock<Connection>>, profile_id: Rc<i64>) -> Self {
|
||||
Self {
|
||||
database: Rc::new(Database::new(connection, profile_id)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tools
|
||||
|
||||
pub fn migrate(tx: &Transaction) -> Result<(), String> {
|
||||
// Migrate self components
|
||||
if let Err(e) = database::init(tx) {
|
||||
return Err(e.to_string());
|
||||
}
|
||||
|
||||
// Delegate migration to childs
|
||||
// nothing yet..
|
||||
|
||||
// Success
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue