generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-8829] Password/Fido2 credentials autofill on prepare credential l…
…ist (#759)
- Loading branch information
Showing
40 changed files
with
1,808 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
BitwardenShared/Core/Autofill/Models/PasskeyCredentialRequestParameters.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import AuthenticationServices | ||
|
||
/// Protocol to bypass using @available for passkey request parameters and also to be able to do unit tests | ||
/// given that we cannot create an instance of `ASPasskeyCredentialRequestParameters`. | ||
public protocol PasskeyCredentialRequestParameters { | ||
/// A list of allowed credential IDs for this request. An empty list means all credentials are allowed. | ||
var allowedCredentials: [Data] { get } | ||
/// Hash of client data for credential provider to sign as part of the operation. | ||
var clientDataHash: Data { get } | ||
/// The relying party identifier for this request. | ||
var relyingPartyIdentifier: String { get } | ||
/// A preference for whether the authenticator should attempt to verify that it is being used by its owner, | ||
/// such as through a PIN or biometrics. | ||
var userVerificationPreference: ASAuthorizationPublicKeyCredentialUserVerificationPreference { get } | ||
} | ||
|
||
@available(iOSApplicationExtension 17.0, *) | ||
extension ASPasskeyCredentialRequestParameters: PasskeyCredentialRequestParameters {} |
27 changes: 27 additions & 0 deletions
27
...ardenShared/Core/Autofill/Models/TestHelpers/MockPasskeyCredentialRequestParameters.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import AuthenticationServices | ||
|
||
@testable import BitwardenShared | ||
|
||
/// Mock for `PasskeyCredentialRequestParameters` given that | ||
/// we cannot create an instance of `ASPasskeyCredentialRequestParameters` | ||
class MockPasskeyCredentialRequestParameters: PasskeyCredentialRequestParameters { | ||
var relyingPartyIdentifier: String | ||
|
||
var clientDataHash: Data | ||
|
||
var userVerificationPreference: ASAuthorizationPublicKeyCredentialUserVerificationPreference | ||
|
||
var allowedCredentials: [Data] | ||
|
||
init( | ||
relyingPartyIdentifier: String = "myApp.com", | ||
clientDataHash: Data = Data(repeating: 1, count: 32), | ||
userVerificationPreference: ASAuthorizationPublicKeyCredentialUserVerificationPreference = .preferred, | ||
allowedCredentials: [Data] = [] | ||
) { | ||
self.relyingPartyIdentifier = relyingPartyIdentifier | ||
self.clientDataHash = clientDataHash | ||
self.userVerificationPreference = userVerificationPreference | ||
self.allowedCredentials = allowedCredentials | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.