Minor verification improvements

This commit is contained in:
Pavel Tikhonenko
2019-07-03 03:28:19 +03:00
parent 8a73ecef4f
commit f38ed3f4fa
3 changed files with 9 additions and 10 deletions
+2 -2
View File
@@ -768,7 +768,7 @@
DEVELOPMENT_TEAM = Y357EKMWLB;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "iOS Example/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
@@ -792,7 +792,7 @@
DEVELOPMENT_TEAM = Y357EKMWLB;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "iOS Example/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.tikhop.InAppReceipt.iOS-Example";
+6 -7
View File
@@ -54,13 +54,13 @@ public extension InAppReceipt
}
#if os(iOS) || os(watchOS) || os(tvOS)
guard let v = Bundle.main.infoDictionary?["CFBundleVersion"] as? String,
guard let v = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String,
v == originalAppVersion else
{
throw IARError.validationFailed(reason: .bundleVersionVefirication)
}
#elseif os(macOS)
guard let v = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String,
guard let v = Bundle.main.infoDictionary?["CFBundleVersion"] as? String,
v == originalAppVersion else
{
throw IARError.validationFailed(reason: .bundleVersionVefirication)
@@ -104,13 +104,12 @@ public extension InAppReceipt
let opaqueData = opaqueValue
let bundleIdData = bundleIdentifierData
var hash: Array<UInt8> = Array<UInt8>.init(repeating: 0, count: 20)
var sha1 = SHA1()
hash = try! sha1.update(withBytes: uuidData.bytes)
hash = try! sha1.update(withBytes: opaqueData.bytes)
hash = sha1.calculate(for: bundleIdData.bytes)
try! sha1.update(withBytes: uuidData.bytes)
try! sha1.update(withBytes: opaqueData.bytes)
let hash = sha1.calculate(for: bundleIdData.bytes)
return Data(bytes: hash, count: hash.count)
return Data(hash)
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
import UIKit
import TPInAppReceipt
var rBase64 = "You Receupt"
var rBase64 = "Your Receipt"
class ViewController: UIViewController {