pub struct SqliteStore { /* private fields */ }Implementations§
Source§impl SqliteStore
impl SqliteStore
Trait Implementations§
Source§impl UserStore for SqliteStore
impl UserStore for SqliteStore
fn user_by_nick(&self, nick: &str) -> StoreResult<Option<User>>
Source§fn insert_user(
&self,
nick: &str,
tier: &str,
secret_hash: Option<&str>,
now_ms: i64,
) -> StoreResult<User>
fn insert_user( &self, nick: &str, tier: &str, secret_hash: Option<&str>, now_ms: i64, ) -> StoreResult<User>
secret_hash is an opaque password hash (or None for door-only users).fn secret_hash(&self, user_id: i64) -> StoreResult<Option<String>>
Source§fn update_nick(
&self,
user_id: i64,
new_nick: &str,
now_ms: i64,
) -> StoreResult<User>
fn update_nick( &self, user_id: i64, new_nick: &str, now_ms: i64, ) -> StoreResult<User>
Changes the nick; must fail with
StoreError::NickTaken on a collision.fn set_tier(&self, user_id: i64, tier: &str) -> StoreResult<()>
Source§fn delete_user(&self, user_id: i64) -> StoreResult<()>
fn delete_user(&self, user_id: i64) -> StoreResult<()>
Removes the user and all its credentials and door links.
fn add_credential( &self, user_id: i64, cred_ref: &str, token_hash: &str, now_ms: i64, ) -> StoreResult<()>
fn user_by_token_hash( &self, token_hash: &str, ) -> StoreResult<Option<(User, String)>>
Source§fn delete_credential(&self, cred_ref: &str) -> StoreResult<Option<i64>>
fn delete_credential(&self, cred_ref: &str) -> StoreResult<Option<i64>>
Removes one credential; returns the owner’s id when it existed.
fn credentials_of(&self, user_id: i64) -> StoreResult<Vec<String>>
Source§fn live_credentials(&self) -> StoreResult<Vec<(String, Vec<String>)>>
fn live_credentials(&self) -> StoreResult<Vec<(String, Vec<String>)>>
Every user with the references of all its live credentials (users without any are included).
fn user_by_door(&self, source: &str, subject: &str) -> StoreResult<Option<User>>
Source§fn set_secret_hash(&self, user_id: i64, hash: &str) -> StoreResult<()>
fn set_secret_hash(&self, user_id: i64, hash: &str) -> StoreResult<()>
Replaces the password hash (account/password).
Source§fn supports_refresh(&self) -> bool
fn supports_refresh(&self) -> bool
Does the store keep expiry and refresh tokens for credentials?
Source§fn set_refresh(
&self,
cred_ref: &str,
refresh_hash: &str,
access_expires_ms: i64,
refresh_expires_ms: i64,
) -> StoreResult<()>
fn set_refresh( &self, cred_ref: &str, refresh_hash: &str, access_expires_ms: i64, refresh_expires_ms: i64, ) -> StoreResult<()>
Gives a credential an access-token expiry and a refresh token (only its hash is kept).
user_by_token_hash must stop finding the credential once access_expires_ms has passed.Source§fn take_refresh(
&self,
refresh_hash: &str,
now_ms: i64,
) -> StoreResult<Option<String>>
fn take_refresh( &self, refresh_hash: &str, now_ms: i64, ) -> StoreResult<Option<String>>
Consumes a refresh token (one use): the credential it belongs to, if valid at
now_ms.Source§fn replace_token(
&self,
cred_ref: &str,
token_hash: &str,
access_expires_ms: i64,
) -> StoreResult<()>
fn replace_token( &self, cred_ref: &str, token_hash: &str, access_expires_ms: i64, ) -> StoreResult<()>
Swaps a credential’s access-token hash (the credential reference stays, so the messenger’s
device stays) and sets its new expiry.
fn supports_keys(&self) -> bool
Source§fn create_invite(
&self,
code_hash: &str,
user_id: i64,
expires_ms: i64,
) -> StoreResult<()>
fn create_invite( &self, code_hash: &str, user_id: i64, expires_ms: i64, ) -> StoreResult<()>
Remembers an invite (only the hash of its code) for an existing user, valid until
expires_ms.Source§fn create_invite_with(
&self,
code_hash: &str,
user_id: i64,
expires_ms: i64,
reserved: bool,
) -> StoreResult<()>
fn create_invite_with( &self, code_hash: &str, user_id: i64, expires_ms: i64, reserved: bool, ) -> StoreResult<()>
Self::create_invite that also records whether the operator reserved the nick (true) or
left it a placeholder that the enrolling client may replace by asking for its own. A store
that does not record it treats every invite as reserved: no rename.Source§fn peek_invite(
&self,
code_hash: &str,
now_ms: i64,
) -> StoreResult<Option<(User, bool)>>
fn peek_invite( &self, code_hash: &str, now_ms: i64, ) -> StoreResult<Option<(User, bool)>>
The invite’s user and its reserved flag without consuming it;
None when it does not exist,
has expired, or the store cannot look without consuming.Source§fn take_invite(&self, code_hash: &str, now_ms: i64) -> StoreResult<Option<User>>
fn take_invite(&self, code_hash: &str, now_ms: i64) -> StoreResult<Option<User>>
Consumes an invite (one use): the user it was made for, if it exists and has not expired.
Source§fn take_invite_with(
&self,
code_hash: &str,
now_ms: i64,
) -> StoreResult<Option<(User, bool)>>
fn take_invite_with( &self, code_hash: &str, now_ms: i64, ) -> StoreResult<Option<(User, bool)>>
Self::take_invite with the reserved flag.Source§fn add_key(
&self,
user_id: i64,
key_id: &str,
public_key: &str,
label: &str,
now_ms: i64,
) -> StoreResult<()>
fn add_key( &self, user_id: i64, key_id: &str, public_key: &str, label: &str, now_ms: i64, ) -> StoreResult<()>
Binds a public key (base64url) to a user.
key_id is also the key credential’s reference.Source§fn user_by_key(&self, key_id: &str) -> StoreResult<Option<(User, String)>>
fn user_by_key(&self, key_id: &str) -> StoreResult<Option<(User, String)>>
The user and public key (base64url) behind a
key_id.Source§fn delete_key(&self, key_id: &str) -> StoreResult<bool>
fn delete_key(&self, key_id: &str) -> StoreResult<bool>
Removes a key (its login stops working); true when it existed.
fn link_door( &self, user_id: i64, source: &str, subject: &str, ) -> StoreResult<()>
Auto Trait Implementations§
impl !RefUnwindSafe for SqliteStore
impl !UnwindSafe for SqliteStore
impl Freeze for SqliteStore
impl Send for SqliteStore
impl Sync for SqliteStore
impl Unpin for SqliteStore
impl UnsafeUnpin for SqliteStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more