From 95116cbd2b5208fa0dd37caf9f1d45a3f31290b0 Mon Sep 17 00:00:00 2001 From: James Wolfe <56296015+wolfej94@users.noreply.github.com> Date: Tue, 30 Nov 2021 14:22:37 +0000 Subject: [PATCH] Add local authentication without refresh --- PassportKit.podspec | 2 +- Sources/PassportKit.swift | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/PassportKit.podspec b/PassportKit.podspec index dddfcf5..4bba309 100644 --- a/PassportKit.podspec +++ b/PassportKit.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = "PassportKit" - spec.version = "1.6.2" + spec.version = "1.6.3" spec.license = "MIT" spec.summary = "Swift library used for quick and easy oauth authentication." spec.homepage = "https://github.com/appoly/PassportKit" diff --git a/Sources/PassportKit.swift b/Sources/PassportKit.swift index b3ff03b..085add6 100644 --- a/Sources/PassportKit.swift +++ b/Sources/PassportKit.swift @@ -107,6 +107,13 @@ public class PassportKit: NSObject { } + public func localAuthententication(biometricsEnabled: Bool, completion: @escaping (Bool) -> Void) { + ownershipAuthentication(policy: biometricsEnabled ? .deviceOwnerAuthenticationWithBiometrics : .deviceOwnerAuthentication) { [weak self] result in + completion(result == .authorised) + } + } + + private func ownershipAuthentication(policy: LAPolicy, reason: String? = nil, completion: @escaping (RefreshResult) -> Void) { let context = LAContext() var error: NSError?