diff --git a/OneTimePassword.podspec b/OneTimePassword.podspec index e56e7bcc..a5726dec 100644 --- a/OneTimePassword.podspec +++ b/OneTimePassword.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "OneTimePassword" - s.version = "3.1.5" + s.version = "3.1.6" s.summary = "A small library for generating TOTP and HOTP one-time passwords." s.homepage = "https://github.com/mattrubin/OneTimePassword" s.license = "MIT" diff --git a/Sources/Crypto.swift b/Sources/Crypto.swift index 3a154099..6593a087 100644 --- a/Sources/Crypto.swift +++ b/Sources/Crypto.swift @@ -34,7 +34,7 @@ import Foundation import CommonCryptoShim #endif -func HMAC(algorithm: Generator.Algorithm, key: Data, data: Data) -> Data { +public func HMAC(algorithm: Generator.Algorithm, key: Data, data: Data) -> Data { let (hashFunction, hashLength) = algorithm.hashInfo let macOut = UnsafeMutablePointer.allocate(capacity: hashLength) diff --git a/Sources/Keychain.swift b/Sources/Keychain.swift index b2c9d1a8..b29b16b9 100644 --- a/Sources/Keychain.swift +++ b/Sources/Keychain.swift @@ -123,6 +123,9 @@ private extension Token { kSecAttrGeneric as String: data as NSData, kSecValueData as String: generator.secret as NSData, kSecAttrService as String: kOTPService as NSString, + + // Allow keychain access in the background after first unlock. + kSecAttrAccessible as String: kSecAttrAccessibleAfterFirstUnlock as NSString ] } }