Skip to content

Commit bc7bc04

Browse files
committed
Make deviceAuthenticator fallible
1 parent ba66ea2 commit bc7bc04

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

BitwardenShared/Core/Auth/Services/ClientFido2Service.swift

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,7 @@ protocol ClientFido2Service: AnyObject {
1515
userInterface: Fido2UserInterface,
1616
credentialStore: Fido2CredentialStore,
1717
) -> ClientFido2AuthenticatorProtocol
18-
19-
/// - Parameters:
20-
/// - userInterface: `Fido2UserInterface` with necessary platform side logic related to UI.
21-
/// - credentialStore: `Fido2CredentialStore` with necessary platform side logic related to credential storage.
22-
/// - deviceKey: `SymmetricKey` used to encrypt data on the device.
23-
/// - Returns: Returns the `ClientFido2Authenticator` to perform Fido2 authenticator tasks
24-
func deviceAuthenticator(
25-
userInterface: Fido2UserInterface,
26-
credentialStore: Fido2CredentialStore,
27-
deviceKey: SymmetricKey,
28-
) -> ClientFido2AuthenticatorProtocol
2918

30-
/// Returns the `ClientFido2Authenticator` to perform Fido2 authenticator tasks on keychain items.
3119
/// - Parameters:
3220
/// - userInterface: `Fido2UserInterface` with necessary platform side logic related to UI.
3321
/// - credentialStore: `Fido2CredentialStore` with necessary platform side logic related to credential storage.
@@ -36,8 +24,8 @@ protocol ClientFido2Service: AnyObject {
3624
func deviceAuthenticator(
3725
userInterface: Fido2UserInterface,
3826
credentialStore: Fido2CredentialStore,
39-
deviceKey: SymmetricKey
40-
) -> ClientFido2AuthenticatorProtocol
27+
deviceKey: SymmetricKey,
28+
) throws -> ClientFido2AuthenticatorProtocol
4129

4230
/// Returns the `ClientFido2Client` to perform Fido2 client tasks.
4331
/// - Parameters:
@@ -75,11 +63,11 @@ extension ClientFido2: ClientFido2Service {
7563
userInterface: Fido2UserInterface,
7664
credentialStore: Fido2CredentialStore,
7765
deviceKey: SymmetricKey,
78-
) -> ClientFido2AuthenticatorProtocol {
66+
) throws -> ClientFido2AuthenticatorProtocol {
7967
let encryptionKey = deviceKey.withUnsafeBytes { bytes in
8068
Data(Array(bytes))
8169
}
82-
return deviceAuthenticator(
70+
return try deviceAuthenticator(
8371
userInterface: userInterface,
8472
credentialStore: credentialStore,
8573
encryptionKey: encryptionKey

0 commit comments

Comments
 (0)