@blueid/access-capacitor 0.83.0 → 0.84.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 +5 -5
- 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 +45 -4
- package/ios/Plugin/BlueIDAccessSDK/BlueDemoData.swift +2 -2
- package/ios/Plugin/BlueIDAccessSDK/BlueTerminal.swift +10 -5
- package/package.json +1 -1
|
@@ -27,15 +27,18 @@
|
|
|
27
27
|
<key>HeadersPath</key>
|
|
28
28
|
<string>Headers</string>
|
|
29
29
|
<key>LibraryIdentifier</key>
|
|
30
|
-
<string>ios-
|
|
30
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
31
31
|
<key>LibraryPath</key>
|
|
32
32
|
<string>libCBlueIDAccess.a</string>
|
|
33
33
|
<key>SupportedArchitectures</key>
|
|
34
34
|
<array>
|
|
35
35
|
<string>arm64</string>
|
|
36
|
+
<string>x86_64</string>
|
|
36
37
|
</array>
|
|
37
38
|
<key>SupportedPlatform</key>
|
|
38
39
|
<string>ios</string>
|
|
40
|
+
<key>SupportedPlatformVariant</key>
|
|
41
|
+
<string>simulator</string>
|
|
39
42
|
</dict>
|
|
40
43
|
<dict>
|
|
41
44
|
<key>BinaryPath</key>
|
|
@@ -43,18 +46,15 @@
|
|
|
43
46
|
<key>HeadersPath</key>
|
|
44
47
|
<string>Headers</string>
|
|
45
48
|
<key>LibraryIdentifier</key>
|
|
46
|
-
<string>ios-
|
|
49
|
+
<string>ios-arm64</string>
|
|
47
50
|
<key>LibraryPath</key>
|
|
48
51
|
<string>libCBlueIDAccess.a</string>
|
|
49
52
|
<key>SupportedArchitectures</key>
|
|
50
53
|
<array>
|
|
51
54
|
<string>arm64</string>
|
|
52
|
-
<string>x86_64</string>
|
|
53
55
|
</array>
|
|
54
56
|
<key>SupportedPlatform</key>
|
|
55
57
|
<string>ios</string>
|
|
56
|
-
<key>SupportedPlatformVariant</key>
|
|
57
|
-
<string>simulator</string>
|
|
58
58
|
</dict>
|
|
59
59
|
</array>
|
|
60
60
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -199,16 +199,16 @@ public class BlueSynchronizeAccessCredentialsCommand: BlueAPIAsyncCommand {
|
|
|
199
199
|
throw BlueError(.sdkUnsupportedPlatform)
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
let credentials = try await BlueGetAccessCredentialsCommand().runAsync().credentials
|
|
203
203
|
|
|
204
204
|
if (credentials.isEmpty) {
|
|
205
205
|
return BlueSynchronizeAccessCredentials()
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
let result = await withTaskGroup(of: BlueSynchronizeAccessCredential.self, returning: BlueSynchronizeAccessCredentials.self) { group in
|
|
209
209
|
|
|
210
210
|
for credential in credentials {
|
|
211
|
-
group.addTask { await self.
|
|
211
|
+
group.addTask { await self.synchronizeCredential(credential) }
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
var credentials: [BlueSynchronizeAccessCredential] = []
|
|
@@ -219,9 +219,14 @@ public class BlueSynchronizeAccessCredentialsCommand: BlueAPIAsyncCommand {
|
|
|
219
219
|
|
|
220
220
|
return BlueSynchronizeAccessCredentials(credentials: credentials)
|
|
221
221
|
}
|
|
222
|
+
|
|
223
|
+
await purgeTokens()
|
|
224
|
+
|
|
225
|
+
return result
|
|
222
226
|
}
|
|
223
227
|
|
|
224
|
-
|
|
228
|
+
/// Synchronize a given credential.
|
|
229
|
+
private func synchronizeCredential(_ credential: BlueAccessCredential) async -> BlueSynchronizeAccessCredential {
|
|
225
230
|
var resultItem = BlueSynchronizeAccessCredential()
|
|
226
231
|
resultItem.credentialID.id = credential.credentialID.id
|
|
227
232
|
|
|
@@ -242,4 +247,40 @@ public class BlueSynchronizeAccessCredentialsCommand: BlueAPIAsyncCommand {
|
|
|
242
247
|
|
|
243
248
|
return resultItem
|
|
244
249
|
}
|
|
250
|
+
|
|
251
|
+
/// Purges orphaned tokens.
|
|
252
|
+
private func purgeTokens() async {
|
|
253
|
+
do {
|
|
254
|
+
let credentialIds = try await BlueGetAccessCredentialsCommand().runAsync().credentials.compactMap { $0.credentialID.id }
|
|
255
|
+
|
|
256
|
+
try blueGetSpTokenEntryIds().forEach{ entryID in
|
|
257
|
+
do {
|
|
258
|
+
let storedEntry = try blueGetSpTokenEntry(entryID)
|
|
259
|
+
|
|
260
|
+
if var spTokenEntries = storedEntry as? [BlueSPTokenEntry] {
|
|
261
|
+
|
|
262
|
+
let initialSize = spTokenEntries.count
|
|
263
|
+
|
|
264
|
+
spTokenEntries.removeAll{ !credentialIds.contains($0.credentialID) }
|
|
265
|
+
|
|
266
|
+
if (initialSize != spTokenEntries.count) {
|
|
267
|
+
if (spTokenEntries.isEmpty) {
|
|
268
|
+
_ = try blueTerminalRequestDataKeychain.deleteEntry(id: entryID)
|
|
269
|
+
} else {
|
|
270
|
+
try blueTerminalRequestDataKeychain.storeEntry(
|
|
271
|
+
id: entryID,
|
|
272
|
+
data: JSONEncoder().encode(spTokenEntries)
|
|
273
|
+
)
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
} catch {
|
|
279
|
+
blueLogError(error.localizedDescription)
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
} catch {
|
|
283
|
+
blueLogError(error.localizedDescription)
|
|
284
|
+
}
|
|
285
|
+
}
|
|
245
286
|
}
|
|
@@ -40,13 +40,13 @@ internal func blueCreateSignedCommandDemoToken(_ command: String) throws -> Blue
|
|
|
40
40
|
return try blueCreateSignedDemoToken(token)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
internal func blueCreateSignedOssSoDemoToken() throws -> BlueSPToken {
|
|
43
|
+
internal func blueCreateSignedOssSoDemoToken(_ credentialID: String? = nil) throws -> BlueSPToken {
|
|
44
44
|
var token = BlueSPToken()
|
|
45
45
|
token.signature = Data()
|
|
46
46
|
|
|
47
47
|
let demoConfiguration = blueCreateOssSoDemoConfiguration()
|
|
48
48
|
|
|
49
|
-
let provisioningData = try blueCommands.ossSoCreateStandardProvisioningData.run("SO12345678", 1)
|
|
49
|
+
let provisioningData = try blueCommands.ossSoCreateStandardProvisioningData.run(credentialID ?? "SO12345678", 1)
|
|
50
50
|
|
|
51
51
|
token.ossSo = try blueCommands.ossSoCreateMobile.run(provisioningData, demoConfiguration)
|
|
52
52
|
|
|
@@ -101,16 +101,19 @@ internal func blueDeleteSpTokens(credential: BlueAccessCredential) throws {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
/// Returns all entry IDs for a given device.
|
|
104
|
+
/// Returns all entry IDs for a given device, if any.
|
|
105
105
|
///
|
|
106
106
|
/// - parameter deviceID: The Device ID.
|
|
107
107
|
/// - throws: An error is thrown if any error occurs during the retrieval of the entry IDs from the KeyChain.
|
|
108
|
-
internal func blueGetSpTokenEntryIds(deviceID: String) throws -> [String] {
|
|
108
|
+
internal func blueGetSpTokenEntryIds(deviceID: String? = nil) throws -> [String] {
|
|
109
109
|
return try blueTerminalRequestDataKeychain.getEntryIds().compactMap{ entryId in
|
|
110
|
-
if
|
|
111
|
-
|
|
110
|
+
if let deviceID = deviceID {
|
|
111
|
+
if !entryId.hasPrefix(deviceID) {
|
|
112
|
+
return nil
|
|
113
|
+
}
|
|
112
114
|
}
|
|
113
|
-
|
|
115
|
+
|
|
116
|
+
return entryId
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
|
|
@@ -399,6 +402,8 @@ public func blueTerminalRun<HandlerResult>(
|
|
|
399
402
|
completion(.success(handlerResult))
|
|
400
403
|
}
|
|
401
404
|
} catch let error {
|
|
405
|
+
blueActiveDevice = nil
|
|
406
|
+
|
|
402
407
|
if !wasConnected && device.isConnected {
|
|
403
408
|
do {
|
|
404
409
|
try device.disconnect()
|