Skip to content

Commit 674d2d0

Browse files
committed
migrate make-credential entirely over to the crypto backend
1 parent e59e2ec commit 674d2d0

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

passkey-authenticator/src/authenticator/make_credential.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use p256::SecretKey;
21
use passkey_crypto::{
32
CryptoBackend,
43
rng::{Rng, RngBackend},
@@ -118,10 +117,10 @@ where
118117
// 9. Generate a new credential key pair for the algorithm specified.
119118
let credential_id = Rng::random_vec(self.credential_id_length.into());
120119

121-
let private_key = {
122-
let mut rng = Rng::new();
123-
SecretKey::random(&mut rng)
124-
};
120+
let private_key = self
121+
.crypto
122+
.generate_key(algorithm)
123+
.map_err(|_| Ctap2Error::UnsupportedAlgorithm)?;
125124

126125
let extensions = self.make_extensions(input.extensions, flags.contains(Flags::UV))?;
127126

passkey-authenticator/src/ctap2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<S, U, C> Ctap2Api for Authenticator<S, U, C>
5454
where
5555
S: CredentialStore + Sync + Send,
5656
U: UserValidationMethod<PasskeyItem = <S as CredentialStore>::PasskeyItem> + Sync + Send,
57-
C: CryptoBackend + Sync + Send,
57+
C: CryptoBackend<SecretKey: Sync + Send> + Sync + Send,
5858
{
5959
async fn get_info(&self) -> Box<get_info::Response> {
6060
Authenticator::get_info(self).await

0 commit comments

Comments
 (0)