pub struct AuthStore { /* private fields */ }Expand description
File-backed authentication state shared by all accepted connections.
Implementations§
Source§impl AuthStore
impl AuthStore
Sourcepub fn initialize(
path: impl Into<PathBuf>,
config: AuthConfig,
) -> Result<(Self, PairingGrant)>
pub fn initialize( path: impl Into<PathBuf>, config: AuthConfig, ) -> Result<(Self, PairingGrant)>
Initializes authentication with the required operator pairing policy.
§Errors
Returns an error for invalid policy or inaccessible authentication state.
Sourcepub fn open(path: impl Into<PathBuf>, config: AuthConfig) -> Result<Self>
pub fn open(path: impl Into<PathBuf>, config: AuthConfig) -> Result<Self>
Opens authentication with the required operator pairing policy. Existing clients remain valid when the configured limit is reduced.
§Errors
Returns an error for invalid policy, corrupt state, or inaccessible files.
Sourcepub fn pair(&self, code: &str, client_label: &str) -> Result<IssuedToken>
pub fn pair(&self, code: &str, client_label: &str) -> Result<IssuedToken>
Consumes the pending code and appends an independently issued client token.
§Errors
Returns an error if authentication fails or its stored state is invalid.
Sourcepub fn repair_pairing(
&self,
code: &str,
replacing_token_digest: &[u8; 32],
client_label: &str,
) -> Result<IssuedToken>
pub fn repair_pairing( &self, code: &str, replacing_token_digest: &[u8; 32], client_label: &str, ) -> Result<IssuedToken>
Consumes the pending code and rotates one existing client token in place.
§Errors
Returns an error if authentication fails or its stored state is invalid.
Sourcepub fn create_pairing_code(&self) -> Result<PairingGrant>
pub fn create_pairing_code(&self) -> Result<PairingGrant>
Replaces any unused pairing code without invalidating paired clients.
§Errors
Returns an error if validation or an operation required by this function fails.
Sourcepub fn authenticate(&self, token: &str) -> Result<ClientIdentity>
pub fn authenticate(&self, token: &str) -> Result<ClientIdentity>
Verifies a bearer token against every paired client digest.
§Errors
Returns an error if authentication fails or its stored state is invalid.