Skip to content

Commit

Permalink
rename ios* parameters to darwin*
Browse files Browse the repository at this point in the history
  • Loading branch information
hpoul committed May 21, 2024
1 parent 31f043a commit 9120b67
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 35 deletions.
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011

COCOAPODS: 1.15.0
COCOAPODS: 1.15.2
2 changes: 1 addition & 1 deletion example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
56 changes: 40 additions & 16 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.19.0"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -139,34 +163,34 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16"
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.12.0"
path:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.8.3"
version: "1.9.0"
plugin_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -224,10 +248,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.7.0"
typed_data:
dependency: transitive
description:
Expand All @@ -244,14 +268,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
web:
vm_service:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "14.2.1"
win32:
dependency: transitive
description:
Expand All @@ -261,5 +285,5 @@ packages:
source: hosted
version: "5.2.0"
sdks:
dart: ">=3.2.0 <4.0.0"
flutter: ">=2.8.0"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
21 changes: 11 additions & 10 deletions lib/src/biometric_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class StorageFileInitOptions {
StorageFileInitOptions({
Duration? androidAuthenticationValidityDuration,
Duration? iosTouchIDAuthenticationAllowableReuseDuration,
this.iosTouchIDAuthenticationForceReuseContextDuration,
this.darwinTouchIDAuthenticationForceReuseContextDuration,
this.authenticationValidityDurationSeconds = -1,
this.authenticationRequired = true,
this.androidBiometricOnly = true,
Expand All @@ -96,13 +96,14 @@ class StorageFileInitOptions {
(authenticationValidityDurationSeconds <= 0
? null
: Duration(seconds: authenticationValidityDurationSeconds)),
iosTouchIDAuthenticationAllowableReuseDuration =
darwinTouchIDAuthenticationAllowableReuseDuration =
iosTouchIDAuthenticationAllowableReuseDuration ??
(authenticationValidityDurationSeconds <= 0
? null
: Duration(seconds: authenticationValidityDurationSeconds));

@Deprecated('use androidAuthenticationValidityDuration instead')
@Deprecated(
'use use androidAuthenticationValidityDuration, iosTouchIDAuthenticationAllowableReuseDuration or iosTouchIDAuthenticationForceReuseContextDuration instead')
final int authenticationValidityDurationSeconds;

/// see https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.Builder#setUserAuthenticationParameters(int,%20int)
Expand All @@ -114,15 +115,15 @@ class StorageFileInitOptions {
/// > Note that this grace period applies specifically to device unlock with Touch ID, not keychain retrieval authentications
///
/// If you want to avoid requiring authentication after a successful
/// keychain retrieval see [iosTouchIDAuthenticationForceReuseContextDuration]
final Duration? iosTouchIDAuthenticationAllowableReuseDuration;
/// keychain retrieval see [darwinTouchIDAuthenticationForceReuseContextDuration]
final Duration? darwinTouchIDAuthenticationAllowableReuseDuration;

/// To prevent forcing the user to authenticate again after unlocking once
/// we can reuse the `LAContext` object for the given amount of time.
/// see https://github.com/authpass/biometric_storage/pull/73
/// This is pretty much undocumented behavior, but works similar to
/// `androidAuthenticationValidityDuration`.
final Duration? iosTouchIDAuthenticationForceReuseContextDuration;
final Duration? darwinTouchIDAuthenticationForceReuseContextDuration;

/// Whether an authentication is required. if this is
/// false NO BIOMETRIC CHECK WILL BE PERFORMED! and the value
Expand All @@ -149,10 +150,10 @@ class StorageFileInitOptions {
authenticationValidityDurationSeconds,
'androidAuthenticationValidityDurationSeconds':
androidAuthenticationValidityDuration?.inSeconds,
'iosTouchIDAuthenticationAllowableReuseDurationSeconds':
iosTouchIDAuthenticationAllowableReuseDuration?.inSeconds,
'iosTouchIDAuthenticationForceReuseContextDurationSeconds':
iosTouchIDAuthenticationForceReuseContextDuration?.inSeconds,
'darwinTouchIDAuthenticationAllowableReuseDurationSeconds':
darwinTouchIDAuthenticationAllowableReuseDuration?.inSeconds,
'darwinTouchIDAuthenticationForceReuseContextDurationSeconds':
darwinTouchIDAuthenticationForceReuseContextDuration?.inSeconds,
'authenticationRequired': authenticationRequired,
'androidBiometricOnly': androidBiometricOnly,
'darwinBiometricOnly': darwinBiometricOnly,
Expand Down
12 changes: 6 additions & 6 deletions macos/Classes/BiometricStorageImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ struct StorageMethodCall {

class InitOptions {
init(params: [String: Any]) {
iosTouchIDAuthenticationAllowableReuseDuration = params["iosTouchIDAuthenticationAllowableReuseDurationSeconds"] as? Int
iosTouchIDAuthenticationForceReuseContextDuration = params["iosTouchIDAuthenticationForceReuseContextDurationSeconds"] as? Int
darwinTouchIDAuthenticationAllowableReuseDuration = params["drawinTouchIDAuthenticationAllowableReuseDurationSeconds"] as? Int
darwinTouchIDAuthenticationForceReuseContextDuration = params["darwinTouchIDAuthenticationForceReuseContextDurationSeconds"] as? Int
authenticationRequired = params["authenticationRequired"] as? Bool
darwinBiometricOnly = params["darwinBiometricOnly"] as? Bool
}
let iosTouchIDAuthenticationAllowableReuseDuration: Int?
let iosTouchIDAuthenticationForceReuseContextDuration: Int?
let darwinTouchIDAuthenticationAllowableReuseDuration: Int?
let darwinTouchIDAuthenticationForceReuseContextDuration: Int?
let authenticationRequired: Bool!
let darwinBiometricOnly: Bool!
}
Expand Down Expand Up @@ -173,7 +173,7 @@ class BiometricStorageFile {

let context = LAContext()
if (initOptions.authenticationRequired) {
if let duration = initOptions.iosTouchIDAuthenticationAllowableReuseDuration {
if let duration = initOptions.darwinTouchIDAuthenticationAllowableReuseDuration {
if #available(OSX 10.12, *) {
context.touchIDAuthenticationAllowableReuseDuration = Double(duration)
} else {
Expand All @@ -182,7 +182,7 @@ class BiometricStorageFile {
}
}

if let duration = initOptions.iosTouchIDAuthenticationForceReuseContextDuration {
if let duration = initOptions.darwinTouchIDAuthenticationForceReuseContextDuration {
_context = (context: context, expireAt: Date(timeIntervalSinceNow: Double(duration)))
}
}
Expand Down

0 comments on commit 9120b67

Please sign in to comment.