mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
delegate certificate init to ggemini wrapper, add structs for some, tuple entities, move match_priority to gemini impl area
This commit is contained in:
parent
36f07aa773
commit
053c078e11
6 changed files with 53 additions and 29 deletions
|
|
@ -2,11 +2,13 @@ mod auth;
|
|||
mod certificate;
|
||||
mod database;
|
||||
mod error;
|
||||
mod identity;
|
||||
mod memory;
|
||||
|
||||
use auth::Auth;
|
||||
use database::Database;
|
||||
pub use error::Error;
|
||||
use identity::Identity;
|
||||
|
||||
use memory::Memory;
|
||||
|
||||
|
|
@ -106,6 +108,24 @@ impl Gemini {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get `pem` record match `request`
|
||||
/// * [Client certificates specification](https://geminiprotocol.net/docs/protocol-specification.gmi#client-certificates)
|
||||
/// * this function work with memory cache collected (not database)
|
||||
pub fn match_priority(&self, request: &str) -> Option<Identity> {
|
||||
if let Some(auth) = self.auth.memory.match_priority(request) {
|
||||
match self.memory.get(auth.profile_identity_gemini_id) {
|
||||
Ok(pem) => {
|
||||
return Some(Identity {
|
||||
scope: auth.scope,
|
||||
pem,
|
||||
})
|
||||
}
|
||||
Err(reason) => todo!("{:?}", reason.to_string()),
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
// Tools
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue