@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.
- package/android/src/main/java/io/velocitycareerlabs/reactnative/utlis/Converter.kt +7 -2
- package/ios/Extensions/DictionaryExtensions.swift +7 -7
- package/ios/Extensions/StringExtensions.swift +8 -8
- package/ios/GlobalConfig.swift +8 -8
- package/ios/Utils/Converter.swift +478 -478
- package/ios/Utils/VCLLog.swift +25 -25
- package/ios/VclReactNative.swift +275 -275
- package/package.json +1 -1
package/ios/Utils/VCLLog.swift
CHANGED
|
@@ -10,33 +10,33 @@
|
|
|
10
10
|
import Foundation
|
|
11
11
|
|
|
12
12
|
struct VCLLog {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
13
|
+
|
|
14
|
+
enum LogLevel: String {
|
|
15
|
+
case error = "⛔️"
|
|
16
|
+
case warning = "⚠️"
|
|
17
|
+
case debug = "💬"
|
|
18
|
+
}
|
|
19
|
+
static func d(_ info: String, level: LogLevel = .debug, file: String = #file, function: String = #function, line: Int = #line) {
|
|
20
|
+
if GlobalConfig.IsLoggerOn {
|
|
21
|
+
print("\(level.rawValue), \((file as NSString).lastPathComponent), \(line), \(function), \(GlobalConfig.LogTagPrefix + info)")
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static func w(_ warning: String, level: LogLevel = .warning, file: String = #file, function: String = #function, line: Int = #line) {
|
|
26
|
+
if GlobalConfig.IsLoggerOn {
|
|
27
|
+
print("\(level.rawValue), \((file as NSString).lastPathComponent), \(line), \(function), \(GlobalConfig.LogTagPrefix + warning)")
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static func e(_ error: Error, level: LogLevel = .error, file: String = #file, function: String = #function, line: Int = #line) {
|
|
32
|
+
if GlobalConfig.IsLoggerOn {
|
|
33
|
+
VCLLog.e("\(error)", level: level, file: file, function: function, line: line)
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static func e(_ error: String, level: LogLevel = .error, file: String = #file, function: String = #function, line: Int = #line) {
|
|
38
|
+
if GlobalConfig.IsLoggerOn {
|
|
39
|
+
print("\(level.rawValue), \((file as NSString).lastPathComponent), \(line), \(function), \(GlobalConfig.LogTagPrefix + error)")
|
|
41
40
|
}
|
|
41
|
+
}
|
|
42
42
|
}
|
package/ios/VclReactNative.swift
CHANGED
|
@@ -8,283 +8,283 @@ import VCL
|
|
|
8
8
|
|
|
9
9
|
@objc(VclReactNative)
|
|
10
10
|
class VclReactNative: NSObject {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
|
|
12
|
+
private let vcl = VCLProvider.vclInstance()
|
|
13
|
+
|
|
14
|
+
private func initGlobalConfigurations(
|
|
15
|
+
_ initializationDescriptor: VCLInitializationDescriptor
|
|
16
|
+
) {
|
|
17
|
+
GlobalConfig.CurrentEnvironment = initializationDescriptor.environment
|
|
18
|
+
GlobalConfig.IsDebugOn = initializationDescriptor.isDebugOn
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@objc(initialize:withResolver:withRejecter:)
|
|
22
|
+
func initialize(
|
|
23
|
+
initializationDescriptorDictionary: [String: Sendable],
|
|
24
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
25
|
+
) {
|
|
26
|
+
let initializationDescriptor = dictionaryToInitializationDescriptor(initializationDescriptorDictionary)
|
|
27
|
+
initGlobalConfigurations(initializationDescriptor)
|
|
28
|
+
vcl.initialize(
|
|
29
|
+
initializationDescriptor: initializationDescriptor,
|
|
30
|
+
successHandler: {
|
|
31
|
+
resolve("VCL initialization succeed!")
|
|
32
|
+
},
|
|
33
|
+
errorHandler: {
|
|
34
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@objc(getCountries:withRejecter:)
|
|
39
|
+
func getCountries(
|
|
40
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
41
|
+
) {
|
|
42
|
+
if let countries = vcl.countries {
|
|
43
|
+
resolve(countriesToDictionary(countries))
|
|
44
|
+
} else {
|
|
45
|
+
let message = "Countries not found"
|
|
46
|
+
reject(nil, message, VCLError(message: message))
|
|
19
47
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
resolve("VCL initialization succeed!")
|
|
32
|
-
},
|
|
33
|
-
errorHandler: {
|
|
34
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
35
|
-
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@objc(getCredentialTypeSchemas:withRejecter:)
|
|
51
|
+
func getCredentialTypeSchemas(
|
|
52
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
53
|
+
) {
|
|
54
|
+
if let credentialTypeSchemas = vcl.credentialTypeSchemas {
|
|
55
|
+
resolve(credentialTypeSchemasToDictionary(credentialTypeSchemas))
|
|
56
|
+
} else {
|
|
57
|
+
let message = "Credential Type Schemas not found"
|
|
58
|
+
reject(nil, message, VCLError(message: message))
|
|
36
59
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@objc(getCredentialTypes:withRejecter:)
|
|
63
|
+
func getCredentialTypes(
|
|
64
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
65
|
+
) {
|
|
66
|
+
if let credentialTypes = vcl.credentialTypes {
|
|
67
|
+
resolve(credentialTypesToDictionary(credentialTypes))
|
|
68
|
+
} else {
|
|
69
|
+
let message = "Credential Types not found"
|
|
70
|
+
reject(nil, message, VCLError(message: message))
|
|
48
71
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
resolve
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
errorHandler: {
|
|
133
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
@objc(getCredentialManifest:withResolver:withRejecter:)
|
|
138
|
-
func getCredentialManifest(
|
|
139
|
-
credentialManifestDescriptorDictionary: [String: Any],
|
|
140
|
-
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
141
|
-
) {
|
|
142
|
-
VCLLog.d("credentialManifestDescriptorDictionary dictionary: \(credentialManifestDescriptorDictionary)")
|
|
143
|
-
if let credentialManifestDescriptor = dictionaryToCredentialManifestDescriptor(credentialManifestDescriptorDictionary) {
|
|
144
|
-
VCLLog.d("credentialManifestDescriptor VCL entity: \(credentialManifestDescriptor.toPropsString())")
|
|
145
|
-
vcl.getCredentialManifest(
|
|
146
|
-
credentialManifestDescriptor: credentialManifestDescriptor,
|
|
147
|
-
successHandler: {
|
|
148
|
-
resolve(credentialManifestToDictionary($0))
|
|
149
|
-
},
|
|
150
|
-
errorHandler: {
|
|
151
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
152
|
-
})
|
|
153
|
-
} else {
|
|
154
|
-
reject(nil, "Unexpected Credential Credential Manifest Descriptor: \(credentialManifestDescriptorDictionary)", nil)
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
@objc(generateOffers:withResolver:withRejecter:)
|
|
159
|
-
func generateOffers(
|
|
160
|
-
generateOffersDescriptorDictionary: [String: Any],
|
|
161
|
-
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
162
|
-
) {
|
|
163
|
-
vcl.generateOffers(
|
|
164
|
-
generateOffersDescriptor: dictionaryToGenerateOffersDescriptor(generateOffersDescriptorDictionary),
|
|
165
|
-
successHandler: {
|
|
166
|
-
resolve(offersToDictionary($0))
|
|
167
|
-
},
|
|
168
|
-
errorHandler: {
|
|
169
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
170
|
-
})
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
@objc(checkForOffers:withtSessionTokenDictionary:withResolver:withRejecter:)
|
|
174
|
-
func checkForOffers(
|
|
175
|
-
generateOffersDescriptorDictionary: [String: Any],
|
|
176
|
-
sessionTokenDictionary: [String: Any],
|
|
177
|
-
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
178
|
-
) {
|
|
179
|
-
vcl.checkForOffers(
|
|
180
|
-
generateOffersDescriptor: dictionaryToGenerateOffersDescriptor(generateOffersDescriptorDictionary),
|
|
181
|
-
sessionToken: dictionaryToToken(sessionTokenDictionary),
|
|
182
|
-
successHandler: {
|
|
183
|
-
resolve(offersToDictionary($0))
|
|
184
|
-
},
|
|
185
|
-
errorHandler: {
|
|
186
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
187
|
-
})
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
@objc(finalizeOffers:withSessionTokenDictionary:withResolver:withRejecter:)
|
|
191
|
-
func finalizeOffers(
|
|
192
|
-
finalizeOffersDescriptorDictionary: [String: Any],
|
|
193
|
-
sessionTokenDictionary: [String: Any],
|
|
194
|
-
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
195
|
-
) {
|
|
196
|
-
vcl.finalizeOffers(
|
|
197
|
-
finalizeOffersDescriptor: dictionaryToFinalizedOffersDescriptor(finalizeOffersDescriptorDictionary),
|
|
198
|
-
sessionToken: dictionaryToToken(sessionTokenDictionary),
|
|
199
|
-
successHandler: {
|
|
200
|
-
resolve(jwtVerifiableCredentialsToDictionary($0))
|
|
201
|
-
},
|
|
202
|
-
errorHandler: {
|
|
203
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
204
|
-
})
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
@objc(getCredentialTypesUIFormSchema:withResolver:withRejecter:)
|
|
208
|
-
func getCredentialTypesUIFormSchema(
|
|
209
|
-
credentialTypesUIFormSchemaDescriptorDictionary: [String: Any],
|
|
210
|
-
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
211
|
-
) {
|
|
212
|
-
vcl.getCredentialTypesUIFormSchema(
|
|
213
|
-
credentialTypesUIFormSchemaDescriptor: readableMapToCredentialTypesUIFormSchemaDescriptor(credentialTypesUIFormSchemaDescriptorDictionary),
|
|
214
|
-
successHandler: {
|
|
215
|
-
resolve(credentialTypesFormSchemaToDictionary($0))
|
|
216
|
-
},
|
|
217
|
-
errorHandler: {
|
|
218
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
219
|
-
}
|
|
220
|
-
)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
@objc(getVerifiedProfile:withResolver:withRejecter:)
|
|
224
|
-
func getVerifiedProfile(
|
|
225
|
-
verifiedProfileDescriptorDictionary: [String: Any],
|
|
226
|
-
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
227
|
-
) {
|
|
228
|
-
vcl.getVerifiedProfile(
|
|
229
|
-
verifiedProfileDescriptor: dictionaryToVerifiedProfileDescriptor(verifiedProfileDescriptorDictionary),
|
|
230
|
-
successHandler: {
|
|
231
|
-
resolve(verifiedProfileToDictionary($0))
|
|
232
|
-
},
|
|
233
|
-
errorHandler: {
|
|
234
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
235
|
-
})
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
@objc(verifyJwt:withPublicJwkDictionary:withRemoteCryptoServicesTokenDictionary:withResolver:withRejecter:)
|
|
239
|
-
func verifyJwt(
|
|
240
|
-
jwtDictionary: [String: Any],
|
|
241
|
-
publicJwkDictionary: [String: Any],
|
|
242
|
-
remoteCryptoServicesTokenDictionary: [String: Any]? = nil,
|
|
243
|
-
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
244
|
-
) {
|
|
245
|
-
vcl.verifyJwt(
|
|
246
|
-
jwt: dictionaryToJwt(jwtDictionary),
|
|
247
|
-
publicJwk: dictionaryToPublicJwk(publicJwkDictionary),
|
|
248
|
-
remoteCryptoServicesToken: dictionaryToToken(remoteCryptoServicesTokenDictionary),
|
|
249
|
-
successHandler: {
|
|
250
|
-
resolve($0)
|
|
251
|
-
},
|
|
252
|
-
errorHandler: {
|
|
253
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
254
|
-
})
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
@objc(generateSignedJwt:withDidJwkDictionary:withRemoteCryptoServicesTokenDictionary:withResolver:withRejecter:)
|
|
258
|
-
func generateSignedJwt(
|
|
259
|
-
jwtDescriptorDictionary: [String: Any],
|
|
260
|
-
didJwkDictionary: [String: Any],
|
|
261
|
-
remoteCryptoServicesTokenDictionary: [String: Any]? = nil,
|
|
262
|
-
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
263
|
-
) {
|
|
264
|
-
vcl.generateSignedJwt(
|
|
265
|
-
jwtDescriptor: dictionaryToJwtDescriptor(jwtDescriptorDictionary),
|
|
266
|
-
didJwk: dictionaryToDidJwk(didJwkDictionary),
|
|
267
|
-
remoteCryptoServicesToken: dictionaryToToken(remoteCryptoServicesTokenDictionary),
|
|
268
|
-
successHandler: {
|
|
269
|
-
resolve(jwtToDictionary($0))
|
|
270
|
-
},
|
|
271
|
-
errorHandler: {
|
|
272
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
273
|
-
})
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
@objc(generateDidJwk:withResolver:withRejecter:)
|
|
277
|
-
func generateDidJwk(
|
|
278
|
-
didJwkDescriptorDictionary: [String: Any]? = nil,
|
|
279
|
-
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
280
|
-
) {
|
|
281
|
-
vcl.generateDidJwk(
|
|
282
|
-
didJwkDescriptor: dictionaryToDidJwkDescriptor(didJwkDescriptorDictionary),
|
|
283
|
-
successHandler: {
|
|
284
|
-
resolve(didJwkToDictionary($0))
|
|
285
|
-
},
|
|
286
|
-
errorHandler: {
|
|
287
|
-
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
288
|
-
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@objc(getPresentationRequest:withResolver:withRejecter:)
|
|
75
|
+
func getPresentationRequest(
|
|
76
|
+
presentationRequestDescriptorDictionary: [String: Sendable],
|
|
77
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
78
|
+
) {
|
|
79
|
+
vcl.getPresentationRequest(
|
|
80
|
+
presentationRequestDescriptor: dictionaryTopPresentationRequestDescriptor(presentationRequestDescriptorDictionary),
|
|
81
|
+
successHandler: {
|
|
82
|
+
resolve(presentationRequestToDictionary($0))
|
|
83
|
+
},
|
|
84
|
+
errorHandler: {
|
|
85
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@objc(submitPresentation:withResolver:withRejecter:)
|
|
91
|
+
func submitPresentation(
|
|
92
|
+
presentationSubmissionDictionary: [String: Sendable],
|
|
93
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
94
|
+
) {
|
|
95
|
+
vcl.submitPresentation(
|
|
96
|
+
presentationSubmission: dictionaryToPresentationSubmission(
|
|
97
|
+
presentationSubmissionDictionary
|
|
98
|
+
),
|
|
99
|
+
successHandler: {
|
|
100
|
+
resolve(presentationSubmissionResultToDictionary($0))
|
|
101
|
+
},
|
|
102
|
+
errorHandler: {
|
|
103
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@objc(getExchangeProgress:withResolver:withRejecter:)
|
|
108
|
+
func getExchangeProgress(
|
|
109
|
+
exchangeDescriptorDictionary: [String: Sendable],
|
|
110
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
111
|
+
) {
|
|
112
|
+
vcl.getExchangeProgress(
|
|
113
|
+
exchangeDescriptor: dictionaryToExchangeDescriptor(exchangeDescriptorDictionary),
|
|
114
|
+
successHandler: {
|
|
115
|
+
resolve(exchangeToDictionary($0))
|
|
116
|
+
},
|
|
117
|
+
errorHandler: {
|
|
118
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@objc(searchForOrganizations:withResolver:withRejecter:)
|
|
123
|
+
func searchForOrganizations(
|
|
124
|
+
organizationsSearchDescriptorDictionary: [String: Sendable],
|
|
125
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
126
|
+
) {
|
|
127
|
+
vcl.searchForOrganizations(
|
|
128
|
+
organizationsSearchDescriptor: dictionayToOrganizationsSearchDescriptor(organizationsSearchDescriptorDictionary),
|
|
129
|
+
successHandler: {
|
|
130
|
+
resolve(organizationsToDictionary($0))
|
|
131
|
+
},
|
|
132
|
+
errorHandler: {
|
|
133
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@objc(getCredentialManifest:withResolver:withRejecter:)
|
|
138
|
+
func getCredentialManifest(
|
|
139
|
+
credentialManifestDescriptorDictionary: [String: Sendable],
|
|
140
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
141
|
+
) {
|
|
142
|
+
VCLLog.d("credentialManifestDescriptorDictionary dictionary: \(credentialManifestDescriptorDictionary)")
|
|
143
|
+
if let credentialManifestDescriptor = dictionaryToCredentialManifestDescriptor(credentialManifestDescriptorDictionary) {
|
|
144
|
+
VCLLog.d("credentialManifestDescriptor VCL entity: \(credentialManifestDescriptor.toPropsString())")
|
|
145
|
+
vcl.getCredentialManifest(
|
|
146
|
+
credentialManifestDescriptor: credentialManifestDescriptor,
|
|
147
|
+
successHandler: {
|
|
148
|
+
resolve(credentialManifestToDictionary($0))
|
|
149
|
+
},
|
|
150
|
+
errorHandler: {
|
|
151
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
152
|
+
})
|
|
153
|
+
} else {
|
|
154
|
+
reject(nil, "Unexpected Credential Credential Manifest Descriptor: \(credentialManifestDescriptorDictionary)", nil)
|
|
289
155
|
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@objc(generateOffers:withResolver:withRejecter:)
|
|
159
|
+
func generateOffers(
|
|
160
|
+
generateOffersDescriptorDictionary: [String: Sendable],
|
|
161
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
162
|
+
) {
|
|
163
|
+
vcl.generateOffers(
|
|
164
|
+
generateOffersDescriptor: dictionaryToGenerateOffersDescriptor(generateOffersDescriptorDictionary),
|
|
165
|
+
successHandler: {
|
|
166
|
+
resolve(offersToDictionary($0))
|
|
167
|
+
},
|
|
168
|
+
errorHandler: {
|
|
169
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@objc(checkForOffers:withtSessionTokenDictionary:withResolver:withRejecter:)
|
|
174
|
+
func checkForOffers(
|
|
175
|
+
generateOffersDescriptorDictionary: [String: Sendable],
|
|
176
|
+
sessionTokenDictionary: [String: Sendable],
|
|
177
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
178
|
+
) {
|
|
179
|
+
vcl.checkForOffers(
|
|
180
|
+
generateOffersDescriptor: dictionaryToGenerateOffersDescriptor(generateOffersDescriptorDictionary),
|
|
181
|
+
sessionToken: dictionaryToToken(sessionTokenDictionary),
|
|
182
|
+
successHandler: {
|
|
183
|
+
resolve(offersToDictionary($0))
|
|
184
|
+
},
|
|
185
|
+
errorHandler: {
|
|
186
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
@objc(finalizeOffers:withSessionTokenDictionary:withResolver:withRejecter:)
|
|
191
|
+
func finalizeOffers(
|
|
192
|
+
finalizeOffersDescriptorDictionary: [String: Sendable],
|
|
193
|
+
sessionTokenDictionary: [String: Sendable],
|
|
194
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
195
|
+
) {
|
|
196
|
+
vcl.finalizeOffers(
|
|
197
|
+
finalizeOffersDescriptor: dictionaryToFinalizedOffersDescriptor(finalizeOffersDescriptorDictionary),
|
|
198
|
+
sessionToken: dictionaryToToken(sessionTokenDictionary),
|
|
199
|
+
successHandler: {
|
|
200
|
+
resolve(jwtVerifiableCredentialsToDictionary($0))
|
|
201
|
+
},
|
|
202
|
+
errorHandler: {
|
|
203
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@objc(getCredentialTypesUIFormSchema:withResolver:withRejecter:)
|
|
208
|
+
func getCredentialTypesUIFormSchema(
|
|
209
|
+
credentialTypesUIFormSchemaDescriptorDictionary: [String: Sendable],
|
|
210
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
211
|
+
) {
|
|
212
|
+
vcl.getCredentialTypesUIFormSchema(
|
|
213
|
+
credentialTypesUIFormSchemaDescriptor: readableMapToCredentialTypesUIFormSchemaDescriptor(credentialTypesUIFormSchemaDescriptorDictionary),
|
|
214
|
+
successHandler: {
|
|
215
|
+
resolve(credentialTypesFormSchemaToDictionary($0))
|
|
216
|
+
},
|
|
217
|
+
errorHandler: {
|
|
218
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@objc(getVerifiedProfile:withResolver:withRejecter:)
|
|
224
|
+
func getVerifiedProfile(
|
|
225
|
+
verifiedProfileDescriptorDictionary: [String: Sendable],
|
|
226
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
227
|
+
) {
|
|
228
|
+
vcl.getVerifiedProfile(
|
|
229
|
+
verifiedProfileDescriptor: dictionaryToVerifiedProfileDescriptor(verifiedProfileDescriptorDictionary),
|
|
230
|
+
successHandler: {
|
|
231
|
+
resolve(verifiedProfileToDictionary($0))
|
|
232
|
+
},
|
|
233
|
+
errorHandler: {
|
|
234
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
235
|
+
})
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@objc(verifyJwt:withPublicJwkDictionary:withRemoteCryptoServicesTokenDictionary:withResolver:withRejecter:)
|
|
239
|
+
func verifyJwt(
|
|
240
|
+
jwtDictionary: [String: Sendable],
|
|
241
|
+
publicJwkDictionary: [String: Sendable],
|
|
242
|
+
remoteCryptoServicesTokenDictionary: [String: Sendable]? = nil,
|
|
243
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
244
|
+
) {
|
|
245
|
+
vcl.verifyJwt(
|
|
246
|
+
jwt: dictionaryToJwt(jwtDictionary),
|
|
247
|
+
publicJwk: dictionaryToPublicJwk(publicJwkDictionary),
|
|
248
|
+
remoteCryptoServicesToken: dictionaryToToken(remoteCryptoServicesTokenDictionary),
|
|
249
|
+
successHandler: {
|
|
250
|
+
resolve($0)
|
|
251
|
+
},
|
|
252
|
+
errorHandler: {
|
|
253
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
254
|
+
})
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
@objc(generateSignedJwt:withDidJwkDictionary:withRemoteCryptoServicesTokenDictionary:withResolver:withRejecter:)
|
|
258
|
+
func generateSignedJwt(
|
|
259
|
+
jwtDescriptorDictionary: [String: Sendable],
|
|
260
|
+
didJwkDictionary: [String: Sendable],
|
|
261
|
+
remoteCryptoServicesTokenDictionary: [String: Sendable]? = nil,
|
|
262
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
263
|
+
) {
|
|
264
|
+
vcl.generateSignedJwt(
|
|
265
|
+
jwtDescriptor: dictionaryToJwtDescriptor(jwtDescriptorDictionary),
|
|
266
|
+
didJwk: dictionaryToDidJwk(didJwkDictionary),
|
|
267
|
+
remoteCryptoServicesToken: dictionaryToToken(remoteCryptoServicesTokenDictionary),
|
|
268
|
+
successHandler: {
|
|
269
|
+
resolve(jwtToDictionary($0))
|
|
270
|
+
},
|
|
271
|
+
errorHandler: {
|
|
272
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@objc(generateDidJwk:withResolver:withRejecter:)
|
|
277
|
+
func generateDidJwk(
|
|
278
|
+
didJwkDescriptorDictionary: [String: Sendable]? = nil,
|
|
279
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
280
|
+
) {
|
|
281
|
+
vcl.generateDidJwk(
|
|
282
|
+
didJwkDescriptor: dictionaryToDidJwkDescriptor(didJwkDescriptorDictionary),
|
|
283
|
+
successHandler: {
|
|
284
|
+
resolve(didJwkToDictionary($0))
|
|
285
|
+
},
|
|
286
|
+
errorHandler: {
|
|
287
|
+
reject(nil, $0.toDictionary().toJsonString(), $0)
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
290
|
}
|