@blueid/access-capacitor 0.101.0 → 0.102.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/CBlueIDAccess.xcframework/Info.plist +8 -8
- package/ios/CBlueIDAccess.xcframework/ios-arm64/libCBlueIDAccess.a +0 -0
- package/ios/CBlueIDAccess.xcframework/ios-arm64_x86_64-simulator/libCBlueIDAccess.a +0 -0
- package/ios/CBlueIDAccess.xcframework/macos-arm64_x86_64/libCBlueIDAccess.a +0 -0
- package/ios/Plugin/BlueIDAccessSDK/BlueAccessSync.swift +2 -2
- package/ios/Plugin/BlueIDAccessSDK/BlueAccessSyncScheduler.swift +4 -6
- package/ios/Plugin/BlueIDAccessSDK/Extensions.swift +35 -14
- package/package.json +1 -1
|
@@ -10,18 +10,15 @@
|
|
|
10
10
|
<key>HeadersPath</key>
|
|
11
11
|
<string>Headers</string>
|
|
12
12
|
<key>LibraryIdentifier</key>
|
|
13
|
-
<string>ios-
|
|
13
|
+
<string>ios-arm64</string>
|
|
14
14
|
<key>LibraryPath</key>
|
|
15
15
|
<string>libCBlueIDAccess.a</string>
|
|
16
16
|
<key>SupportedArchitectures</key>
|
|
17
17
|
<array>
|
|
18
18
|
<string>arm64</string>
|
|
19
|
-
<string>x86_64</string>
|
|
20
19
|
</array>
|
|
21
20
|
<key>SupportedPlatform</key>
|
|
22
21
|
<string>ios</string>
|
|
23
|
-
<key>SupportedPlatformVariant</key>
|
|
24
|
-
<string>simulator</string>
|
|
25
22
|
</dict>
|
|
26
23
|
<dict>
|
|
27
24
|
<key>BinaryPath</key>
|
|
@@ -29,7 +26,7 @@
|
|
|
29
26
|
<key>HeadersPath</key>
|
|
30
27
|
<string>Headers</string>
|
|
31
28
|
<key>LibraryIdentifier</key>
|
|
32
|
-
<string>
|
|
29
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
33
30
|
<key>LibraryPath</key>
|
|
34
31
|
<string>libCBlueIDAccess.a</string>
|
|
35
32
|
<key>SupportedArchitectures</key>
|
|
@@ -38,7 +35,9 @@
|
|
|
38
35
|
<string>x86_64</string>
|
|
39
36
|
</array>
|
|
40
37
|
<key>SupportedPlatform</key>
|
|
41
|
-
<string>
|
|
38
|
+
<string>ios</string>
|
|
39
|
+
<key>SupportedPlatformVariant</key>
|
|
40
|
+
<string>simulator</string>
|
|
42
41
|
</dict>
|
|
43
42
|
<dict>
|
|
44
43
|
<key>BinaryPath</key>
|
|
@@ -46,15 +45,16 @@
|
|
|
46
45
|
<key>HeadersPath</key>
|
|
47
46
|
<string>Headers</string>
|
|
48
47
|
<key>LibraryIdentifier</key>
|
|
49
|
-
<string>
|
|
48
|
+
<string>macos-arm64_x86_64</string>
|
|
50
49
|
<key>LibraryPath</key>
|
|
51
50
|
<string>libCBlueIDAccess.a</string>
|
|
52
51
|
<key>SupportedArchitectures</key>
|
|
53
52
|
<array>
|
|
54
53
|
<string>arm64</string>
|
|
54
|
+
<string>x86_64</string>
|
|
55
55
|
</array>
|
|
56
56
|
<key>SupportedPlatform</key>
|
|
57
|
-
<string>
|
|
57
|
+
<string>macos</string>
|
|
58
58
|
</dict>
|
|
59
59
|
</array>
|
|
60
60
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -39,7 +39,7 @@ internal class BlueAbstractSynchronizeAccessCommand<T>: BlueSdkAsyncCommand wher
|
|
|
39
39
|
|
|
40
40
|
guard let response = try? await self.sync(with: tokenAuthentication, forceRefresh: forceRefresh) else {
|
|
41
41
|
if (credential.hasValidTo) {
|
|
42
|
-
if let validTo = credential.validTo.
|
|
42
|
+
if let validTo = credential.validTo.toUTCDate() {
|
|
43
43
|
|
|
44
44
|
let isExpired = validTo < Date()
|
|
45
45
|
if (isExpired) {
|
|
@@ -128,7 +128,7 @@ internal class BlueSynchronizeMobileAccessCommand: BlueAbstractSynchronizeAccess
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
if let validity = synchronizationResult.validity {
|
|
131
|
-
updatedCredential.validity = BlueLocalTimestamp(Date(timeIntervalSince1970: TimeInterval(validity/1000)))
|
|
131
|
+
updatedCredential.validity = BlueLocalTimestamp.fromUTCDate(Date(timeIntervalSince1970: TimeInterval(validity/1000)))
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
try blueAccessCredentialsKeyChain.updateEntry(id: updatedCredential.credentialID.id, data: updatedCredential.jsonUTF8Data())
|
|
@@ -109,8 +109,6 @@ internal class BlueAccessSyncScheduler: BlueEventListener {
|
|
|
109
109
|
blueLogError(error.localizedDescription)
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
blueRemoveEventListener(listener: self)
|
|
113
|
-
|
|
114
112
|
foregroundScheduler.schedule(now)
|
|
115
113
|
}
|
|
116
114
|
|
|
@@ -143,10 +141,10 @@ internal class BlueAccessSyncScheduler: BlueEventListener {
|
|
|
143
141
|
if let credentials = try? blueCommands.getAccessCredentials.run().credentials {
|
|
144
142
|
if (!credentials.isEmpty) {
|
|
145
143
|
credentials.forEach { credential in
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
144
|
+
let now = now ?? Date()
|
|
145
|
+
|
|
146
|
+
if (!credential.checkValidityStart(now)) {
|
|
147
|
+
if let validFrom = credential.validFrom.toUTCDate() {
|
|
150
148
|
if validFrom > now {
|
|
151
149
|
let differenceInSeconds = validFrom.timeIntervalSince(now)
|
|
152
150
|
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
3
|
extension BlueLocalTimestamp: Encodable, Decodable {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
/// Converts a given UTC Date into a BlueLocalTimestamp.
|
|
6
|
+
///
|
|
7
|
+
/// - returns: The BlueLocalTimestamp
|
|
8
|
+
static public func fromUTCDate(_ date: Date) -> BlueLocalTimestamp {
|
|
9
|
+
var calendar = Calendar(identifier: .gregorian)
|
|
10
|
+
calendar.timeZone = TimeZone(identifier: "UTC")!
|
|
6
11
|
|
|
7
|
-
let calendar = Calendar.current
|
|
8
12
|
let components = calendar.dateComponents([.year, .month, .day, .hour, .minute, .second], from: date)
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
var instance = BlueLocalTimestamp()
|
|
15
|
+
|
|
16
|
+
instance.year = UInt32(components.year!)
|
|
17
|
+
instance.month = UInt32(components.month!)
|
|
18
|
+
instance.date = UInt32(components.day!)
|
|
19
|
+
instance.hours = UInt32(components.hour!)
|
|
20
|
+
instance.minutes = UInt32(components.minute!)
|
|
21
|
+
instance.seconds = UInt32(components.second!)
|
|
22
|
+
|
|
23
|
+
return instance
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
public init(_ year: Int, _ month: Int, _ date: Int = 1, _ hours: Int = 0, _ minutes: Int = 0, _ seconds: Int = 0) {
|
|
@@ -37,7 +45,15 @@ extension BlueLocalTimestamp: Encodable, Decodable {
|
|
|
37
45
|
seconds = try container.decode(UInt32.self, forKey: .seconds)
|
|
38
46
|
}
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
/// Converts the underlying BlueLocalTimestamp into a date in the UTC timezone. If either the timezone cannot be found or the date is invalid, nil is returned.
|
|
49
|
+
///
|
|
50
|
+
/// - returns: The UTC Date if valid.
|
|
51
|
+
public func toUTCDate() -> Date? {
|
|
52
|
+
guard let tz = TimeZone(abbreviation: "UTC") else {
|
|
53
|
+
blueLogWarn("UTC TZ not found")
|
|
54
|
+
return nil
|
|
55
|
+
}
|
|
56
|
+
|
|
41
57
|
var dateComponents = DateComponents()
|
|
42
58
|
dateComponents.year = Int(year)
|
|
43
59
|
dateComponents.month = Int(month)
|
|
@@ -46,7 +62,10 @@ extension BlueLocalTimestamp: Encodable, Decodable {
|
|
|
46
62
|
dateComponents.minute = Int(minutes)
|
|
47
63
|
dateComponents.second = Int(seconds)
|
|
48
64
|
|
|
49
|
-
|
|
65
|
+
var calendar = Calendar(identifier: .gregorian)
|
|
66
|
+
calendar.timeZone = tz
|
|
67
|
+
|
|
68
|
+
let date = calendar.date(from: dateComponents)
|
|
50
69
|
if (date?.timeIntervalSince1970 ?? 0 <= 0) {
|
|
51
70
|
return nil
|
|
52
71
|
}
|
|
@@ -140,10 +159,12 @@ extension BlueAccessCredential: Decodable {
|
|
|
140
159
|
}
|
|
141
160
|
}
|
|
142
161
|
|
|
143
|
-
public func checkValidityStart() -> Bool {
|
|
162
|
+
public func checkValidityStart(_ now: Date? = nil) -> Bool {
|
|
144
163
|
if self.hasValidFrom {
|
|
145
|
-
if let validFrom = self.validFrom.
|
|
146
|
-
|
|
164
|
+
if let validFrom = self.validFrom.toUTCDate() {
|
|
165
|
+
let now = now ?? Date()
|
|
166
|
+
|
|
167
|
+
if validFrom > now {
|
|
147
168
|
return false
|
|
148
169
|
}
|
|
149
170
|
}
|