pub struct PasskeyService { /* private fields */ }Expand description
The passkey service: ceremonies behind the verifier seam, persistence over the store seam, challenge state per user.
Implementations§
Source§impl PasskeyService
impl PasskeyService
Sourcepub fn new(
rp_id: impl Into<String>,
rp_name: impl Into<String>,
rp_origins: Vec<String>,
store: Arc<dyn CredentialStore>,
) -> Self
pub fn new( rp_id: impl Into<String>, rp_name: impl Into<String>, rp_origins: Vec<String>, store: Arc<dyn CredentialStore>, ) -> Self
Creates a service from the relying-party facts, the credential
policy, and a credential store. Production uses KitVerifier.
Sourcepub fn with_verifier(
rp_id: impl Into<String>,
rp_name: impl Into<String>,
rp_origins: Vec<String>,
store: Arc<dyn CredentialStore>,
verifier: Arc<dyn CeremonyVerifier>,
) -> Self
pub fn with_verifier( rp_id: impl Into<String>, rp_name: impl Into<String>, rp_origins: Vec<String>, store: Arc<dyn CredentialStore>, verifier: Arc<dyn CeremonyVerifier>, ) -> Self
Creates a service with an explicit ceremony verifier. Production
builds the service with Self::new; tests and alternative
backends inject their own CeremonyVerifier.
Sourcepub fn registration_options(
&self,
user: &UserId,
label: &str,
) -> RegistrationOptions
pub fn registration_options( &self, user: &UserId, label: &str, ) -> RegistrationOptions
Builds the navigator.credentials.create() options for a user and
remembers the challenge. Existing passkeys for the user are excluded
(an authenticator cannot re-register the same credential).
Sourcepub fn finish_registration(
&self,
user: &UserId,
client_data_json_b64: &str,
attestation_object_b64: &str,
) -> Result<RegistrationResult>
pub fn finish_registration( &self, user: &UserId, client_data_json_b64: &str, attestation_object_b64: &str, ) -> Result<RegistrationResult>
Verifies a registration response and stores the credential.
§Errors
An expired or missing challenge, a challenge issued to a different user, or ceremony verification failures.
Sourcepub fn authentication_options(&self, user: &UserId) -> AuthenticationOptions
pub fn authentication_options(&self, user: &UserId) -> AuthenticationOptions
Builds the navigator.credentials.get() options for a user, allowing
exactly that user’s stored credentials, and remembers the challenge.
Sourcepub fn finish_authentication(
&self,
user: &UserId,
credential_id: &str,
client_data_json_b64: &str,
authenticator_data_b64: &str,
signature_b64: &str,
) -> Result<()>
pub fn finish_authentication( &self, user: &UserId, credential_id: &str, client_data_json_b64: &str, authenticator_data_b64: &str, signature_b64: &str, ) -> Result<()>
Verifies an authentication response against the user’s stored
credential. On success the caller issues session tokens via the
SessionService for the returned user.
§Errors
Ceremony failures, unknown credentials, a credential belonging to a different user, or expired/missing challenges.