@velocitycareerlabs/vcl-react-native 2.6.0 → 2.6.2

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.
@@ -12,679 +12,679 @@ import Foundation
12
12
  import VCL
13
13
 
14
14
  func dictionaryToInitializationDescriptor(
15
- _ initializationDescriptorDictionary: [String: Any]
15
+ _ initializationDescriptorDictionary: [String: Sendable]
16
16
  ) -> VCLInitializationDescriptor {
17
- return VCLInitializationDescriptor(
18
- environment: dictionaryToEnvironment(
19
- initializationDescriptorDictionary["environment"] as? String
20
- ),
21
- xVnfProtocolVersion: dictionaryToXVnfProtocolVersion (
22
- initializationDescriptorDictionary["xVnfProtocolVersion"] as? String
23
- ),
24
- cacheSequence: initializationDescriptorDictionary["cacheSequence"] as? Int ?? 0,
25
- isDebugOn: initializationDescriptorDictionary["isDebugOn"] as? Bool ?? false,
26
- cryptoServicesDescriptor: dictionaryToCryptoServicesDescriptor(
27
- initializationDescriptorDictionary["cryptoServicesDescriptor"] as? [String : Any]
28
- ),
29
- isDirectIssuerCheckOn: initializationDescriptorDictionary["isDirectIssuerCheckOn"] as? Bool ?? true
30
- )
17
+ return VCLInitializationDescriptor(
18
+ environment: dictionaryToEnvironment(
19
+ initializationDescriptorDictionary["environment"] as? String
20
+ ),
21
+ xVnfProtocolVersion: dictionaryToXVnfProtocolVersion (
22
+ initializationDescriptorDictionary["xVnfProtocolVersion"] as? String
23
+ ),
24
+ cacheSequence: initializationDescriptorDictionary["cacheSequence"] as? Int ?? 0,
25
+ isDebugOn: initializationDescriptorDictionary["isDebugOn"] as? Bool ?? false,
26
+ cryptoServicesDescriptor: dictionaryToCryptoServicesDescriptor(
27
+ initializationDescriptorDictionary["cryptoServicesDescriptor"] as? [String : Sendable]
28
+ ),
29
+ isDirectIssuerCheckOn: initializationDescriptorDictionary["isDirectIssuerCheckOn"] as? Bool ?? true
30
+ )
31
31
  }
32
32
 
33
33
  private func dictionaryToEnvironment(
34
34
  _ environment: String?
35
35
  ) -> VCLEnvironment {
36
- return VCLEnvironment.fromString(value: environment ?? "")
36
+ return VCLEnvironment.fromString(value: environment ?? "")
37
37
  }
38
38
 
39
39
  private func dictionaryToCryptoServicesDescriptor(
40
- _ cryptoServicesDescriptorDictionary: [String: Any]?
40
+ _ cryptoServicesDescriptorDictionary: [String: Sendable]?
41
41
  ) -> VCLCryptoServicesDescriptor {
42
- let cryptoServiceType =
43
- VCLCryptoServiceType.fromString(
44
- value: cryptoServicesDescriptorDictionary?["cryptoServiceType"] as? String ?? ""
45
- )
46
- let remoteCryptoServicesUrlsDescriptorDictionary = cryptoServicesDescriptorDictionary?["remoteCryptoServicesUrlsDescriptor"] as? [String: Any]
47
- let keyServiceUrls = remoteCryptoServicesUrlsDescriptorDictionary?["keyServiceUrls"] as? [String: Any]
48
- let jwtServiceUrls = remoteCryptoServicesUrlsDescriptorDictionary?["jwtServiceUrls"] as? [String: Any]
49
- let remoteCryptoServicesUrlsDescriptor = VCLRemoteCryptoServicesUrlsDescriptor(
50
- keyServiceUrls: VCLKeyServiceUrls(
51
- createDidKeyServiceUrl: keyServiceUrls?["createDidKeyServiceUrl"] as? String ?? ""
52
- ),
53
- jwtServiceUrls: VCLJwtServiceUrls(
54
- jwtSignServiceUrl: jwtServiceUrls?["jwtSignServiceUrl"] as? String ?? "",
55
- jwtVerifyServiceUrl: jwtServiceUrls?["jwtVerifyServiceUrl"] as? String
56
- )
57
- )
58
- return VCLCryptoServicesDescriptor(
59
- cryptoServiceType: cryptoServiceType,
60
- remoteCryptoServicesUrlsDescriptor: remoteCryptoServicesUrlsDescriptor
42
+ let cryptoServiceType =
43
+ VCLCryptoServiceType.fromString(
44
+ value: cryptoServicesDescriptorDictionary?["cryptoServiceType"] as? String ?? ""
45
+ )
46
+ let remoteCryptoServicesUrlsDescriptorDictionary = cryptoServicesDescriptorDictionary?["remoteCryptoServicesUrlsDescriptor"] as? [String: Sendable]
47
+ let keyServiceUrls = remoteCryptoServicesUrlsDescriptorDictionary?["keyServiceUrls"] as? [String: Sendable]
48
+ let jwtServiceUrls = remoteCryptoServicesUrlsDescriptorDictionary?["jwtServiceUrls"] as? [String: Sendable]
49
+ let remoteCryptoServicesUrlsDescriptor = VCLRemoteCryptoServicesUrlsDescriptor(
50
+ keyServiceUrls: VCLKeyServiceUrls(
51
+ createDidKeyServiceUrl: keyServiceUrls?["createDidKeyServiceUrl"] as? String ?? ""
52
+ ),
53
+ jwtServiceUrls: VCLJwtServiceUrls(
54
+ jwtSignServiceUrl: jwtServiceUrls?["jwtSignServiceUrl"] as? String ?? "",
55
+ jwtVerifyServiceUrl: jwtServiceUrls?["jwtVerifyServiceUrl"] as? String
61
56
  )
57
+ )
58
+ return VCLCryptoServicesDescriptor(
59
+ cryptoServiceType: cryptoServiceType,
60
+ remoteCryptoServicesUrlsDescriptor: remoteCryptoServicesUrlsDescriptor
61
+ )
62
62
  }
63
63
 
64
64
  private func dictionaryToXVnfProtocolVersion(
65
65
  _ xVnfProtocolVersion: String?
66
66
  ) -> VCLXVnfProtocolVersion {
67
- return VCLXVnfProtocolVersion.fromString(value: xVnfProtocolVersion ?? "")
67
+ return VCLXVnfProtocolVersion.fromString(value: xVnfProtocolVersion ?? "")
68
68
  }
69
69
 
70
70
  func regionToDictionary(
71
71
  _ region: VCLRegion
72
- ) -> [String: Any] {
73
- var regionDict = [String: Any]()
74
- regionDict["payload"] = region.payload
75
- regionDict["code"] = region.code
76
- regionDict["name"] = region.name
77
- return regionDict
72
+ ) -> [String: Sendable] {
73
+ var regionDict = [String: Sendable]()
74
+ regionDict["payload"] = region.payload
75
+ regionDict["code"] = region.code
76
+ regionDict["name"] = region.name
77
+ return regionDict
78
78
  }
79
79
 
80
80
  func regionsToDictionary(
81
81
  _ regions: VCLRegions
82
- ) -> [String: Any] {
83
- var regionsMap = [String: Any]()
84
- var regionsArr = [[String: Any]]()
85
- for i in 0..<regions.all.count {
86
- regionsArr.append(regionToDictionary(regions.all[i]))
87
- }
88
- regionsMap["all"] = regionsArr
89
- return regionsMap
82
+ ) -> [String: Sendable] {
83
+ var regionsMap = [String: Sendable]()
84
+ var regionsArr = [[String: Sendable]]()
85
+ for i in 0..<regions.all.count {
86
+ regionsArr.append(regionToDictionary(regions.all[i]))
87
+ }
88
+ regionsMap["all"] = regionsArr
89
+ return regionsMap
90
90
  }
91
91
 
92
92
  func countryToDictionary(
93
93
  _ country: VCLCountry
94
- ) -> [String: Any] {
95
- var countryDict = [String: Any]()
96
- countryDict["payload"] = country.payload
97
- countryDict["code"] = country.code
98
- countryDict["name"] = country.name
99
- if let regions = country.regions {
100
- countryDict["regions"] = regionsToDictionary(regions)
101
- }
102
- return countryDict
94
+ ) -> [String: Sendable] {
95
+ var countryDict = [String: Sendable]()
96
+ countryDict["payload"] = country.payload
97
+ countryDict["code"] = country.code
98
+ countryDict["name"] = country.name
99
+ if let regions = country.regions {
100
+ countryDict["regions"] = regionsToDictionary(regions)
101
+ }
102
+ return countryDict
103
103
  }
104
104
 
105
105
  func countriesToDictionary(
106
106
  _ countries: VCLCountries
107
- ) -> [String: [[String: Any]?]] {
108
- var countriesArr = [[String: Any]?] ()
109
- if let all = countries.all {
110
- for i in 0..<all.count {
111
- countriesArr.append(countryToDictionary(all[i]))
112
- }
107
+ ) -> [String: [[String: Sendable]?]] {
108
+ var countriesArr = [[String: Sendable]?] ()
109
+ if let all = countries.all {
110
+ for i in 0..<all.count {
111
+ countriesArr.append(countryToDictionary(all[i]))
113
112
  }
114
- return ["all": countriesArr]
113
+ }
114
+ return ["all": countriesArr]
115
115
  }
116
116
 
117
117
  func credentialTypeSchemasToDictionary(
118
118
  _ credentialTypeSchemas: VCLCredentialTypeSchemas
119
- ) -> [String: [String: Any]] {
120
- var credentialTypeSchemasMap = [String: [String: Any]]()
121
- if let all = credentialTypeSchemas.all {
122
- for (key, credentialTypeSchema) in all {
123
- var credentialTypeSchemaDictionary = [String: Any]()
124
- credentialTypeSchemaDictionary["payload"] = credentialTypeSchema.payload
125
- credentialTypeSchemasMap[key] = credentialTypeSchemaDictionary
126
- }
119
+ ) -> [String: [String: Sendable]] {
120
+ var credentialTypeSchemasMap = [String: [String: Sendable]]()
121
+ if let all = credentialTypeSchemas.all {
122
+ for (key, credentialTypeSchema) in all {
123
+ var credentialTypeSchemaDictionary = [String: Sendable]()
124
+ credentialTypeSchemaDictionary["payload"] = credentialTypeSchema.payload
125
+ credentialTypeSchemasMap[key] = credentialTypeSchemaDictionary
127
126
  }
128
- return ["all": credentialTypeSchemasMap]
127
+ }
128
+ return ["all": credentialTypeSchemasMap]
129
129
  }
130
130
 
131
131
  func credentialTypesToDictionary(
132
132
  _ credentialTypes: VCLCredentialTypes
133
- ) -> [String: [[String: Any?]]] {
134
- var credentialTypesArray = [[String: Any?]]()
135
- var recommendedCredentialTypesArray = [[String: Any?]]()
136
- if let all = credentialTypes.all {
137
- credentialTypesArray = parseCredentialTypesArray(all)
138
- }
139
- if let recommendedTypes = credentialTypes.recommendedTypes {
140
- recommendedCredentialTypesArray = parseCredentialTypesArray(recommendedTypes)
141
- }
142
- return ["all": credentialTypesArray, "recommendedTypes": recommendedCredentialTypesArray]
143
- }
144
-
145
- private func parseCredentialTypesArray(_ credentialTypesArr: [VCLCredentialType]) -> [[String: Any?]] {
146
- var credentialTypesArray = [[String: Any?]]()
147
- credentialTypesArr.forEach {
148
- var credentialType = [String: Any?]()
149
- credentialType["payload"] = $0.payload
150
- credentialType["id"] = $0.id
151
- credentialType["schema"] = $0.schema
152
- credentialType["createdAt"] = $0.createdAt
153
- credentialType["schemaName"] = $0.schemaName
154
- credentialType["credentialType"] = $0.credentialType
155
- credentialType["recommended"] = $0.recommended
156
- credentialType["jsonldContext"] = $0.jsonldContext
157
- credentialType["issuerCategory"] = $0.issuerCategory
158
- credentialTypesArray.append(credentialType)
159
- }
160
- return credentialTypesArray
133
+ ) -> [String: [[String: Sendable?]]] {
134
+ var credentialTypesArray = [[String: Sendable?]]()
135
+ var recommendedCredentialTypesArray = [[String: Sendable?]]()
136
+ if let all = credentialTypes.all {
137
+ credentialTypesArray = parseCredentialTypesArray(all)
138
+ }
139
+ if let recommendedTypes = credentialTypes.recommendedTypes {
140
+ recommendedCredentialTypesArray = parseCredentialTypesArray(recommendedTypes)
141
+ }
142
+ return ["all": credentialTypesArray, "recommendedTypes": recommendedCredentialTypesArray]
143
+ }
144
+
145
+ private func parseCredentialTypesArray(_ credentialTypesArr: [VCLCredentialType]) -> [[String: Sendable?]] {
146
+ var credentialTypesArray = [[String: Sendable?]]()
147
+ credentialTypesArr.forEach {
148
+ var credentialType = [String: Sendable?]()
149
+ credentialType["payload"] = $0.payload
150
+ credentialType["id"] = $0.id
151
+ credentialType["schema"] = $0.schema
152
+ credentialType["createdAt"] = $0.createdAt
153
+ credentialType["schemaName"] = $0.schemaName
154
+ credentialType["credentialType"] = $0.credentialType
155
+ credentialType["recommended"] = $0.recommended
156
+ credentialType["jsonldContext"] = $0.jsonldContext
157
+ credentialType["issuerCategory"] = $0.issuerCategory
158
+ credentialTypesArray.append(credentialType)
159
+ }
160
+ return credentialTypesArray
161
161
  }
162
162
 
163
163
  func dictionaryTopPresentationRequestDescriptor(
164
- _ presentationRequestDescriptorLinkDictionary: [String: Any]
164
+ _ presentationRequestDescriptorLinkDictionary: [String: Sendable]
165
165
  ) -> VCLPresentationRequestDescriptor {
166
- return VCLPresentationRequestDescriptor(
167
- deepLink: dictionaryToDeepLink(presentationRequestDescriptorLinkDictionary["deepLink"] as? [String: Any]) ?? VCLDeepLink(value: ""),
168
- pushDelegate: dictionaryToPushDelegate(presentationRequestDescriptorLinkDictionary["pushDelegate"] as? [String: Any]),
169
- didJwk: dictionaryToDidJwk(presentationRequestDescriptorLinkDictionary["didJwk"] as? [String: Any]),
170
- remoteCryptoServicesToken: dictionaryToToken(
171
- presentationRequestDescriptorLinkDictionary["remoteCryptoServicesToken"] as? [String: Any]
172
- )
166
+ return VCLPresentationRequestDescriptor(
167
+ deepLink: dictionaryToDeepLink(presentationRequestDescriptorLinkDictionary["deepLink"] as? [String: Sendable]) ?? VCLDeepLink(value: ""),
168
+ pushDelegate: dictionaryToPushDelegate(presentationRequestDescriptorLinkDictionary["pushDelegate"] as? [String: Sendable]),
169
+ didJwk: dictionaryToDidJwk(presentationRequestDescriptorLinkDictionary["didJwk"] as? [String: Sendable]),
170
+ remoteCryptoServicesToken: dictionaryToToken(
171
+ presentationRequestDescriptorLinkDictionary["remoteCryptoServicesToken"] as? [String: Sendable]
173
172
  )
173
+ )
174
174
  }
175
175
 
176
- func dictionaryToDeepLink(_ deepLinkDictionary: [String: Any]?) -> VCLDeepLink? {
177
- if let value = deepLinkDictionary?["value"] as? String {
178
- return VCLDeepLink(value: value)
179
- }
180
- return nil
176
+ func dictionaryToDeepLink(_ deepLinkDictionary: [String: Sendable]?) -> VCLDeepLink? {
177
+ if let value = deepLinkDictionary?["value"] as? String {
178
+ return VCLDeepLink(value: value)
179
+ }
180
+ return nil
181
181
  }
182
182
 
183
- func deepLinkToDictionary(_ deepLink: VCLDeepLink?) -> [String: Any]? {
184
- if let value = deepLink?.value {
185
- return ["value": value]
186
- }
187
- return nil
183
+ func deepLinkToDictionary(_ deepLink: VCLDeepLink?) -> [String: Sendable]? {
184
+ if let value = deepLink?.value {
185
+ return ["value": value]
186
+ }
187
+ return nil
188
188
  }
189
189
 
190
- func dictionaryToToken(_ tokenDictionary: [String: Any]?) -> VCLToken {
191
- return VCLToken(value: tokenDictionary?["value"] as? String ?? "")
190
+ func dictionaryToToken(_ tokenDictionary: [String: Sendable]?) -> VCLToken {
191
+ return VCLToken(value: tokenDictionary?["value"] as? String ?? "")
192
192
  }
193
193
 
194
- func tokenToDictionary(_ token: VCLToken?) -> [String: Any] {
195
- var retVal = [String: Any]()
196
- retVal["value"] = token?.value
197
- if let expiresIn = token?.expiresIn {
198
- retVal["expiresIn"] = expiresIn
199
- }
200
- return retVal
194
+ func tokenToDictionary(_ token: VCLToken?) -> [String: Sendable] {
195
+ var retVal = [String: Sendable]()
196
+ retVal["value"] = token?.value
197
+ if let expiresIn = token?.expiresIn {
198
+ retVal["expiresIn"] = expiresIn
199
+ }
200
+ return retVal
201
201
  }
202
202
 
203
203
  func dictionaryToIssuingType(
204
- issuingTypeDictionary: [String: Any],
204
+ issuingTypeDictionary: [String: Sendable],
205
205
  defaultIssuingType: VCLIssuingType
206
206
  ) -> VCLIssuingType {
207
- if let issuingType = issuingTypeDictionary["issuingType"] as? String {
208
- return VCLIssuingType.fromString(value: issuingType)
209
- }
210
- return defaultIssuingType
207
+ if let issuingType = issuingTypeDictionary["issuingType"] as? String {
208
+ return VCLIssuingType.fromString(value: issuingType)
209
+ }
210
+ return defaultIssuingType
211
211
  }
212
212
 
213
213
  func dictionaryToPresentationRequest(
214
- _ presentationRequestDictionary: [String: Any]?
214
+ _ presentationRequestDictionary: [String: Sendable]?
215
215
  ) -> VCLPresentationRequest {
216
- return VCLPresentationRequest(
217
- jwt: dictionaryToJwt(presentationRequestDictionary?["jwt"] as? [String : Any]),
218
- verifiedProfile: dictionaryToVerifiedProfile(presentationRequestDictionary?["verifiedProfile"] as? [String: Any]),
219
- deepLink: dictionaryToDeepLink(presentationRequestDictionary?["deepLink"] as? [String : Any]) ?? VCLDeepLink(value: ""),
220
- pushDelegate: dictionaryToPushDelegate(presentationRequestDictionary?["pushDelegate"] as? [String : Any]),
221
- didJwk: dictionaryToDidJwk(presentationRequestDictionary?["didJwk"] as? [String : Any]),
222
- remoteCryptoServicesToken: dictionaryToToken(presentationRequestDictionary?["remoteCryptoServicesToken"] as? [String : Any])
223
- )
216
+ return VCLPresentationRequest(
217
+ jwt: dictionaryToJwt(presentationRequestDictionary?["jwt"] as? [String : Sendable]),
218
+ verifiedProfile: dictionaryToVerifiedProfile(presentationRequestDictionary?["verifiedProfile"] as? [String: Sendable]),
219
+ deepLink: dictionaryToDeepLink(presentationRequestDictionary?["deepLink"] as? [String : Sendable]) ?? VCLDeepLink(value: ""),
220
+ pushDelegate: dictionaryToPushDelegate(presentationRequestDictionary?["pushDelegate"] as? [String : Sendable]),
221
+ didJwk: dictionaryToDidJwk(presentationRequestDictionary?["didJwk"] as? [String : Sendable]),
222
+ remoteCryptoServicesToken: dictionaryToToken(presentationRequestDictionary?["remoteCryptoServicesToken"] as? [String : Sendable])
223
+ )
224
224
  }
225
225
 
226
226
  func presentationRequestToDictionary(
227
227
  _ presentationRequest: VCLPresentationRequest
228
- ) -> [String: Any] {
229
- var presentationRequestDictionary = [String: Any]()
230
- presentationRequestDictionary["jwt"] = ["encodedJwt": presentationRequest.jwt.encodedJwt]
231
- presentationRequestDictionary["verifiedProfile"] = verifiedProfileToDictionary(presentationRequest.verifiedProfile)
232
- presentationRequestDictionary["iss"] = presentationRequest.iss
233
- presentationRequestDictionary["exchangeId"] = presentationRequest.exchangeId
234
- presentationRequestDictionary["presentationDefinitionId"] = presentationRequest.presentationDefinitionId
235
- presentationRequestDictionary["deepLink"] = deepLinkToDictionary(presentationRequest.deepLink)
236
- presentationRequestDictionary["didJwk"] = didJwkToDictionary(presentationRequest.didJwk)
237
- presentationRequestDictionary["remoteCryptoServicesToken"] = tokenToDictionary(presentationRequest.remoteCryptoServicesToken)
238
- return presentationRequestDictionary
228
+ ) -> [String: Sendable] {
229
+ var presentationRequestDictionary = [String: Sendable]()
230
+ presentationRequestDictionary["jwt"] = ["encodedJwt": presentationRequest.jwt.encodedJwt]
231
+ presentationRequestDictionary["verifiedProfile"] = verifiedProfileToDictionary(presentationRequest.verifiedProfile)
232
+ presentationRequestDictionary["iss"] = presentationRequest.iss
233
+ presentationRequestDictionary["exchangeId"] = presentationRequest.exchangeId
234
+ presentationRequestDictionary["presentationDefinitionId"] = presentationRequest.presentationDefinitionId
235
+ presentationRequestDictionary["deepLink"] = deepLinkToDictionary(presentationRequest.deepLink)
236
+ presentationRequestDictionary["didJwk"] = didJwkToDictionary(presentationRequest.didJwk)
237
+ presentationRequestDictionary["remoteCryptoServicesToken"] = tokenToDictionary(presentationRequest.remoteCryptoServicesToken)
238
+ return presentationRequestDictionary
239
239
  }
240
240
 
241
241
  func dictionaryToPresentationSubmission(
242
- _ presentationSubmissionDictionary: [String: Any]?
242
+ _ presentationSubmissionDictionary: [String: Sendable]?
243
243
  ) -> VCLPresentationSubmission {
244
- var verifiableCredentialsList = [VCLVerifiableCredential]()
245
- if let verifiableCredentialsArr = (presentationSubmissionDictionary?["verifiableCredentials"] as? [[String: String]]) {
246
- for verifiableCredential in verifiableCredentialsArr {
247
- verifiableCredentialsList.append(
248
- VCLVerifiableCredential(
249
- inputDescriptor: verifiableCredential["inputDescriptor"] ?? "",
250
- jwtVc: verifiableCredential["jwtVc"] ?? ""
251
- )
252
- )
253
- }
244
+ var verifiableCredentialsList = [VCLVerifiableCredential]()
245
+ if let verifiableCredentialsArr = (presentationSubmissionDictionary?["verifiableCredentials"] as? [[String: String]]) {
246
+ for verifiableCredential in verifiableCredentialsArr {
247
+ verifiableCredentialsList.append(
248
+ VCLVerifiableCredential(
249
+ inputDescriptor: verifiableCredential["inputDescriptor"] ?? "",
250
+ jwtVc: verifiableCredential["jwtVc"] ?? ""
251
+ )
252
+ )
254
253
  }
255
- return VCLPresentationSubmission(
256
- presentationRequest: dictionaryToPresentationRequest(presentationSubmissionDictionary?["presentationRequest"] as? [String: Any]),
257
- verifiableCredentials: verifiableCredentialsList
258
- )
254
+ }
255
+ return VCLPresentationSubmission(
256
+ presentationRequest: dictionaryToPresentationRequest(presentationSubmissionDictionary?["presentationRequest"] as? [String: Sendable]),
257
+ verifiableCredentials: verifiableCredentialsList
258
+ )
259
259
  }
260
260
 
261
261
  func presentationSubmissionResultToDictionary(
262
262
  _ presentationSubmissionResult: VCLSubmissionResult
263
- ) -> [String: Any] {
264
- var presentationSubmissionResulDictionary = [String: Any]()
265
- presentationSubmissionResulDictionary[VCLSubmissionResult.CodingKeys.KeyToken] = tokenToDictionary(presentationSubmissionResult.sessionToken)
266
- presentationSubmissionResulDictionary[VCLSubmissionResult.CodingKeys.KeyExchange] = exchangeToDictionary(presentationSubmissionResult.exchange)
267
- presentationSubmissionResulDictionary[VCLSubmissionResult.CodingKeys.KeyJti] = presentationSubmissionResult.jti
268
- presentationSubmissionResulDictionary[VCLSubmissionResult.CodingKeys.KeySubmissionId] = presentationSubmissionResult.submissionId
269
- return presentationSubmissionResulDictionary
263
+ ) -> [String: Sendable] {
264
+ var presentationSubmissionResulDictionary = [String: Sendable]()
265
+ presentationSubmissionResulDictionary[VCLSubmissionResult.CodingKeys.KeyToken] = tokenToDictionary(presentationSubmissionResult.sessionToken)
266
+ presentationSubmissionResulDictionary[VCLSubmissionResult.CodingKeys.KeyExchange] = exchangeToDictionary(presentationSubmissionResult.exchange)
267
+ presentationSubmissionResulDictionary[VCLSubmissionResult.CodingKeys.KeyJti] = presentationSubmissionResult.jti
268
+ presentationSubmissionResulDictionary[VCLSubmissionResult.CodingKeys.KeySubmissionId] = presentationSubmissionResult.submissionId
269
+ return presentationSubmissionResulDictionary
270
270
  }
271
271
 
272
272
  func exchangeToDictionary(
273
273
  _ exchange: VCLExchange?
274
- ) -> [String: Any] {
275
- var exchangeDictionary = [String: Any]()
276
- exchangeDictionary["id"] = exchange?.id
277
- exchangeDictionary["type"] = exchange?.type
278
- exchangeDictionary["disclosureComplete"] = exchange?.disclosureComplete
279
- exchangeDictionary["exchangeComplete"] = exchange?.exchangeComplete
280
- return exchangeDictionary
281
- }
282
-
283
- func dictionaryToSubmissionResult(_ submissionResultDictionary: [String: Any]?) -> VCLSubmissionResult {
284
- return VCLSubmissionResult(
285
- sessionToken: dictionaryToToken(submissionResultDictionary?[VCLSubmissionResult.CodingKeys.KeyToken] as? [String: Any]),
286
- exchange: dictionaryToExchange(submissionResultDictionary?[VCLSubmissionResult.CodingKeys.KeyExchange] as? [String: Any]),
287
- jti: submissionResultDictionary?[VCLSubmissionResult.CodingKeys.KeyJti] as? String ?? "",
288
- submissionId: submissionResultDictionary?[VCLSubmissionResult.CodingKeys.KeySubmissionId] as? String ?? ""
289
- )
274
+ ) -> [String: Sendable] {
275
+ var exchangeDictionary = [String: Sendable]()
276
+ exchangeDictionary["id"] = exchange?.id
277
+ exchangeDictionary["type"] = exchange?.type
278
+ exchangeDictionary["disclosureComplete"] = exchange?.disclosureComplete
279
+ exchangeDictionary["exchangeComplete"] = exchange?.exchangeComplete
280
+ return exchangeDictionary
281
+ }
282
+
283
+ func dictionaryToSubmissionResult(_ submissionResultDictionary: [String: Sendable]?) -> VCLSubmissionResult {
284
+ return VCLSubmissionResult(
285
+ sessionToken: dictionaryToToken(submissionResultDictionary?[VCLSubmissionResult.CodingKeys.KeyToken] as? [String: Sendable]),
286
+ exchange: dictionaryToExchange(submissionResultDictionary?[VCLSubmissionResult.CodingKeys.KeyExchange] as? [String: Sendable]),
287
+ jti: submissionResultDictionary?[VCLSubmissionResult.CodingKeys.KeyJti] as? String ?? "",
288
+ submissionId: submissionResultDictionary?[VCLSubmissionResult.CodingKeys.KeySubmissionId] as? String ?? ""
289
+ )
290
290
  }
291
291
 
292
292
  func dictionaryToExchange(
293
- _ exchangeReadableMap: [String: Any]?
293
+ _ exchangeReadableMap: [String: Sendable]?
294
294
  ) -> VCLExchange {
295
- return VCLExchange(
296
- id: exchangeReadableMap?["id"] as? String ?? "",
297
- type: exchangeReadableMap?["type"] as? String ?? "",
298
- disclosureComplete: exchangeReadableMap?["disclosureComplete"] as? Bool ?? false,
299
- exchangeComplete: exchangeReadableMap?["exchangeComplete"] as? Bool ?? false
300
- )
295
+ return VCLExchange(
296
+ id: exchangeReadableMap?["id"] as? String ?? "",
297
+ type: exchangeReadableMap?["type"] as? String ?? "",
298
+ disclosureComplete: exchangeReadableMap?["disclosureComplete"] as? Bool ?? false,
299
+ exchangeComplete: exchangeReadableMap?["exchangeComplete"] as? Bool ?? false
300
+ )
301
301
  }
302
302
 
303
303
  func dictionaryToExchangeDescriptor(
304
- _ exchangeDescriptorDictionary: [String: Any]?
304
+ _ exchangeDescriptorDictionary: [String: Sendable]?
305
305
  ) -> VCLExchangeDescriptor {
306
- return VCLExchangeDescriptor(
307
- presentationSubmission: dictionaryToPresentationSubmission(exchangeDescriptorDictionary?["presentationSubmission"] as? [String: Any]),
308
- submissionResult: dictionaryToSubmissionResult(exchangeDescriptorDictionary?["submissionResult"] as? [String: Any])
309
- )
306
+ return VCLExchangeDescriptor(
307
+ presentationSubmission: dictionaryToPresentationSubmission(exchangeDescriptorDictionary?["presentationSubmission"] as? [String: Sendable]),
308
+ submissionResult: dictionaryToSubmissionResult(exchangeDescriptorDictionary?["submissionResult"] as? [String: Sendable])
309
+ )
310
310
  }
311
311
 
312
312
  func dictionayToOrganizationsSearchDescriptor(
313
- _ organizationsDescriptorDictionary: [String: Any]
313
+ _ organizationsDescriptorDictionary: [String: Sendable]
314
314
  ) -> VCLOrganizationsSearchDescriptor {
315
- return VCLOrganizationsSearchDescriptor(
316
- filter: dictionaryToFilter(organizationsDescriptorDictionary["filter"] as? [String : Any]),
317
- page: dictionaryToPage(organizationsDescriptorDictionary["page"] as? [String : Any]),
318
- sort: organizationsDescriptorDictionary["sort"] as? [[String]],
319
- query: organizationsDescriptorDictionary["query"] as? String
320
- )
315
+ return VCLOrganizationsSearchDescriptor(
316
+ filter: dictionaryToFilter(organizationsDescriptorDictionary["filter"] as? [String : Sendable]),
317
+ page: dictionaryToPage(organizationsDescriptorDictionary["page"] as? [String : Sendable]),
318
+ sort: organizationsDescriptorDictionary["sort"] as? [[String]],
319
+ query: organizationsDescriptorDictionary["query"] as? String
320
+ )
321
321
  }
322
322
 
323
323
  func dictionaryToFilter(
324
- _ filterDictionary: [String: Any]?
324
+ _ filterDictionary: [String: Sendable]?
325
325
  ) -> VCLFilter {
326
- let did: String? = filterDictionary?["did"] as? String
327
- var serviceTypesList: [VCLServiceType]? = nil
328
- if let serviceTypesArr = (filterDictionary?["serviceTypes"] as? [String]) {
329
- serviceTypesList = [VCLServiceType]()
330
- for serviceTypeStr in serviceTypesArr {
331
- serviceTypesList?.append(VCLServiceType.fromString(value: serviceTypeStr))
332
- }
326
+ let did: String? = filterDictionary?["did"] as? String
327
+ var serviceTypesList: [VCLServiceType]? = nil
328
+ if let serviceTypesArr = (filterDictionary?["serviceTypes"] as? [String]) {
329
+ serviceTypesList = [VCLServiceType]()
330
+ for serviceTypeStr in serviceTypesArr {
331
+ serviceTypesList?.append(VCLServiceType.fromString(value: serviceTypeStr))
333
332
  }
334
- var credentialTypesList: [String]? = nil
335
- if let credentialTypesArr = (filterDictionary?["credentialTypes"] as? [String]) {
336
- credentialTypesList = [String]()
337
- for credentialType in credentialTypesArr {
338
- credentialTypesList?.append(credentialType)
339
- }
333
+ }
334
+ var credentialTypesList: [String]? = nil
335
+ if let credentialTypesArr = (filterDictionary?["credentialTypes"] as? [String]) {
336
+ credentialTypesList = [String]()
337
+ for credentialType in credentialTypesArr {
338
+ credentialTypesList?.append(credentialType)
340
339
  }
341
- let serviceTypes: VCLServiceTypes? = serviceTypesList != nil ? VCLServiceTypes(all: serviceTypesList ?? [VCLServiceType]()) : nil
342
- return VCLFilter(did: did, serviceTypes: serviceTypes, credentialTypes: credentialTypesList)
340
+ }
341
+ let serviceTypes: VCLServiceTypes? = serviceTypesList != nil ? VCLServiceTypes(all: serviceTypesList ?? [VCLServiceType]()) : nil
342
+ return VCLFilter(did: did, serviceTypes: serviceTypes, credentialTypes: credentialTypesList)
343
343
  }
344
344
 
345
- func dictionaryToPage(_ pageDictionary: [String: Any]?) -> VCLPage {
346
- return VCLPage(
347
- size: pageDictionary?["size"] as? String,
348
- skip: pageDictionary?["skip"] as? String
349
- )
345
+ func dictionaryToPage(_ pageDictionary: [String: Sendable]?) -> VCLPage {
346
+ return VCLPage(
347
+ size: pageDictionary?["size"] as? String,
348
+ skip: pageDictionary?["skip"] as? String
349
+ )
350
350
  }
351
351
 
352
352
  func organizationsToDictionary(
353
353
  _ organizations: VCLOrganizations
354
- ) -> [String: Any] {
355
- var organizationsMap = [String: Any]()
356
- var organizationsArr = [[String: Any]]()
357
- organizations.all.forEach { organization in
358
- var organizationMap = [String: Any]()
359
- organizationMap["payload"] = organization.payload
360
- var serviceCredentialAgentIssuersArr = [[String: Any]]()
361
- organization.serviceCredentialAgentIssuers.forEach { service in
362
- var serviceCredentialAgentIssuerMap = [String: Any]()
363
- if let credentialTypes = service.credentialTypes {
364
- serviceCredentialAgentIssuerMap["credentialTypes"] = credentialTypes
365
- }
366
- serviceCredentialAgentIssuerMap["id"] = service.id
367
- serviceCredentialAgentIssuerMap["type"] = service.type
368
- serviceCredentialAgentIssuerMap["serviceEndpoint"] = service.serviceEndpoint
369
- serviceCredentialAgentIssuerMap["payload"] = service.payload
370
- serviceCredentialAgentIssuersArr.append(serviceCredentialAgentIssuerMap)
371
- }
372
- organizationMap["serviceCredentialAgentIssuers"] = serviceCredentialAgentIssuersArr
373
- organizationMap["payload"] = organization.payload
374
- organizationsArr.append(organizationMap)
354
+ ) -> [String: Sendable] {
355
+ var organizationsMap = [String: Sendable]()
356
+ var organizationsArr = [[String: Sendable]]()
357
+ organizations.all.forEach { organization in
358
+ var organizationMap = [String: Sendable]()
359
+ organizationMap["payload"] = organization.payload
360
+ var serviceCredentialAgentIssuersArr = [[String: Sendable]]()
361
+ organization.serviceCredentialAgentIssuers.forEach { service in
362
+ var serviceCredentialAgentIssuerMap = [String: Sendable]()
363
+ if let credentialTypes = service.credentialTypes {
364
+ serviceCredentialAgentIssuerMap["credentialTypes"] = credentialTypes
365
+ }
366
+ serviceCredentialAgentIssuerMap["id"] = service.id
367
+ serviceCredentialAgentIssuerMap["type"] = service.type
368
+ serviceCredentialAgentIssuerMap["serviceEndpoint"] = service.serviceEndpoint
369
+ serviceCredentialAgentIssuerMap["payload"] = service.payload
370
+ serviceCredentialAgentIssuersArr.append(serviceCredentialAgentIssuerMap)
375
371
  }
376
- organizationsMap["all"] = organizationsArr
377
- return organizationsMap
378
- }
379
-
380
- func dictionaryToPushDelegate(_ pushDelegateMap: [String: Any]?) -> VCLPushDelegate? {
381
- let pushUrl = pushDelegateMap?["pushUrl"] as? String
382
- let pushToken = pushDelegateMap?["pushToken"] as? String
383
- if (pushUrl != nil && pushToken != nil) {
384
- return VCLPushDelegate(
385
- pushUrl: pushUrl!,
386
- pushToken: pushToken!
387
- )
388
- }
389
- else { return nil }
372
+ organizationMap["serviceCredentialAgentIssuers"] = serviceCredentialAgentIssuersArr
373
+ organizationMap["payload"] = organization.payload
374
+ organizationsArr.append(organizationMap)
375
+ }
376
+ organizationsMap["all"] = organizationsArr
377
+ return organizationsMap
378
+ }
379
+
380
+ func dictionaryToPushDelegate(_ pushDelegateMap: [String: Sendable]?) -> VCLPushDelegate? {
381
+ let pushUrl = pushDelegateMap?["pushUrl"] as? String
382
+ let pushToken = pushDelegateMap?["pushToken"] as? String
383
+ if (pushUrl != nil && pushToken != nil) {
384
+ return VCLPushDelegate(
385
+ pushUrl: pushUrl!,
386
+ pushToken: pushToken!
387
+ )
388
+ }
389
+ else { return nil }
390
390
  }
391
391
 
392
392
  func dictionaryToCredentialManifestDescriptor(
393
- _ credentialManifestDescriptorDictionary: [String: Any]
393
+ _ credentialManifestDescriptorDictionary: [String: Sendable]
394
394
  ) -> VCLCredentialManifestDescriptor? {
395
- if (credentialManifestDescriptorDictionary["deepLink"] != nil) {
396
- return dictionaryToCredentialManifestDescriptorByDeepLink(credentialManifestDescriptorDictionary)
397
- } else if (credentialManifestDescriptorDictionary["service"] != nil) {
398
- if(credentialManifestDescriptorDictionary["credentialIds"] != nil) {
399
- return dictionaryToCredentialManifestDescriptorRefresh(credentialManifestDescriptorDictionary)
400
- } else {
401
- return dictionaryToCredentialManifestDescriptorByService(credentialManifestDescriptorDictionary)
402
- }
395
+ if (credentialManifestDescriptorDictionary["deepLink"] != nil) {
396
+ return dictionaryToCredentialManifestDescriptorByDeepLink(credentialManifestDescriptorDictionary)
397
+ } else if (credentialManifestDescriptorDictionary["service"] != nil) {
398
+ if(credentialManifestDescriptorDictionary["credentialIds"] != nil) {
399
+ return dictionaryToCredentialManifestDescriptorRefresh(credentialManifestDescriptorDictionary)
400
+ } else {
401
+ return dictionaryToCredentialManifestDescriptorByService(credentialManifestDescriptorDictionary)
403
402
  }
404
- return nil
403
+ }
404
+ return nil
405
405
  }
406
406
 
407
407
  func dictionaryToCredentialManifestDescriptorByDeepLink(
408
- _ credentialManifestDescriptorByDeepLinkDictionary: [String: Any]
408
+ _ credentialManifestDescriptorByDeepLinkDictionary: [String: Sendable]
409
409
  ) -> VCLCredentialManifestDescriptorByDeepLink {
410
- return VCLCredentialManifestDescriptorByDeepLink(
411
- deepLink: dictionaryToDeepLink(
412
- credentialManifestDescriptorByDeepLinkDictionary["deepLink"] as? [String : Any]
413
- ) ?? VCLDeepLink(value: ""),
414
- issuingType: dictionaryToIssuingType(
415
- issuingTypeDictionary: credentialManifestDescriptorByDeepLinkDictionary,
416
- defaultIssuingType: VCLIssuingType.Career
417
- ),
418
- pushDelegate: dictionaryToPushDelegate(credentialManifestDescriptorByDeepLinkDictionary["pushDelegate"] as? [String: Any]),
419
- didJwk: dictionaryToDidJwk(credentialManifestDescriptorByDeepLinkDictionary["didJwk"] as? [String: Any]),
420
- remoteCryptoServicesToken: dictionaryToToken(
421
- credentialManifestDescriptorByDeepLinkDictionary["remoteCryptoServicesToken"] as? [String: Any]
422
- )
410
+ return VCLCredentialManifestDescriptorByDeepLink(
411
+ deepLink: dictionaryToDeepLink(
412
+ credentialManifestDescriptorByDeepLinkDictionary["deepLink"] as? [String : Sendable]
413
+ ) ?? VCLDeepLink(value: ""),
414
+ issuingType: dictionaryToIssuingType(
415
+ issuingTypeDictionary: credentialManifestDescriptorByDeepLinkDictionary,
416
+ defaultIssuingType: VCLIssuingType.Career
417
+ ),
418
+ pushDelegate: dictionaryToPushDelegate(credentialManifestDescriptorByDeepLinkDictionary["pushDelegate"] as? [String: Sendable]),
419
+ didJwk: dictionaryToDidJwk(credentialManifestDescriptorByDeepLinkDictionary["didJwk"] as? [String: Sendable]),
420
+ remoteCryptoServicesToken: dictionaryToToken(
421
+ credentialManifestDescriptorByDeepLinkDictionary["remoteCryptoServicesToken"] as? [String: Sendable]
423
422
  )
423
+ )
424
424
  }
425
425
 
426
426
  func dictionaryToCredentialManifestDescriptorByService(
427
- _ credentialManifestDescriptorByServiceDictionary: [String: Any]
427
+ _ credentialManifestDescriptorByServiceDictionary: [String: Sendable]
428
428
  ) -> VCLCredentialManifestDescriptorByService {
429
- return VCLCredentialManifestDescriptorByService(
430
- service: dictionaryToService(
431
- credentialManifestDescriptorByServiceDictionary["service"] as? [String : Any]
432
- ),
433
- issuingType: dictionaryToIssuingType(
434
- issuingTypeDictionary: credentialManifestDescriptorByServiceDictionary,
435
- defaultIssuingType: VCLIssuingType.Career
436
- ),
437
- credentialTypes: credentialManifestDescriptorByServiceDictionary["credentialTypes"] as? [String],
438
- pushDelegate: dictionaryToPushDelegate(
439
- credentialManifestDescriptorByServiceDictionary["pushDelegate"] as? [String: Any]
440
- ),
441
- didJwk: dictionaryToDidJwk(credentialManifestDescriptorByServiceDictionary["didJwk"] as? [String: Any]),
442
- remoteCryptoServicesToken: dictionaryToToken(
443
- credentialManifestDescriptorByServiceDictionary["remoteCryptoServicesToken"] as? [String: Any]
444
- )
429
+ return VCLCredentialManifestDescriptorByService(
430
+ service: dictionaryToService(
431
+ credentialManifestDescriptorByServiceDictionary["service"] as? [String : Sendable]
432
+ ),
433
+ issuingType: dictionaryToIssuingType(
434
+ issuingTypeDictionary: credentialManifestDescriptorByServiceDictionary,
435
+ defaultIssuingType: VCLIssuingType.Career
436
+ ),
437
+ credentialTypes: credentialManifestDescriptorByServiceDictionary["credentialTypes"] as? [String],
438
+ pushDelegate: dictionaryToPushDelegate(
439
+ credentialManifestDescriptorByServiceDictionary["pushDelegate"] as? [String: Sendable]
440
+ ),
441
+ didJwk: dictionaryToDidJwk(credentialManifestDescriptorByServiceDictionary["didJwk"] as? [String: Sendable]),
442
+ remoteCryptoServicesToken: dictionaryToToken(
443
+ credentialManifestDescriptorByServiceDictionary["remoteCryptoServicesToken"] as? [String: Sendable]
445
444
  )
445
+ )
446
446
  }
447
447
 
448
448
  func dictionaryToCredentialManifestDescriptorRefresh(
449
- _ credentialManifestDescriptorRefreshDictionary: [String: Any]
449
+ _ credentialManifestDescriptorRefreshDictionary: [String: Sendable]
450
450
  ) -> VCLCredentialManifestDescriptorRefresh {
451
- return VCLCredentialManifestDescriptorRefresh(
452
- service: dictionaryToService(
453
- credentialManifestDescriptorRefreshDictionary["service"] as? [String : Any]
454
- ),
455
- credentialIds: credentialManifestDescriptorRefreshDictionary["credentialIds"] as? [String] ?? [],
456
- didJwk: dictionaryToDidJwk(credentialManifestDescriptorRefreshDictionary["didJwk"] as? [String: Any]),
457
- remoteCryptoServicesToken: dictionaryToToken(
458
- credentialManifestDescriptorRefreshDictionary["remoteCryptoServicesToken"] as? [String: Any]
459
- )
451
+ return VCLCredentialManifestDescriptorRefresh(
452
+ service: dictionaryToService(
453
+ credentialManifestDescriptorRefreshDictionary["service"] as? [String : Sendable]
454
+ ),
455
+ credentialIds: credentialManifestDescriptorRefreshDictionary["credentialIds"] as? [String] ?? [],
456
+ didJwk: dictionaryToDidJwk(credentialManifestDescriptorRefreshDictionary["didJwk"] as? [String: Sendable]),
457
+ remoteCryptoServicesToken: dictionaryToToken(
458
+ credentialManifestDescriptorRefreshDictionary["remoteCryptoServicesToken"] as? [String: Sendable]
460
459
  )
460
+ )
461
461
  }
462
462
 
463
463
  func dictionaryToService(
464
- _ serviceDictionary: [String: Any]?
464
+ _ serviceDictionary: [String: Sendable]?
465
465
  ) -> VCLService {
466
- return VCLService(payload: serviceDictionary?["payload"] as? [String : Any] ?? [:])
466
+ return VCLService(payload: serviceDictionary?["payload"] as? [String : Sendable] ?? [:])
467
467
  }
468
468
 
469
469
  func credentialManifestToDictionary(
470
470
  _ credentialManifest: VCLCredentialManifest
471
- ) -> [String: Any] {
472
- var credentialManifestDictinary = [String: Any]()
473
- credentialManifestDictinary["jwt"] = ["encodedJwt": credentialManifest.jwt.encodedJwt]
474
- credentialManifestDictinary["did"] = credentialManifest.did
475
- credentialManifestDictinary["iss"] = credentialManifest.iss
476
- credentialManifestDictinary["exchangeId"] = credentialManifest.exchangeId
477
- credentialManifestDictinary["vendorOriginContext"] = credentialManifest.vendorOriginContext
478
- credentialManifestDictinary["verifiedProfile"] = credentialManifest.verifiedProfile.payload
479
- credentialManifestDictinary["deepLink"] = deepLinkToDictionary(credentialManifest.deepLink)
480
- credentialManifestDictinary["didJwk"] = didJwkToDictionary(credentialManifest.didJwk)
481
- credentialManifestDictinary["remoteCryptoServicesToken"] = tokenToDictionary(credentialManifest.remoteCryptoServicesToken)
482
- return credentialManifestDictinary
471
+ ) -> [String: Sendable] {
472
+ var credentialManifestDictinary = [String: Sendable]()
473
+ credentialManifestDictinary["jwt"] = ["encodedJwt": credentialManifest.jwt.encodedJwt]
474
+ credentialManifestDictinary["did"] = credentialManifest.did
475
+ credentialManifestDictinary["iss"] = credentialManifest.iss
476
+ credentialManifestDictinary["exchangeId"] = credentialManifest.exchangeId
477
+ credentialManifestDictinary["vendorOriginContext"] = credentialManifest.vendorOriginContext
478
+ credentialManifestDictinary["verifiedProfile"] = credentialManifest.verifiedProfile.payload
479
+ credentialManifestDictinary["deepLink"] = deepLinkToDictionary(credentialManifest.deepLink)
480
+ credentialManifestDictinary["didJwk"] = didJwkToDictionary(credentialManifest.didJwk)
481
+ credentialManifestDictinary["remoteCryptoServicesToken"] = tokenToDictionary(credentialManifest.remoteCryptoServicesToken)
482
+ return credentialManifestDictinary
483
483
  }
484
484
 
485
485
  func dictionaryToCredentialManifest(
486
- _ credentialManifestDictionary: [String: Any]?
486
+ _ credentialManifestDictionary: [String: Sendable]?
487
487
  ) -> VCLCredentialManifest {
488
- let jwt = VCLJwt(encodedJwt: (credentialManifestDictionary?["jwt"] as? [String: Any])?["encodedJwt"] as? String ?? "")
489
- let vendorOriginContext = credentialManifestDictionary?["vendorOriginContext"] as? String
490
- let verifiedProfileDictionary = credentialManifestDictionary?["verifiedProfile"] as? [String: Any]
491
- let deepLink = dictionaryToDeepLink(credentialManifestDictionary?["deepLink"] as? [String: Any])
492
- let didJwk = dictionaryToDidJwk(credentialManifestDictionary?["didJwk"] as? [String: Any])
493
- let remoteCryptoServicesToken = dictionaryToToken(credentialManifestDictionary?["remoteCryptoServicesToken"] as? [String: Any])
494
-
495
- return VCLCredentialManifest(
496
- jwt: jwt,
497
- vendorOriginContext: vendorOriginContext,
498
- verifiedProfile: VCLVerifiedProfile(payload: verifiedProfileDictionary ?? [:]),
499
- deepLink: deepLink,
500
- didJwk: didJwk,
501
- remoteCryptoServicesToken: remoteCryptoServicesToken
502
- )
488
+ let jwt = VCLJwt(encodedJwt: (credentialManifestDictionary?["jwt"] as? [String: Sendable])?["encodedJwt"] as? String ?? "")
489
+ let vendorOriginContext = credentialManifestDictionary?["vendorOriginContext"] as? String
490
+ let verifiedProfileDictionary = credentialManifestDictionary?["verifiedProfile"] as? [String: Sendable]
491
+ let deepLink = dictionaryToDeepLink(credentialManifestDictionary?["deepLink"] as? [String: Sendable])
492
+ let didJwk = dictionaryToDidJwk(credentialManifestDictionary?["didJwk"] as? [String: Sendable])
493
+ let remoteCryptoServicesToken = dictionaryToToken(credentialManifestDictionary?["remoteCryptoServicesToken"] as? [String: Sendable])
494
+
495
+ return VCLCredentialManifest(
496
+ jwt: jwt,
497
+ vendorOriginContext: vendorOriginContext,
498
+ verifiedProfile: VCLVerifiedProfile(payload: verifiedProfileDictionary ?? [:]),
499
+ deepLink: deepLink,
500
+ didJwk: didJwk,
501
+ remoteCryptoServicesToken: remoteCryptoServicesToken
502
+ )
503
503
  }
504
504
 
505
505
  func dictionaryToGenerateOffersDescriptor(
506
- _ generateOffersDescriptorDictionary: [String: Any]
506
+ _ generateOffersDescriptorDictionary: [String: Sendable]
507
507
  ) -> VCLGenerateOffersDescriptor {
508
- let verifiableCredentialsArr = generateOffersDescriptorDictionary["identificationVerifiableCredentials"] as? [Any]
509
- var verifiableCredentialsList: [VCLVerifiableCredential]? = nil
510
- if let verifiableCredentials = verifiableCredentialsArr {
511
- verifiableCredentialsList = [VCLVerifiableCredential]()
512
- for i in 0..<verifiableCredentials.count {
513
- let verifiableCredentialDict = verifiableCredentials[i] as? [String: String]
514
- verifiableCredentialsList?.append(
515
- VCLVerifiableCredential(
516
- inputDescriptor: verifiableCredentialDict?["inputDescriptor"] ?? "",
517
- jwtVc: verifiableCredentialDict?["jwtVc"] ?? ""
518
- )
519
- )
520
- }
508
+ let verifiableCredentialsArr = generateOffersDescriptorDictionary["identificationVerifiableCredentials"] as? [Sendable]
509
+ var verifiableCredentialsList: [VCLVerifiableCredential]? = nil
510
+ if let verifiableCredentials = verifiableCredentialsArr {
511
+ verifiableCredentialsList = [VCLVerifiableCredential]()
512
+ for i in 0..<verifiableCredentials.count {
513
+ let verifiableCredentialDict = verifiableCredentials[i] as? [String: String]
514
+ verifiableCredentialsList?.append(
515
+ VCLVerifiableCredential(
516
+ inputDescriptor: verifiableCredentialDict?["inputDescriptor"] ?? "",
517
+ jwtVc: verifiableCredentialDict?["jwtVc"] ?? ""
518
+ )
519
+ )
521
520
  }
522
- return VCLGenerateOffersDescriptor(
523
- credentialManifest: dictionaryToCredentialManifest(generateOffersDescriptorDictionary["credentialManifest"] as? [String: Any]),
524
- types: generateOffersDescriptorDictionary["types"] as? [String],
525
- offerHashes: generateOffersDescriptorDictionary["offerHashes"] as? [String],
526
- identificationVerifiableCredentials: verifiableCredentialsList
527
- )
521
+ }
522
+ return VCLGenerateOffersDescriptor(
523
+ credentialManifest: dictionaryToCredentialManifest(generateOffersDescriptorDictionary["credentialManifest"] as? [String: Sendable]),
524
+ types: generateOffersDescriptorDictionary["types"] as? [String],
525
+ offerHashes: generateOffersDescriptorDictionary["offerHashes"] as? [String],
526
+ identificationVerifiableCredentials: verifiableCredentialsList
527
+ )
528
528
  }
529
529
 
530
- func offersToDictionary(_ offers: VCLOffers) -> [String: Any] {
531
- var offersDictionary = [String: Any]()
532
- offersDictionary["payload"] = offers.payload
533
- offersDictionary["all"] = allOffersToArray(offers.all)
534
- offersDictionary["responseCode"] = offers.responseCode
535
- offersDictionary["sessionToken"] = tokenToDictionary(offers.sessionToken)
536
- offersDictionary["challenge"] = offers.challenge
537
- return offersDictionary
530
+ func offersToDictionary(_ offers: VCLOffers) -> [String: Sendable] {
531
+ var offersDictionary = [String: Sendable]()
532
+ offersDictionary["payload"] = offers.payload
533
+ offersDictionary["all"] = allOffersToArray(offers.all)
534
+ offersDictionary["responseCode"] = offers.responseCode
535
+ offersDictionary["sessionToken"] = tokenToDictionary(offers.sessionToken)
536
+ offersDictionary["challenge"] = offers.challenge
537
+ return offersDictionary
538
538
  }
539
539
 
540
- func dictionaryToOffers(_ offersDictionary: [String : Any]?) -> VCLOffers {
541
- return VCLOffers(
542
- payload: offersDictionary?["payload"] as? [String: Any] ?? [String: Any](),
543
- all: arrayToAllOffers(offersDictionary!["all"] as? [[String : Any]]),
544
- responseCode: offersDictionary?["responseCode"] as? Int ?? 0,
545
- sessionToken: dictionaryToToken(offersDictionary?["sessionToken"] as? [String: Any]),
546
- challenge: offersDictionary?["challenge"] as? String ?? ""
547
- )
540
+ func dictionaryToOffers(_ offersDictionary: [String : Sendable]?) -> VCLOffers {
541
+ return VCLOffers(
542
+ payload: offersDictionary?["payload"] as? [String: Sendable] ?? [String: Sendable](),
543
+ all: arrayToAllOffers(offersDictionary!["all"] as? [[String : Sendable]]),
544
+ responseCode: offersDictionary?["responseCode"] as? Int ?? 0,
545
+ sessionToken: dictionaryToToken(offersDictionary?["sessionToken"] as? [String: Sendable]),
546
+ challenge: offersDictionary?["challenge"] as? String ?? ""
547
+ )
548
548
  }
549
549
 
550
- func arrayToAllOffers(_ allOffersArray: [[String : Any]]?) -> [VCLOffer] {
551
- return allOffersArray?.map {
552
- VCLOffer(payload: $0["payload"] as? [String : Any] ?? [:])
553
- } ?? [VCLOffer(payload: [:])]
550
+ func arrayToAllOffers(_ allOffersArray: [[String : Sendable]]?) -> [VCLOffer] {
551
+ return allOffersArray?.map {
552
+ VCLOffer(payload: $0["payload"] as? [String : Sendable] ?? [:])
553
+ } ?? [VCLOffer(payload: [:])]
554
554
  }
555
555
 
556
- func allOffersToArray(_ allOffers: [VCLOffer]?) -> [[String : Any]]? {
557
- return allOffers?.map { [
558
- "payload": $0.payload,
559
- "issuerId": $0.issuerId,
560
- "id": $0.id
561
- ] }
556
+ func allOffersToArray(_ allOffers: [VCLOffer]?) -> [[String : Sendable]]? {
557
+ return allOffers?.map { [
558
+ "payload": $0.payload,
559
+ "issuerId": $0.issuerId,
560
+ "id": $0.id
561
+ ] }
562
562
  }
563
563
 
564
564
  func credentialTypesFormSchemaToDictionary(
565
565
  _ credentialTypesFormSchema: VCLCredentialTypesUIFormSchema
566
- ) -> [String: Any] {
567
- var credentialTypesFormSchemaDictionary = [String: Any]()
568
- credentialTypesFormSchemaDictionary["payload"] = credentialTypesFormSchema.payload
569
- return credentialTypesFormSchemaDictionary
566
+ ) -> [String: Sendable] {
567
+ var credentialTypesFormSchemaDictionary = [String: Sendable]()
568
+ credentialTypesFormSchemaDictionary["payload"] = credentialTypesFormSchema.payload
569
+ return credentialTypesFormSchemaDictionary
570
570
  }
571
571
 
572
572
  func dictionaryToJwt(
573
- _ jwtDictionary: [String: Any]?
573
+ _ jwtDictionary: [String: Sendable]?
574
574
  ) -> VCLJwt {
575
- return VCLJwt(encodedJwt: jwtDictionary?["encodedJwt"] as? String ?? "")
575
+ return VCLJwt(encodedJwt: jwtDictionary?["encodedJwt"] as? String ?? "")
576
576
  }
577
577
 
578
- func jwtToDictionary(_ jwt: VCLJwt) -> [String: Any?] {
579
- return [
580
- "encodedJwt": jwt.encodedJwt,
581
- "header": jwt.header,
582
- "payload": jwt.payload,
583
- "signature": jwt.signature
584
- ]
578
+ func jwtToDictionary(_ jwt: VCLJwt) -> [String: Sendable?] {
579
+ return [
580
+ "encodedJwt": jwt.encodedJwt,
581
+ "header": jwt.header,
582
+ "payload": jwt.payload,
583
+ "signature": jwt.signature
584
+ ]
585
585
  }
586
586
 
587
587
  func dictionaryToPublicJwk(
588
- _ publicJwkDictionary: [String: Any]?
588
+ _ publicJwkDictionary: [String: Sendable]?
589
589
  ) -> VCLPublicJwk {
590
- return VCLPublicJwk(valueStr: (publicJwkDictionary?["valueStr"] as? String ?? ""))
590
+ return VCLPublicJwk(valueStr: (publicJwkDictionary?["valueStr"] as? String ?? ""))
591
591
  }
592
592
 
593
593
  func publicJwkToDictionary(
594
594
  _ publicJwk: VCLPublicJwk?
595
- ) -> [String: Any] {
596
- return ["valueStr": publicJwk?.valueStr ?? ""]
595
+ ) -> [String: Sendable] {
596
+ return ["valueStr": publicJwk?.valueStr ?? ""]
597
597
  }
598
598
 
599
599
  func dictionaryToFinalizedOffersDescriptor(
600
- _ finalizedOffersDescriptorDictionary: [String: Any]
600
+ _ finalizedOffersDescriptorDictionary: [String: Sendable]
601
601
  ) -> VCLFinalizeOffersDescriptor {
602
- return VCLFinalizeOffersDescriptor(
603
- credentialManifest: dictionaryToCredentialManifest(finalizedOffersDescriptorDictionary["credentialManifest"] as? [String : Any]),
604
- challenge: finalizedOffersDescriptorDictionary["challenge"] as? String,
605
- approvedOfferIds: finalizedOffersDescriptorDictionary["approvedOfferIds"] as? [String] ?? [String](),
606
- rejectedOfferIds: finalizedOffersDescriptorDictionary["rejectedOfferIds"] as? [String] ?? [String]()
607
- )
602
+ return VCLFinalizeOffersDescriptor(
603
+ credentialManifest: dictionaryToCredentialManifest(finalizedOffersDescriptorDictionary["credentialManifest"] as? [String : Sendable]),
604
+ challenge: finalizedOffersDescriptorDictionary["challenge"] as? String,
605
+ approvedOfferIds: finalizedOffersDescriptorDictionary["approvedOfferIds"] as? [String] ?? [String](),
606
+ rejectedOfferIds: finalizedOffersDescriptorDictionary["rejectedOfferIds"] as? [String] ?? [String]()
607
+ )
608
608
  }
609
609
 
610
610
  func jwtVerifiableCredentialsToDictionary(
611
611
  _ jwtVerifiableCredentials: VCLJwtVerifiableCredentials
612
- ) -> [String: Any] {
613
- var jwtVerifiableCredentialsDictionary = [String: Any]()
614
- let passedCredentials = jwtVerifiableCredentials.passedCredentials.map {
615
- jwtToDictionary($0)
616
- }
617
- let failedCredentials = jwtVerifiableCredentials.failedCredentials.map {
618
- jwtToDictionary($0)
619
- }
620
- jwtVerifiableCredentialsDictionary["passedCredentials"] = passedCredentials
621
- jwtVerifiableCredentialsDictionary["failedCredentials"] = failedCredentials
622
- return jwtVerifiableCredentialsDictionary
612
+ ) -> [String: Sendable] {
613
+ var jwtVerifiableCredentialsDictionary = [String: Sendable]()
614
+ let passedCredentials = jwtVerifiableCredentials.passedCredentials.map {
615
+ jwtToDictionary($0)
616
+ }
617
+ let failedCredentials = jwtVerifiableCredentials.failedCredentials.map {
618
+ jwtToDictionary($0)
619
+ }
620
+ jwtVerifiableCredentialsDictionary["passedCredentials"] = passedCredentials
621
+ jwtVerifiableCredentialsDictionary["failedCredentials"] = failedCredentials
622
+ return jwtVerifiableCredentialsDictionary
623
623
  }
624
624
 
625
625
  func readableMapToCredentialTypesUIFormSchemaDescriptor(
626
- _ credentialTypesUIFormSchemaDescriptorDictionary: [String: Any]
626
+ _ credentialTypesUIFormSchemaDescriptorDictionary: [String: Sendable]
627
627
  ) -> VCLCredentialTypesUIFormSchemaDescriptor {
628
- return VCLCredentialTypesUIFormSchemaDescriptor(
629
- credentialType: credentialTypesUIFormSchemaDescriptorDictionary["credentialType"] as? String ?? "",
630
- countryCode: credentialTypesUIFormSchemaDescriptorDictionary["countryCode"] as? String ?? ""
631
- )
628
+ return VCLCredentialTypesUIFormSchemaDescriptor(
629
+ credentialType: credentialTypesUIFormSchemaDescriptorDictionary["credentialType"] as? String ?? "",
630
+ countryCode: credentialTypesUIFormSchemaDescriptorDictionary["countryCode"] as? String ?? ""
631
+ )
632
632
  }
633
633
 
634
634
  func dictionaryToVerifiedProfileDescriptor(
635
- _ verifiedProfileDescriptor: [String: Any]
635
+ _ verifiedProfileDescriptor: [String: Sendable]
636
636
  ) -> VCLVerifiedProfileDescriptor {
637
- return VCLVerifiedProfileDescriptor(did: (verifiedProfileDescriptor["did"] as? String) ?? "")
637
+ return VCLVerifiedProfileDescriptor(did: (verifiedProfileDescriptor["did"] as? String) ?? "")
638
638
  }
639
639
 
640
640
  func verifiedProfileToDictionary(
641
641
  _ verifiedProfile: VCLVerifiedProfile
642
- ) -> [String: Any] {
643
- var verifiedProfileDictionary = [String: Any]()
644
- verifiedProfileDictionary["payload"] = verifiedProfile.payload
645
- verifiedProfileDictionary["id"] = verifiedProfile.id
646
- verifiedProfileDictionary["logo"] = verifiedProfile.logo
647
- verifiedProfileDictionary["name"] = verifiedProfile.name
648
- return verifiedProfileDictionary
642
+ ) -> [String: Sendable] {
643
+ var verifiedProfileDictionary = [String: Sendable]()
644
+ verifiedProfileDictionary["payload"] = verifiedProfile.payload
645
+ verifiedProfileDictionary["id"] = verifiedProfile.id
646
+ verifiedProfileDictionary["logo"] = verifiedProfile.logo
647
+ verifiedProfileDictionary["name"] = verifiedProfile.name
648
+ return verifiedProfileDictionary
649
649
  }
650
650
 
651
651
  func dictionaryToVerifiedProfile(
652
- _ verifiedProfileDictionary: [String: Any]?
652
+ _ verifiedProfileDictionary: [String: Sendable]?
653
653
  ) -> VCLVerifiedProfile {
654
- return VCLVerifiedProfile(payload: verifiedProfileDictionary?["payload"] as? [String : Any] ?? [String : Any]())
654
+ return VCLVerifiedProfile(payload: verifiedProfileDictionary?["payload"] as? [String : Sendable] ?? [String : Sendable]())
655
655
  }
656
656
 
657
657
  func dictionaryToJwtDescriptor(
658
- _ jwtDescriptorDictionary: [String: Any]
658
+ _ jwtDescriptorDictionary: [String: Sendable]
659
659
  ) -> VCLJwtDescriptor {
660
- return VCLJwtDescriptor(
661
- payload: jwtDescriptorDictionary["payload"] as? [String: Any] ?? [String: Any](),
662
- jti: jwtDescriptorDictionary["jti"] as? String ?? "",
663
- iss: jwtDescriptorDictionary["iss"] as? String ?? ""
664
- )
665
- }
666
-
667
- func didJwkToDictionary(_ didJwk: VCLDidJwk) -> [String: Any] {
668
- return [
669
- "did": didJwk.did,
670
- "publicJwk": publicJwkToDictionary(didJwk.publicJwk),
671
- "kid": didJwk.kid,
672
- "keyId": didJwk.keyId
673
- ]
674
- }
675
-
676
- func dictionaryToDidJwk(_ didJwkDictionary: [String: Any]?) -> VCLDidJwk {
677
- return VCLDidJwk(
678
- did: didJwkDictionary?["did"] as? String ?? "",
679
- publicJwk: dictionaryToPublicJwk(didJwkDictionary?["publicJwk"] as? [String : Any]),
680
- kid: didJwkDictionary?["kid"] as? String ?? "",
681
- keyId: didJwkDictionary?["keyId"] as? String ?? ""
682
- )
683
- }
684
-
685
- func dictionaryToDidJwkDescriptor(_ didJwkDescriptorDictionary: [String: Any]?) -> VCLDidJwkDescriptor {
686
- return VCLDidJwkDescriptor(
687
- signatureAlgorithm: VCLSignatureAlgorithm.fromString(value: didJwkDescriptorDictionary?["signatureAlgorithm"] as? String ?? ""),
688
- remoteCryptoServicesToken: dictionaryToToken(didJwkDescriptorDictionary?["remoteCryptoServicesToken"] as? [String: Any])
689
- )
660
+ return VCLJwtDescriptor(
661
+ payload: jwtDescriptorDictionary["payload"] as? [String: Sendable] ?? [String: Sendable](),
662
+ jti: jwtDescriptorDictionary["jti"] as? String ?? "",
663
+ iss: jwtDescriptorDictionary["iss"] as? String ?? ""
664
+ )
665
+ }
666
+
667
+ func didJwkToDictionary(_ didJwk: VCLDidJwk) -> [String: Sendable] {
668
+ return [
669
+ "did": didJwk.did,
670
+ "publicJwk": publicJwkToDictionary(didJwk.publicJwk),
671
+ "kid": didJwk.kid,
672
+ "keyId": didJwk.keyId
673
+ ]
674
+ }
675
+
676
+ func dictionaryToDidJwk(_ didJwkDictionary: [String: Sendable]?) -> VCLDidJwk {
677
+ return VCLDidJwk(
678
+ did: didJwkDictionary?["did"] as? String ?? "",
679
+ publicJwk: dictionaryToPublicJwk(didJwkDictionary?["publicJwk"] as? [String : Sendable]),
680
+ kid: didJwkDictionary?["kid"] as? String ?? "",
681
+ keyId: didJwkDictionary?["keyId"] as? String ?? ""
682
+ )
683
+ }
684
+
685
+ func dictionaryToDidJwkDescriptor(_ didJwkDescriptorDictionary: [String: Sendable]?) -> VCLDidJwkDescriptor {
686
+ return VCLDidJwkDescriptor(
687
+ signatureAlgorithm: VCLSignatureAlgorithm.fromString(value: didJwkDescriptorDictionary?["signatureAlgorithm"] as? String ?? ""),
688
+ remoteCryptoServicesToken: dictionaryToToken(didJwkDescriptorDictionary?["remoteCryptoServicesToken"] as? [String: Sendable])
689
+ )
690
690
  }