-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove SinglePromptSecureEnclaveValet from tvOS targets #284
Conversation
keychainQuery[kSecUseAuthenticationContext as String] = localAuthenticationContext | ||
return keychainQuery | ||
#if os(tvOS) | ||
// tvOS doesn't support LAContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 😬 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
#if canImport(LocalAuthentication) | ||
|
||
class SinglePromptSecureEnclaveIntegrationTests: XCTestCase | ||
{ | ||
static let identifier = Identifier(nonEmpty: "valet_testing")! | ||
|
||
@available(tvOS 11.0, *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so good to be able to get rid of these!
guard #available(tvOS 11.0, *) else { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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 guard
s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holy moly this is nicer!
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.