Remove SinglePromptSecureEnclaveValet from tvOS targets#284
Remove SinglePromptSecureEnclaveValet from tvOS targets#284dfed merged 3 commits intosquare:masterfrom
Conversation
| keychainQuery[kSecUseAuthenticationContext as String] = localAuthenticationContext | ||
| return keychainQuery | ||
| #if os(tvOS) | ||
| // tvOS doesn't support LAContext |
There was a problem hiding this comment.
I'm assuming omitting the authentication context won't change any behavior. Presumably this never worked on tvOS, but I don't know if the presence of the key affects behavior. cc @dfed
There was a problem hiding this comment.
So I think we need to make the entire SinglePromptSecureEnclaveValet unavailable on tvOS.
The approach taken here will make this type behave like the SecureEnclaveValet, which isn't what we want.
The more I think about this, the more I think we make this a breaking change and roll a major version. We may also need a way to let folk on tvOS using this type migrate to SecureEnclaveValet, but given that no one has told us this wasn't working I kinda doubt anyone tried to use it that way... so maybe we don't build that until someone asks for it.
Taking the route of making SinglePromptSecureEnclaveValet unavailable on tvOS will also force us to solve #270, which is kinda a nice bonus.
There was a problem hiding this comment.
I agree, I'll update the PR to make SinglePromptSecureEnclaveValet unavailable on tvOS.
Codecov Report
@@ Coverage Diff @@
## master #284 +/- ##
==========================================
- Coverage 86.81% 86.71% -0.11%
==========================================
Files 16 16
Lines 986 986
==========================================
- Hits 856 855 -1
- Misses 130 131 +1
|
7a22eea to
ac8235f
Compare
|
This is a good start! To get CI passing you'll likely need to update the availability checks in |
|
Just marking as |
Signed-off-by: Diogo Tridapalli <diogot@users.noreply.github.com>
Signed-off-by: Diogo Tridapalli <diogot@users.noreply.github.com>
ac8235f to
f615eeb
Compare
|
New approach, remove the classes from tvOS using |
|
They are failing with |
Which tests are failing for you? Are these tests failing for you on Good news is CI is passing, but there are some tests we don't run in CI because CI can't properly test some keychain interactions without some manual intervention 😬 |
dfed
left a comment
There was a problem hiding this comment.
This is looking really good! Some suggestions below. Let's figure out these test failures you are seeing locally, but I think we're darned close.
Tests/ValetIntegrationTests/SinglePromptSecureEnclaveIntegrationTests.swift
Outdated
Show resolved
Hide resolved
| { | ||
| static let identifier = Identifier(nonEmpty: "valet_testing")! | ||
|
|
||
| @available(tvOS 11.0, *) |
There was a problem hiding this comment.
so good to be able to get rid of these!
| guard #available(tvOS 11.0, *) else { | ||
| return | ||
| } |
There was a problem hiding this comment.
"Fun" fact: Marking a test as @available does not prevent that test from being run on unavailable OS versions 😬, hence the need for all of these guards
There was a problem hiding this comment.
I figure that out, hehe
Tests/ValetIntegrationTests/SinglePromptSecureEnclaveIntegrationTests.swift
Outdated
Show resolved
Hide resolved
Tests/ValetObjectiveCBridgeTests/VALSinglePromptSecureEnclaveValetTests.m
Outdated
Show resolved
Hide resolved
| if (@available(tvOS 11.0, *)) { | ||
| VALSinglePromptSecureEnclaveValet *const valet = [VALSinglePromptSecureEnclaveValet valetWithIdentifier:self.identifier accessControl:VALSecureEnclaveAccessControlDevicePasscode]; | ||
| XCTAssertEqual(valet.accessControl, VALSecureEnclaveAccessControlDevicePasscode); | ||
| XCTAssertEqual([valet class], [VALSinglePromptSecureEnclaveValet class]); | ||
| } | ||
| VALSinglePromptSecureEnclaveValet *const valet = [VALSinglePromptSecureEnclaveValet valetWithIdentifier:self.identifier accessControl:VALSecureEnclaveAccessControlDevicePasscode]; | ||
| XCTAssertEqual(valet.accessControl, VALSecureEnclaveAccessControlDevicePasscode); | ||
| XCTAssertEqual([valet class], [VALSinglePromptSecureEnclaveValet class]); |
Co-authored-by: Dan Federman <dfed@me.com> Signed-off-by: Diogo Tridapalli <diogot@users.noreply.github.com>
529e2c0 to
4c533de
Compare
|
The tests are also failing in
|
That makes sense. I think this method needs to be updated to include later OS versions: Valet/Tests/ValetIntegrationTests/ValetIntegrationTests.swift Lines 39 to 52 in 53f25b8 Note that these tests are failing on my iOS 15 simulator as well. The good news is it works on device. I'll put up a PR to fix this. In the interim, I think this PR is good to merge! |
|
Thanks!! |
LAContext is not available in tvOS, but for some reason it was compiling in older Xcode versions.