@procivis/react-native-one-core 1.41710.0 → 1.43299.1
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/ch/procivis/one/core/DeserializeSpecific.kt +1 -1
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +37 -4
- package/android/src/main/java/ch/procivis/one/core/Serialize.kt +3 -1
- package/android/src/main/java/ch/procivis/one/core/SerializeSpecific.kt +13 -0
- package/core-sdk.json +6 -6
- package/dist/src/config.d.ts +3 -1
- package/dist/src/core.d.ts +9 -3
- package/dist/src/core.js +5 -0
- package/dist/src/credential.d.ts +6 -2
- package/dist/src/history.d.ts +5 -2
- package/dist/src/history.js +3 -0
- package/dist/src/identifier.d.ts +132 -0
- package/dist/src/identifier.js +29 -0
- package/dist/src/proof.d.ts +9 -4
- package/ios/Deserialize.swift +140 -813
- package/ios/EventEmitter.swift +84 -72
- package/ios/ProcivisOneCoreModule.m +19 -1
- package/ios/ProcivisOneCoreModule.swift +986 -806
- package/ios/ProcivisRNOneCore.xcodeproj/project.pbxproj +9 -1
- package/ios/RNDecoder/RNDecoder.swift +191 -0
- package/ios/RNDecoder/RNDecodingStorage.swift +33 -0
- package/ios/RNDecoder/RNKeyedDecodingContainer.swift +133 -0
- package/ios/RNDecoder/RNUnkeyedDecodingContainer.swift +175 -0
- package/ios/RNEncoder/RNAnyCodingKey.swift +31 -0
- package/ios/RNEncoder/RNEncoder.swift +95 -0
- package/ios/RNEncoder/RNKeyedEncodingContainer.swift +81 -0
- package/ios/RNEncoder/RNSingleValueEncodingContainer.swift +78 -0
- package/ios/RNEncoder/RNUnkeyedEncodingContainer.swift +84 -0
- package/ios/Serialize.swift +43 -613
- package/ios/Util.swift +35 -25
- package/package.json +2 -2
package/ios/Serialize.swift
CHANGED
|
@@ -8,64 +8,53 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
import ProcivisOneCore
|
|
10
10
|
|
|
11
|
+
func serializeAny<T: Encodable>(_ value: T) throws -> Any {
|
|
12
|
+
let encoder = RNEncoder()
|
|
13
|
+
encoder.userInfo[customEncoderKey] = serializeSpecific as CustomEncoder
|
|
14
|
+
return try encoder.encode(value)
|
|
15
|
+
}
|
|
16
|
+
|
|
11
17
|
// Enum values serialization
|
|
12
18
|
func serializeEnumValue<T>(value: T) -> String {
|
|
13
|
-
|
|
19
|
+
return String(describing: value).snakeCased()
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
private let snakeCaseRegex = try! NSRegularExpression(pattern: "([a-z0-9])([A-Z])", options: [])
|
|
17
23
|
extension String {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
private func
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
func snakeCased() -> String {
|
|
25
|
+
let range = NSRange(location: 0, length: count)
|
|
26
|
+
return snakeCaseRegex.stringByReplacingMatches(in: self, options: [], range: range, withTemplate: "$1_$2").uppercased()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private func serializeSpecific(_ value: Encodable) throws -> Any? {
|
|
31
|
+
switch value {
|
|
32
|
+
case let data as HistoryMetadataBinding:
|
|
33
|
+
return try serialize(historyMetadata: data)
|
|
34
|
+
case let data as CredentialSchemaTypeBindingEnum:
|
|
35
|
+
return serialize(credentialSchemaType: data)
|
|
36
|
+
case let data as ClaimValueBindingDto:
|
|
37
|
+
return try serialize(claimValue: data)
|
|
38
|
+
case let data as ProofRequestClaimValueBindingDto:
|
|
39
|
+
return try serialize(proofRequestClaimValue: data)
|
|
40
|
+
case let data as HandleInvitationResponseBindingEnum:
|
|
41
|
+
return try serialize(invitationResponse: data)
|
|
42
|
+
|
|
43
|
+
default:
|
|
44
|
+
return nil
|
|
27
45
|
}
|
|
28
|
-
return serialize(value!)
|
|
29
46
|
}
|
|
30
47
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
private func serialize(historyMetadata: HistoryMetadataBinding) throws -> Any {
|
|
49
|
+
switch (historyMetadata) {
|
|
50
|
+
case let .unexportableEntities(value):
|
|
51
|
+
return try serializeAny(value);
|
|
52
|
+
case let .errorMetadata(value):
|
|
53
|
+
return try serializeAny(value);
|
|
36
54
|
}
|
|
37
55
|
}
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
func serialize(version: VersionBindingDto) -> NSDictionary {
|
|
41
|
-
return [
|
|
42
|
-
"target": version.target,
|
|
43
|
-
"buildTime": version.buildTime,
|
|
44
|
-
"branch": version.branch,
|
|
45
|
-
"tag": version.tag,
|
|
46
|
-
"commit": version.commit,
|
|
47
|
-
"rustVersion": version.rustVersion,
|
|
48
|
-
"pipelineId": version.pipelineId
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
func serialize(config: ConfigBindingDto) -> NSDictionary {
|
|
53
|
-
return [
|
|
54
|
-
"format": config.format,
|
|
55
|
-
"issuanceProtocol": config.issuanceProtocol,
|
|
56
|
-
"verificationProtocol": config.verificationProtocol,
|
|
57
|
-
"transport": config.transport,
|
|
58
|
-
"revocation": config.revocation,
|
|
59
|
-
"did": config.did,
|
|
60
|
-
"datatype": config.datatype,
|
|
61
|
-
"keyAlgorithm": config.keyAlgorithm,
|
|
62
|
-
"keyStorage": config.keyStorage,
|
|
63
|
-
"trustManagement": config.trustManagement,
|
|
64
|
-
"cacheEntities": config.cacheEntities,
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
func serialize(credentialSchemaType: CredentialSchemaTypeBindingEnum) -> String {
|
|
57
|
+
private func serialize(credentialSchemaType: CredentialSchemaTypeBindingEnum) -> String {
|
|
69
58
|
switch (credentialSchemaType) {
|
|
70
59
|
case .procivisOneSchema2024:
|
|
71
60
|
return "PROCIVIS_ONE_SCHEMA2024";
|
|
@@ -80,101 +69,7 @@ func serialize(credentialSchemaType: CredentialSchemaTypeBindingEnum) -> String
|
|
|
80
69
|
}
|
|
81
70
|
}
|
|
82
71
|
|
|
83
|
-
func serialize(
|
|
84
|
-
var result: [String: Any] = [
|
|
85
|
-
"id": credentialSchema.id,
|
|
86
|
-
"createdDate": credentialSchema.createdDate,
|
|
87
|
-
"lastModified": credentialSchema.lastModified,
|
|
88
|
-
"name": credentialSchema.name,
|
|
89
|
-
"format": credentialSchema.format,
|
|
90
|
-
"revocationMethod": credentialSchema.revocationMethod,
|
|
91
|
-
"schemaId": credentialSchema.schemaId,
|
|
92
|
-
"importedSourceUrl": credentialSchema.importedSourceUrl,
|
|
93
|
-
"schemaType": serialize(credentialSchemaType: credentialSchema.schemaType)
|
|
94
|
-
]
|
|
95
|
-
result.addOpt("walletStorageType", opt(credentialSchema.walletStorageType, serializeEnumValue))
|
|
96
|
-
result.addOpt("layoutType", opt(credentialSchema.layoutType, serializeEnumValue))
|
|
97
|
-
result.addOpt("layoutProperties", opt(credentialSchema.layoutProperties, {properties in serialize(layoutProperties: properties)}))
|
|
98
|
-
return result as NSDictionary
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
func serialize(credentialSchemaDetail: CredentialSchemaDetailBindingDto) -> NSDictionary {
|
|
102
|
-
var result: [String: Any] = [
|
|
103
|
-
"id": credentialSchemaDetail.id,
|
|
104
|
-
"createdDate": credentialSchemaDetail.createdDate,
|
|
105
|
-
"lastModified": credentialSchemaDetail.lastModified,
|
|
106
|
-
"name": credentialSchemaDetail.name,
|
|
107
|
-
"format": credentialSchemaDetail.format,
|
|
108
|
-
"revocationMethod": credentialSchemaDetail.revocationMethod,
|
|
109
|
-
"schemaId": credentialSchemaDetail.schemaId,
|
|
110
|
-
"importedSourceUrl": credentialSchemaDetail.importedSourceUrl,
|
|
111
|
-
"schemaType": serialize(credentialSchemaType: credentialSchemaDetail.schemaType),
|
|
112
|
-
"claims": credentialSchemaDetail.claims.map { serialize(claimSchema: $0) }
|
|
113
|
-
]
|
|
114
|
-
result.addOpt("walletStorageType", opt(credentialSchemaDetail.walletStorageType, serializeEnumValue))
|
|
115
|
-
result.addOpt("layoutType", opt(credentialSchemaDetail.layoutType, serializeEnumValue))
|
|
116
|
-
result.addOpt("layoutProperties", opt(credentialSchemaDetail.layoutProperties, {properties in serialize(layoutProperties: properties)}))
|
|
117
|
-
|
|
118
|
-
return result as NSDictionary
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
func serialize(claimSchema: CredentialClaimSchemaBindingDto) -> NSDictionary {
|
|
122
|
-
return [
|
|
123
|
-
"id": claimSchema.id,
|
|
124
|
-
"createdDate": claimSchema.createdDate,
|
|
125
|
-
"lastModified": claimSchema.lastModified,
|
|
126
|
-
"required": claimSchema.required,
|
|
127
|
-
"key": claimSchema.key,
|
|
128
|
-
"array": claimSchema.array,
|
|
129
|
-
"datatype": claimSchema.datatype,
|
|
130
|
-
"claims": claimSchema.claims.map { serialize(claimSchema: $0) }
|
|
131
|
-
]
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
func serialize(layoutProperties: CredentialSchemaLayoutPropertiesBindingDto) -> NSDictionary {
|
|
135
|
-
var result: [String: Any] = [:]
|
|
136
|
-
result.addOpt("background", opt(layoutProperties.background, {background in serialize(backgroundProperties: background)}))
|
|
137
|
-
result.addOpt("logo", opt(layoutProperties.logo, {logo in serialize(logoProperties: logo)}))
|
|
138
|
-
result.addOpt("primaryAttribute", layoutProperties.primaryAttribute)
|
|
139
|
-
result.addOpt("secondaryAttribute", layoutProperties.secondaryAttribute)
|
|
140
|
-
result.addOpt("pictureAttribute", layoutProperties.pictureAttribute)
|
|
141
|
-
result.addOpt("code", opt(layoutProperties.code, {code in serialize(codeProperties: code)}))
|
|
142
|
-
return result as NSDictionary
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
func serialize(backgroundProperties: CredentialSchemaBackgroundPropertiesBindingDto) -> NSDictionary {
|
|
146
|
-
var result: [String: Any] = [:]
|
|
147
|
-
result.addOpt("color", backgroundProperties.color)
|
|
148
|
-
result.addOpt("image", backgroundProperties.image)
|
|
149
|
-
return result as NSDictionary
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
func serialize(logoProperties: CredentialSchemaLogoPropertiesBindingDto) -> NSDictionary {
|
|
153
|
-
var result: [String: Any] = [:]
|
|
154
|
-
result.addOpt("fontColor", logoProperties.fontColor)
|
|
155
|
-
result.addOpt("backgroundColor", logoProperties.backgroundColor)
|
|
156
|
-
result.addOpt("image", logoProperties.image)
|
|
157
|
-
return result as NSDictionary
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
func serialize(codeProperties: CredentialSchemaCodePropertiesBindingDto) -> NSDictionary {
|
|
161
|
-
return [
|
|
162
|
-
"attribute": codeProperties.attribute,
|
|
163
|
-
"type": serializeEnumValue(value: codeProperties.type),
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
func serialize(claim: ClaimBindingDto) -> NSDictionary {
|
|
168
|
-
return [
|
|
169
|
-
"id": claim.id,
|
|
170
|
-
"key": claim.key,
|
|
171
|
-
"dataType": claim.dataType,
|
|
172
|
-
"array": claim.array,
|
|
173
|
-
"value": serialize(claimValue: claim.value),
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
func serialize(claimValue: ClaimValueBindingDto) -> Any {
|
|
72
|
+
private func serialize(claimValue: ClaimValueBindingDto) throws -> Any {
|
|
178
73
|
switch (claimValue) {
|
|
179
74
|
case let .boolean(value):
|
|
180
75
|
return value;
|
|
@@ -185,384 +80,29 @@ func serialize(claimValue: ClaimValueBindingDto) -> Any {
|
|
|
185
80
|
case let .string(value):
|
|
186
81
|
return value;
|
|
187
82
|
case .nested(value: let values):
|
|
188
|
-
return values.map {
|
|
83
|
+
return try values.map { try serializeAny($0) }
|
|
189
84
|
}
|
|
190
85
|
}
|
|
191
86
|
|
|
192
|
-
func serialize(
|
|
193
|
-
var result: [String: Any] = [
|
|
194
|
-
"id": credentialListItem.id,
|
|
195
|
-
"createdDate": credentialListItem.createdDate,
|
|
196
|
-
"issuanceDate": credentialListItem.issuanceDate,
|
|
197
|
-
"lastModified": credentialListItem.lastModified,
|
|
198
|
-
"state": serializeEnumValue(value: credentialListItem.state),
|
|
199
|
-
"schema": serialize(credentialSchema: credentialListItem.schema),
|
|
200
|
-
"role": serializeEnumValue(value: credentialListItem.role),
|
|
201
|
-
"exchange": credentialListItem.exchange,
|
|
202
|
-
]
|
|
203
|
-
result.addOpt("revocationDate", credentialListItem.revocationDate)
|
|
204
|
-
result.addOpt("issuerDid", credentialListItem.issuerDid)
|
|
205
|
-
result.addOpt("suspendEndDate", credentialListItem.suspendEndDate)
|
|
206
|
-
return result as NSDictionary
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
func serialize(credentialDetail: CredentialDetailBindingDto) -> NSDictionary {
|
|
210
|
-
var result: [String: Any] = [
|
|
211
|
-
"id": credentialDetail.id,
|
|
212
|
-
"createdDate": credentialDetail.createdDate,
|
|
213
|
-
"issuanceDate": credentialDetail.issuanceDate,
|
|
214
|
-
"lastModified": credentialDetail.lastModified,
|
|
215
|
-
"state": serializeEnumValue(value: credentialDetail.state),
|
|
216
|
-
"claims": credentialDetail.claims.map { serialize(claim: $0) },
|
|
217
|
-
"schema": serialize(credentialSchema: credentialDetail.schema),
|
|
218
|
-
"role": serializeEnumValue(value: credentialDetail.role),
|
|
219
|
-
"exchange": credentialDetail.exchange,
|
|
220
|
-
]
|
|
221
|
-
result.addOpt("revocationDate", credentialDetail.revocationDate)
|
|
222
|
-
result.addOpt("issuerDid", opt(credentialDetail.issuerDid, {issuerDid in serialize(didListItem: issuerDid)}))
|
|
223
|
-
result.addOpt("holderDid", opt(credentialDetail.holderDid, {holderDid in serialize(didListItem: holderDid)}))
|
|
224
|
-
result.addOpt("redirectUri", credentialDetail.redirectUri)
|
|
225
|
-
result.addOpt("lvvcIssuanceDate", credentialDetail.lvvcIssuanceDate)
|
|
226
|
-
result.addOpt("suspendEndDate", credentialDetail.suspendEndDate)
|
|
227
|
-
result.addOpt("mdocMsoValidity", opt(credentialDetail.mdocMsoValidity, {validity in serialize(mdocMsoValidity: validity)}) )
|
|
228
|
-
return result as NSDictionary
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
func serialize(mdocMsoValidity: MdocMsoValidityResponseBindingDto) -> NSDictionary {
|
|
232
|
-
return [
|
|
233
|
-
"expiration": mdocMsoValidity.expiration,
|
|
234
|
-
"nextUpdate": mdocMsoValidity.nextUpdate,
|
|
235
|
-
"lastUpdate": mdocMsoValidity.lastUpdate,
|
|
236
|
-
]
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
func serialize(credentialList: CredentialListBindingDto) -> NSDictionary {
|
|
240
|
-
return [
|
|
241
|
-
"totalItems": credentialList.totalItems,
|
|
242
|
-
"totalPages": credentialList.totalPages,
|
|
243
|
-
"values": credentialList.values.map { serialize(credentialListItem: $0) },
|
|
244
|
-
]
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
func serialize(didList: DidListBindingDto) -> NSDictionary {
|
|
248
|
-
return [
|
|
249
|
-
"totalItems": didList.totalItems,
|
|
250
|
-
"totalPages": didList.totalPages,
|
|
251
|
-
"values": didList.values.map { serialize(didListItem: $0) },
|
|
252
|
-
]
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
func serialize(credentialSchemaList: CredentialSchemaListBindingDto) -> NSDictionary {
|
|
256
|
-
return [
|
|
257
|
-
"totalItems": credentialSchemaList.totalItems,
|
|
258
|
-
"totalPages": credentialSchemaList.totalPages,
|
|
259
|
-
"values": credentialSchemaList.values.map { serialize(credentialSchema: $0) },
|
|
260
|
-
]
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
func serialize(proofList: ProofListBindingDto) -> NSDictionary {
|
|
264
|
-
return [
|
|
265
|
-
"totalItems": proofList.totalItems,
|
|
266
|
-
"totalPages": proofList.totalPages,
|
|
267
|
-
"values": proofList.values.map { serialize(proofListItem: $0) },
|
|
268
|
-
]
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
func serialize(proofListItem: ProofListItemBindingDto) -> NSDictionary {
|
|
272
|
-
var result: [String: Any] = [
|
|
273
|
-
"id": proofListItem.id,
|
|
274
|
-
"createdDate": proofListItem.createdDate,
|
|
275
|
-
"lastModified": proofListItem.lastModified,
|
|
276
|
-
"issuanceDate": proofListItem.issuanceDate,
|
|
277
|
-
"exchange": proofListItem.exchange,
|
|
278
|
-
"transport": proofListItem.transport,
|
|
279
|
-
"state": serializeEnumValue(value: proofListItem.state),
|
|
280
|
-
]
|
|
281
|
-
result.addOpt("requestedDate", proofListItem.requestedDate)
|
|
282
|
-
result.addOpt("completedDate", proofListItem.completedDate)
|
|
283
|
-
result.addOpt("schema", opt(proofListItem.schema, {proofSchema in serialize(proofSchemaListItem: proofSchema) }))
|
|
284
|
-
result.addOpt("verifierDid", proofListItem.verifierDid)
|
|
285
|
-
result.addOpt("retainUntilDate", proofListItem.retainUntilDate)
|
|
286
|
-
return result as NSDictionary
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
func serialize(proposeProofResponse: ProposeProofResponseBindingDto) -> NSDictionary {
|
|
290
|
-
return [
|
|
291
|
-
"proofId": proposeProofResponse.proofId,
|
|
292
|
-
"interactionId": proposeProofResponse.interactionId,
|
|
293
|
-
"url": proposeProofResponse.url,
|
|
294
|
-
]
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
func serialize(proofResponse: ProofResponseBindingDto) -> NSDictionary {
|
|
298
|
-
var result: [String: Any] = [
|
|
299
|
-
"id": proofResponse.id,
|
|
300
|
-
"createdDate": proofResponse.createdDate,
|
|
301
|
-
"lastModified": proofResponse.lastModified,
|
|
302
|
-
"proofInputs": proofResponse.proofInputs.map { serialize(proofInput: $0) },
|
|
303
|
-
"state": serializeEnumValue(value: proofResponse.state),
|
|
304
|
-
"role": serializeEnumValue(value: proofResponse.role),
|
|
305
|
-
"exchange": proofResponse.exchange,
|
|
306
|
-
"transport": proofResponse.transport,
|
|
307
|
-
]
|
|
308
|
-
result.addOpt("proofSchema", opt(proofResponse.proofSchema, {proofSchema in serialize(proofSchemaListItem: proofSchema) }))
|
|
309
|
-
result.addOpt("verifierDid", opt(proofResponse.verifierDid, {verifierDid in serialize(didListItem: verifierDid)}))
|
|
310
|
-
result.addOpt("holderDid", opt(proofResponse.holderDid, {holderDid in serialize(didListItem: holderDid)}))
|
|
311
|
-
result.addOpt("redirectUri", proofResponse.redirectUri)
|
|
312
|
-
result.addOpt("retainUntilDate", proofResponse.retainUntilDate)
|
|
313
|
-
result.addOpt("requestedDate", proofResponse.requestedDate)
|
|
314
|
-
result.addOpt("completedDate", proofResponse.completedDate)
|
|
315
|
-
result.addOpt("claimsRemovedAt", proofResponse.claimsRemovedAt)
|
|
316
|
-
return result as NSDictionary
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
func serialize(proofSchemaList: ProofSchemaListBindingDto) -> NSDictionary {
|
|
320
|
-
return [
|
|
321
|
-
"totalItems": proofSchemaList.totalItems,
|
|
322
|
-
"totalPages": proofSchemaList.totalPages,
|
|
323
|
-
"values": proofSchemaList.values.map { serialize(proofSchemaListItem: $0) },
|
|
324
|
-
]
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
func serialize(proofSchemaListItem: GetProofSchemaListItemBindingDto) -> NSDictionary {
|
|
328
|
-
var result: [String: Any] = [
|
|
329
|
-
"id": proofSchemaListItem.id,
|
|
330
|
-
"createdDate": proofSchemaListItem.createdDate,
|
|
331
|
-
"lastModified": proofSchemaListItem.lastModified,
|
|
332
|
-
"name": proofSchemaListItem.name,
|
|
333
|
-
"expireDuration": proofSchemaListItem.expireDuration
|
|
334
|
-
]
|
|
335
|
-
|
|
336
|
-
result.addOpt("deletedAt", proofSchemaListItem.deletedAt)
|
|
337
|
-
return result as NSDictionary
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
func serialize(proofSchema: GetProofSchemaBindingDto) -> NSDictionary {
|
|
341
|
-
var result: [String: Any] = [
|
|
342
|
-
"id": proofSchema.id,
|
|
343
|
-
"createdDate": proofSchema.createdDate,
|
|
344
|
-
"lastModified": proofSchema.lastModified,
|
|
345
|
-
"name": proofSchema.name,
|
|
346
|
-
"organisationId": proofSchema.organisationId,
|
|
347
|
-
"expireDuration": proofSchema.expireDuration,
|
|
348
|
-
"proofInputSchemas": proofSchema.proofInputSchemas.map { serialize(proofInputSchema: $0) }
|
|
349
|
-
]
|
|
350
|
-
result.addOpt("importedSourceUrl", proofSchema.importedSourceUrl)
|
|
351
|
-
return result as NSDictionary
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
func serialize(proofInputSchema: ProofInputSchemaBindingDto) -> NSDictionary {
|
|
355
|
-
var result: [String: Any] = [
|
|
356
|
-
"claimSchemas": proofInputSchema.claimSchemas.map { serialize(proofClaimSchema: $0) },
|
|
357
|
-
"credentialSchema": serialize(credentialSchema: proofInputSchema.credentialSchema),
|
|
358
|
-
]
|
|
359
|
-
result.addOpt("validityConstraint", proofInputSchema.validityConstraint)
|
|
360
|
-
|
|
361
|
-
return result as NSDictionary
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
func serialize(proofInput: ProofInputBindingDto) -> NSDictionary {
|
|
365
|
-
var result: [String: Any] = [
|
|
366
|
-
"claims": proofInput.claims.map { serialize(proofRequestClaim: $0) },
|
|
367
|
-
"credentialSchema": serialize(credentialSchema: proofInput.credentialSchema),
|
|
368
|
-
]
|
|
369
|
-
result.addOpt("credential", opt(proofInput.credential, { credential in serialize(credentialDetail: credential) }))
|
|
370
|
-
result.addOpt("validityConstraint", proofInput.validityConstraint)
|
|
371
|
-
return result as NSDictionary
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
func serialize(proofRequestClaim: ProofRequestClaimBindingDto) -> NSDictionary {
|
|
375
|
-
var result: [String: Any] = [
|
|
376
|
-
"schema": serialize(proofClaimSchema: proofRequestClaim.schema),
|
|
377
|
-
]
|
|
378
|
-
|
|
379
|
-
result.addOpt("value", opt(proofRequestClaim.value, { claim in serialize(proofRequestClaimValue: claim) }))
|
|
380
|
-
return result as NSDictionary
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
func serialize(proofRequestClaimValue: ProofRequestClaimValueBindingDto) -> Any {
|
|
87
|
+
private func serialize(proofRequestClaimValue: ProofRequestClaimValueBindingDto) throws -> Any {
|
|
384
88
|
switch (proofRequestClaimValue) {
|
|
385
89
|
case let .value(value):
|
|
386
90
|
return value;
|
|
387
91
|
case .claims(value: let values):
|
|
388
|
-
return values.map {
|
|
92
|
+
return try values.map { try serializeAny($0)}
|
|
389
93
|
}
|
|
390
94
|
}
|
|
391
95
|
|
|
392
|
-
func serialize(
|
|
393
|
-
return [
|
|
394
|
-
"id": proofClaimSchema.id,
|
|
395
|
-
"requested": proofClaimSchema.requested,
|
|
396
|
-
"required": proofClaimSchema.required,
|
|
397
|
-
"key": proofClaimSchema.key,
|
|
398
|
-
"dataType": proofClaimSchema.dataType,
|
|
399
|
-
"claims": proofClaimSchema.claims.map { serialize(proofClaimSchema: $0)},
|
|
400
|
-
"array": proofClaimSchema.array,
|
|
401
|
-
]
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
func serialize(presentationDefinition: PresentationDefinitionBindingDto) -> NSDictionary {
|
|
405
|
-
return [
|
|
406
|
-
"requestGroups": presentationDefinition.requestGroups.map { serialize(presentationDefinitionRequestGroup: $0) },
|
|
407
|
-
]
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
func serialize(presentationDefinitionRequestGroup: PresentationDefinitionRequestGroupBindingDto) -> NSDictionary {
|
|
411
|
-
var result: [String: Any] = [
|
|
412
|
-
"id": presentationDefinitionRequestGroup.id,
|
|
413
|
-
"rule": serialize(presentationDefinitionRule: presentationDefinitionRequestGroup.rule),
|
|
414
|
-
"requestedCredentials": presentationDefinitionRequestGroup.requestedCredentials.map { serialize(presentationDefinitionRequestedCredential: $0) },
|
|
415
|
-
]
|
|
416
|
-
result.addOpt("name", presentationDefinitionRequestGroup.name)
|
|
417
|
-
result.addOpt("purpose", presentationDefinitionRequestGroup.purpose)
|
|
418
|
-
return result as NSDictionary
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
func serialize(presentationDefinitionRequestedCredential: PresentationDefinitionRequestedCredentialBindingDto) -> NSDictionary {
|
|
422
|
-
var result: [String: Any] = [
|
|
423
|
-
"id": presentationDefinitionRequestedCredential.id,
|
|
424
|
-
"fields": presentationDefinitionRequestedCredential.fields.map { serialize(presentationDefinitionField: $0) },
|
|
425
|
-
"applicableCredentials": presentationDefinitionRequestedCredential.applicableCredentials,
|
|
426
|
-
"inapplicableCredentials": presentationDefinitionRequestedCredential.inapplicableCredentials,
|
|
427
|
-
]
|
|
428
|
-
result.addOpt("name", presentationDefinitionRequestedCredential.name)
|
|
429
|
-
result.addOpt("purpose", presentationDefinitionRequestedCredential.purpose)
|
|
430
|
-
result.addOpt("validityCredentialNbf", presentationDefinitionRequestedCredential.validityCredentialNbf)
|
|
431
|
-
return result as NSDictionary
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
func serialize(presentationDefinitionField: PresentationDefinitionFieldBindingDto) -> NSDictionary {
|
|
435
|
-
var result: [String: Any] = [
|
|
436
|
-
"id": presentationDefinitionField.id,
|
|
437
|
-
"required": presentationDefinitionField.required,
|
|
438
|
-
"keyMap": presentationDefinitionField.keyMap,
|
|
439
|
-
]
|
|
440
|
-
result.addOpt("name", presentationDefinitionField.name)
|
|
441
|
-
result.addOpt("purpose", presentationDefinitionField.purpose)
|
|
442
|
-
return result as NSDictionary
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
func serialize(presentationDefinitionRule: PresentationDefinitionRuleBindingDto) -> NSDictionary {
|
|
446
|
-
var result: [String: Any] = [
|
|
447
|
-
"type": serializeEnumValue(value: presentationDefinitionRule.type),
|
|
448
|
-
]
|
|
449
|
-
result.addOpt("min", presentationDefinitionRule.min)
|
|
450
|
-
result.addOpt("max", presentationDefinitionRule.max)
|
|
451
|
-
result.addOpt("count", presentationDefinitionRule.count)
|
|
452
|
-
return result as NSDictionary
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
func serialize(credentialRevocationCheckResponse: CredentialRevocationCheckResponseBindingDto) -> NSDictionary {
|
|
456
|
-
var result: [String: Any] = [
|
|
457
|
-
"credentialId": credentialRevocationCheckResponse.credentialId,
|
|
458
|
-
"status": serializeEnumValue(value: credentialRevocationCheckResponse.status),
|
|
459
|
-
"success": credentialRevocationCheckResponse.success,
|
|
460
|
-
]
|
|
461
|
-
result.addOpt("reason", credentialRevocationCheckResponse.reason)
|
|
462
|
-
return result as NSDictionary
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
func serialize(historyList: HistoryListBindingDto) -> NSDictionary {
|
|
466
|
-
return [
|
|
467
|
-
"totalItems": historyList.totalItems,
|
|
468
|
-
"totalPages": historyList.totalPages,
|
|
469
|
-
"values": historyList.values.map { serialize(historyListItem: $0) },
|
|
470
|
-
]
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
func serialize(historyListItem: HistoryListItemBindingDto) -> NSDictionary {
|
|
474
|
-
var result = [
|
|
475
|
-
"id": historyListItem.id,
|
|
476
|
-
"createdDate": historyListItem.createdDate,
|
|
477
|
-
"action": serializeEnumValue(value: historyListItem.action),
|
|
478
|
-
"entityType": serializeEnumValue(value: historyListItem.entityType),
|
|
479
|
-
"organisationId": historyListItem.organisationId,
|
|
480
|
-
"name": historyListItem.name,
|
|
481
|
-
]
|
|
482
|
-
result.addOpt("entityId", historyListItem.entityId)
|
|
483
|
-
result.addOpt("target", historyListItem.target)
|
|
484
|
-
result.addOpt("metadata", opt(historyListItem.metadata, {data in serialize(historyMetadata: data)}))
|
|
485
|
-
return result as NSDictionary
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
func serialize(historyMetadata: HistoryMetadataBinding) -> NSDictionary {
|
|
489
|
-
switch (historyMetadata) {
|
|
490
|
-
case let .unexportableEntities(value):
|
|
491
|
-
return serialize(unexportableEntities: value);
|
|
492
|
-
case let .errorMetadata(value):
|
|
493
|
-
return serialize(historyErrorMetadata: value);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
func serialize(historyErrorMetadata: HistoryErrorMetadataBindingDto) -> NSDictionary {
|
|
498
|
-
return [
|
|
499
|
-
"errorCode": historyErrorMetadata.errorCode,
|
|
500
|
-
"message": historyErrorMetadata.message,
|
|
501
|
-
]
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
func serialize(keyListItem: KeyListItemBindingDto) -> NSDictionary {
|
|
505
|
-
return [
|
|
506
|
-
"id": keyListItem.id,
|
|
507
|
-
"createdDate": keyListItem.createdDate,
|
|
508
|
-
"lastModified": keyListItem.lastModified,
|
|
509
|
-
"name": keyListItem.name,
|
|
510
|
-
"publicKey": keyListItem.publicKey,
|
|
511
|
-
"storageType": keyListItem.storageType,
|
|
512
|
-
"keyType": keyListItem.keyType,
|
|
513
|
-
]
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
func serialize(didListItem: DidListItemBindingDto) -> NSDictionary {
|
|
517
|
-
return [
|
|
518
|
-
"id": didListItem.id,
|
|
519
|
-
"createdDate": didListItem.createdDate,
|
|
520
|
-
"lastModified": didListItem.lastModified,
|
|
521
|
-
"name": didListItem.name,
|
|
522
|
-
"did": didListItem.did,
|
|
523
|
-
"didType": serializeEnumValue(value: didListItem.didType),
|
|
524
|
-
"didMethod": didListItem.didMethod,
|
|
525
|
-
"deactivated": didListItem.deactivated,
|
|
526
|
-
]
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
func serialize(unexportableEntities: UnexportableEntitiesBindingDto) -> NSDictionary {
|
|
530
|
-
return [
|
|
531
|
-
"credentials": unexportableEntities.credentials.map { serialize(credentialDetail: $0) },
|
|
532
|
-
"keys": unexportableEntities.keys.map { serialize(keyListItem: $0) },
|
|
533
|
-
"dids": unexportableEntities.dids.map { serialize(didListItem: $0) },
|
|
534
|
-
"totalCredentials": unexportableEntities.totalCredentials,
|
|
535
|
-
"totalKeys": unexportableEntities.totalKeys,
|
|
536
|
-
"totalDids": unexportableEntities.totalDids,
|
|
537
|
-
]
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
func serialize(backupCreate: BackupCreateBindingDto) -> NSDictionary {
|
|
541
|
-
return [
|
|
542
|
-
"historyId": backupCreate.historyId,
|
|
543
|
-
"file": backupCreate.file,
|
|
544
|
-
"unexportable": serialize(unexportableEntities: backupCreate.unexportable),
|
|
545
|
-
]
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
func serialize(importBackupMetadata: MetadataBindingDto) -> NSDictionary {
|
|
549
|
-
return [
|
|
550
|
-
"dbVersion": importBackupMetadata.dbVersion,
|
|
551
|
-
"dbHash": importBackupMetadata.dbHash,
|
|
552
|
-
"createdAt": importBackupMetadata.createdAt,
|
|
553
|
-
]
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
func serialize(invitationResponse: HandleInvitationResponseBindingEnum) -> NSDictionary {
|
|
96
|
+
private func serialize(invitationResponse: HandleInvitationResponseBindingEnum) throws -> NSDictionary {
|
|
557
97
|
switch (invitationResponse) {
|
|
558
98
|
case let .credentialIssuance(interactionId, credentialIds, txCode):
|
|
559
99
|
var result: [String: Any] = [
|
|
560
100
|
"interactionId": interactionId,
|
|
561
101
|
"credentialIds": credentialIds
|
|
562
102
|
];
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
103
|
+
if let txCode = txCode {
|
|
104
|
+
result["txCode"] = try serializeAny(txCode)
|
|
105
|
+
}
|
|
566
106
|
return result as NSDictionary;
|
|
567
107
|
|
|
568
108
|
case let .proofRequest(interactionId, proofId):
|
|
@@ -572,113 +112,3 @@ func serialize(invitationResponse: HandleInvitationResponseBindingEnum) -> NSDic
|
|
|
572
112
|
];
|
|
573
113
|
}
|
|
574
114
|
}
|
|
575
|
-
|
|
576
|
-
func serialize(txCode: OpenId4vciTxCodeBindingDto) -> NSDictionary {
|
|
577
|
-
var result: [String: Any] = [:];
|
|
578
|
-
result.addOpt("inputMode", opt(txCode.inputMode, serializeEnumValue));
|
|
579
|
-
result.addOpt("length", txCode.length);
|
|
580
|
-
result.addOpt("description", txCode.description);
|
|
581
|
-
return result as NSDictionary;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
func serialize(shareProofResponse: ShareProofResponseBindingDto) -> NSDictionary {
|
|
585
|
-
return [
|
|
586
|
-
"url": shareProofResponse.url,
|
|
587
|
-
]
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
func serialize(proofSchemaShareResponse: ProofSchemaShareResponseBindingDto) -> NSDictionary {
|
|
591
|
-
return [
|
|
592
|
-
"url": proofSchemaShareResponse.url,
|
|
593
|
-
]
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
func serialize(credentialSchemaShareResponse: CredentialSchemaShareResponseBindingDto) -> NSDictionary {
|
|
597
|
-
return [
|
|
598
|
-
"url": credentialSchemaShareResponse.url,
|
|
599
|
-
]
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
func serialize(resolveJsonLdContextResponse: ResolveJsonLdContextResponseBindingDto) -> NSDictionary {
|
|
603
|
-
return [
|
|
604
|
-
"context": resolveJsonLdContextResponse.context,
|
|
605
|
-
]
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
func serialize(trustAnchor: GetTrustAnchorResponseBindingDto) -> NSDictionary {
|
|
609
|
-
return [
|
|
610
|
-
"id": trustAnchor.id,
|
|
611
|
-
"createdDate": trustAnchor.createdDate,
|
|
612
|
-
"lastModified": trustAnchor.lastModified,
|
|
613
|
-
"name": trustAnchor.name,
|
|
614
|
-
"type": trustAnchor.type,
|
|
615
|
-
"isPublisher": trustAnchor.isPublisher,
|
|
616
|
-
"publisherReference": trustAnchor.publisherReference,
|
|
617
|
-
]
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
func serialize(trustAnchorList: TrustAnchorsListBindingDto) -> NSDictionary {
|
|
621
|
-
return [
|
|
622
|
-
"totalItems": trustAnchorList.totalItems,
|
|
623
|
-
"totalPages": trustAnchorList.totalPages,
|
|
624
|
-
"values": trustAnchorList.values.map { serialize(trustAnchorListItem: $0) },
|
|
625
|
-
]
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
func serialize(trustEntityList: TrustEntitiesListBindingDto) -> NSDictionary {
|
|
629
|
-
return [
|
|
630
|
-
"totalItems": trustEntityList.totalItems,
|
|
631
|
-
"totalPages": trustEntityList.totalPages,
|
|
632
|
-
"values": trustEntityList.values.map { serialize(trustEntityListItem: $0) },
|
|
633
|
-
]
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
func serialize(trustAnchorListItem: TrustAnchorsListItemResponseBindingDto) -> NSDictionary {
|
|
637
|
-
return [
|
|
638
|
-
"id": trustAnchorListItem.id,
|
|
639
|
-
"createdDate": trustAnchorListItem.createdDate,
|
|
640
|
-
"lastModified": trustAnchorListItem.lastModified,
|
|
641
|
-
"name": trustAnchorListItem.name,
|
|
642
|
-
"type": trustAnchorListItem.type,
|
|
643
|
-
"isPublisher": trustAnchorListItem.isPublisher,
|
|
644
|
-
"publisherReference": trustAnchorListItem.publisherReference,
|
|
645
|
-
"entities": trustAnchorListItem.entities,
|
|
646
|
-
]
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
func serialize(trustEntity: GetTrustEntityResponseBindingDto) -> NSDictionary {
|
|
650
|
-
var result: [String: Any] = [
|
|
651
|
-
"id": trustEntity.id,
|
|
652
|
-
"createdDate": trustEntity.createdDate,
|
|
653
|
-
"lastModified": trustEntity.lastModified,
|
|
654
|
-
"name": trustEntity.name,
|
|
655
|
-
"role": serializeEnumValue(value: trustEntity.role),
|
|
656
|
-
"trustAnchor": serialize(trustAnchor: trustEntity.trustAnchor),
|
|
657
|
-
"did": serialize(didListItem: trustEntity.did),
|
|
658
|
-
"state": serializeEnumValue(value: trustEntity.state),
|
|
659
|
-
]
|
|
660
|
-
result.addOpt("organisationId", trustEntity.organisationId)
|
|
661
|
-
result.addOpt("logo", trustEntity.logo)
|
|
662
|
-
result.addOpt("website", trustEntity.website)
|
|
663
|
-
result.addOpt("termsUrl", trustEntity.termsUrl)
|
|
664
|
-
result.addOpt("privacyUrl", trustEntity.privacyUrl)
|
|
665
|
-
return result as NSDictionary
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
func serialize(trustEntityListItem: TrustEntitiesListItemResponseBindingDto) -> NSDictionary {
|
|
669
|
-
var result: [String: Any] = [
|
|
670
|
-
"id": trustEntityListItem.id,
|
|
671
|
-
"createdDate": trustEntityListItem.createdDate,
|
|
672
|
-
"lastModified": trustEntityListItem.lastModified,
|
|
673
|
-
"name": trustEntityListItem.name,
|
|
674
|
-
"role": serializeEnumValue(value: trustEntityListItem.role),
|
|
675
|
-
"trustAnchor": serialize(trustAnchor: trustEntityListItem.trustAnchor),
|
|
676
|
-
"did": serialize(didListItem: trustEntityListItem.did),
|
|
677
|
-
"state": serializeEnumValue(value: trustEntityListItem.state),
|
|
678
|
-
]
|
|
679
|
-
result.addOpt("logo", trustEntityListItem.logo)
|
|
680
|
-
result.addOpt("website", trustEntityListItem.website)
|
|
681
|
-
result.addOpt("termsUrl", trustEntityListItem.termsUrl)
|
|
682
|
-
result.addOpt("privacyUrl", trustEntityListItem.privacyUrl)
|
|
683
|
-
return result as NSDictionary
|
|
684
|
-
}
|