-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from fingerprintjs/ios12-support
iOS 12 support
- Loading branch information
Showing
9 changed files
with
98 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
Pod::Spec.new do |spec| | ||
# Name and version | ||
spec.name = 'FingerprintJS' | ||
spec.version = '1.1.1' | ||
spec.version = '1.1.2' | ||
|
||
# License | ||
spec.license = { type: 'MIT', file: 'LICENSE' } | ||
|
||
# Contact information | ||
spec.homepage = 'https://fingerprint.com/' | ||
spec.authors = { | ||
'Fingerprint': 'fingerprintkit@fingerprint.com', | ||
'Fingerprint': 'ios@fingerprint.com', | ||
'Petr Palata': '[email protected]' | ||
} | ||
|
||
|
@@ -28,8 +28,8 @@ Pod::Spec.new do |spec| | |
|
||
# Build (source files, deployment target) | ||
spec.source_files = 'Sources/FingerprintJS/**/*.{swift,h,m}' | ||
spec.ios.deployment_target = '13.0' | ||
spec.tvos.deployment_target = '13.0' | ||
spec.ios.deployment_target = '12.0' | ||
spec.tvos.deployment_target = '12.0' | ||
spec.swift_versions = ['5.3', '5.4', '5.5', '5.6'] | ||
|
||
# Tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
Sources/FingerprintJSTests/Tests/SHA256HashingFunctionTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// SHA256HashingFunctionTests.swift | ||
// | ||
// | ||
// Created by Petr Palata on 12.09.2022. | ||
// | ||
|
||
import XCTest | ||
|
||
@testable import FingerprintJS | ||
|
||
class SHA256HashingFunctionTests: XCTestCase { | ||
private var sut: SHA256HashingFunction! | ||
|
||
override func setUpWithError() throws { | ||
sut = SHA256HashingFunction() | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
sut = nil | ||
} | ||
|
||
@available(iOS 13.0, tvOS 13.0, *) | ||
func testComputesSameHashForBothHashingVersions() { | ||
if #available(iOS 13.0, tvOS 13.0, *) { | ||
let data = Data(base64Encoded: "dGhpcyBpcyBmaW5nZXJwcmludA==")! | ||
|
||
let sha256cryptoKit = sut.computeSHA256CryptoKit(data) | ||
let sha256commonCrypto = sut.computeSHA256CommonCrypto(data) | ||
|
||
XCTAssertEqual(sha256cryptoKit, sha256commonCrypto) | ||
} | ||
} | ||
|
||
func testFingerprintComputesCorrectHashFunction() { | ||
let data = Data(base64Encoded: "dGhpcyBpcyBmaW5nZXJwcmludA==")! | ||
|
||
let fingerprint = sut.fingerprint(data: data) | ||
|
||
XCTAssertEqual(fingerprint, "d7ffc906ba87c045110c78f34aad06f5259788d7f535b84cf0dd4cdcbf08a436") | ||
} | ||
} |