diff options
Diffstat (limited to 'crates/secd/src')
| -rw-r--r-- | crates/secd/src/client/store/mod.rs | 7 | ||||
| -rw-r--r-- | crates/secd/src/command/authn.rs | 10 | ||||
| -rw-r--r-- | crates/secd/src/util/mod.rs | 1 |
3 files changed, 9 insertions, 9 deletions
diff --git a/crates/secd/src/client/store/mod.rs b/crates/secd/src/client/store/mod.rs index b93fd84..8a076c4 100644 --- a/crates/secd/src/client/store/mod.rs +++ b/crates/secd/src/client/store/mod.rs @@ -1,15 +1,10 @@ pub(crate) mod sql_db; -use email_address::EmailAddress; use sqlx::{Postgres, Sqlite}; use std::sync::Arc; -use time::OffsetDateTime; use uuid::Uuid; -use crate::{ - util, Address, AddressType, AddressValidation, Identity, IdentityId, PhoneNumber, Session, - SessionToken, -}; +use crate::{util, Address, AddressType, AddressValidation, Identity, IdentityId, Session}; use self::sql_db::SqlClient; diff --git a/crates/secd/src/command/authn.rs b/crates/secd/src/command/authn.rs index 5590e8c..1d3b2d5 100644 --- a/crates/secd/src/command/authn.rs +++ b/crates/secd/src/command/authn.rs @@ -8,8 +8,8 @@ use crate::{ }, }, util, Address, AddressType, AddressValidation, AddressValidationId, AddressValidationMethod, - Credential, CredentialType, Identity, IdentityId, PhoneNumber, Secd, SecdError, Session, - SessionToken, ADDRESSS_VALIDATION_CODE_SIZE, ADDRESS_VALIDATION_ALLOWS_ATTEMPTS, + Credential, CredentialType, Identity, PhoneNumber, Secd, SecdError, Session, SessionToken, + ADDRESSS_VALIDATION_CODE_SIZE, ADDRESS_VALIDATION_ALLOWS_ATTEMPTS, ADDRESS_VALIDATION_IDENTITY_SURJECTION, EMAIL_VALIDATION_DURATION, }; use email_address::EmailAddress; @@ -278,4 +278,10 @@ impl Secd { Ok(i.swap_remove(0)) } } + + pub async fn revoke_session(&self, session: &mut Session) -> Result<(), SecdError> { + session.revoked_at = Some(OffsetDateTime::now_utc()); + session.write(self.store.clone()).await?; + Ok(()) + } } diff --git a/crates/secd/src/util/mod.rs b/crates/secd/src/util/mod.rs index 6677c2f..c26986d 100644 --- a/crates/secd/src/util/mod.rs +++ b/crates/secd/src/util/mod.rs @@ -1,6 +1,5 @@ pub(crate) mod from; -use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use sha2::{Digest, Sha256}; use time::OffsetDateTime; |
