@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/Deserialize.swift
CHANGED
|
@@ -8,827 +8,154 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
import ProcivisOneCore
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var errorDescription: String? {
|
|
19
|
-
description
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
func deserializeCreateOrganisationRequest(request: NSDictionary) -> CreateOrganisationRequestBindingDto {
|
|
24
|
-
return CreateOrganisationRequestBindingDto(
|
|
25
|
-
id: request.value(forKey: "id") as? String,
|
|
26
|
-
name: request.value(forKey: "name") as? String
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
func deserializeUpsertOrganisationRequest(request: NSDictionary) throws -> UpsertOrganisationRequestBindingDto {
|
|
31
|
-
return UpsertOrganisationRequestBindingDto(
|
|
32
|
-
id: try safeCast(request.value(forKey: "id")),
|
|
33
|
-
name: try safeCast(request.value(forKey: "name"))
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
func deserializeKeyRequest(keyRequest: NSDictionary) throws -> KeyRequestBindingDto {
|
|
38
|
-
let keyType: String = try safeCast(keyRequest.value(forKey: "keyType"));
|
|
39
|
-
let name: String = try safeCast(keyRequest.value(forKey: "name"));
|
|
40
|
-
let storageType: String = try safeCast(keyRequest.value(forKey: "storageType"));
|
|
41
|
-
let organisationId: String = try safeCast(keyRequest.value(forKey: "organisationId"));
|
|
42
|
-
|
|
43
|
-
let keyParamsRaw: NSDictionary = try safeCast(keyRequest.value(forKey: "keyParams"));
|
|
44
|
-
var keyParams: [String: String] = [:];
|
|
45
|
-
try keyParamsRaw.allKeys.forEach {
|
|
46
|
-
let key: String = try safeCast($0);
|
|
47
|
-
keyParams[key] = keyParamsRaw.value(forKey: key) as? String;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
let storageParamsRaw: NSDictionary = try safeCast(keyRequest.value(forKey: "storageParams"));
|
|
51
|
-
var storageParams: [String: String] = [:];
|
|
52
|
-
try storageParamsRaw.allKeys.forEach {
|
|
53
|
-
let key: String = try safeCast($0);
|
|
54
|
-
storageParams[key] = storageParamsRaw.value(forKey: key) as? String;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return KeyRequestBindingDto(organisationId: organisationId, keyType: keyType, keyParams: keyParams, name: name, storageType: storageType, storageParams: storageParams);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
func deserializeDidRequest(didRequest: NSDictionary) throws -> DidRequestBindingDto {
|
|
61
|
-
let organisationId: String = try safeCast(didRequest.value(forKey: "organisationId"));
|
|
62
|
-
let name: String = try safeCast(didRequest.value(forKey: "name"));
|
|
63
|
-
let didMethod: String = try safeCast(didRequest.value(forKey: "didMethod"));
|
|
64
|
-
let keys = try deserializeDidRequestKeys(didRequestKeys: try safeCast(didRequest.value(forKey: "keys")));
|
|
65
|
-
|
|
66
|
-
let paramsRaw: NSDictionary = try safeCast(didRequest.value(forKey: "params"));
|
|
67
|
-
var params: [String: String] = [:];
|
|
68
|
-
try paramsRaw.allKeys.forEach {
|
|
69
|
-
let key: String = try safeCast($0);
|
|
70
|
-
params[key] = paramsRaw.value(forKey: key) as? String;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return DidRequestBindingDto(organisationId: organisationId, name: name, didMethod: didMethod, keys: keys, params: params);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
func deserializeDidRequestKeys(didRequestKeys: NSDictionary) throws -> DidRequestKeysBindingDto {
|
|
77
|
-
let authentication = try deserializeDidRequestKeySet(didRequestKeys: didRequestKeys, keyRole: "authentication");
|
|
78
|
-
let assertionMethod = try deserializeDidRequestKeySet(didRequestKeys: didRequestKeys, keyRole: "assertionMethod");
|
|
79
|
-
let keyAgreement = try deserializeDidRequestKeySet(didRequestKeys: didRequestKeys, keyRole: "keyAgreement");
|
|
80
|
-
let capabilityInvocation = try deserializeDidRequestKeySet(didRequestKeys: didRequestKeys, keyRole: "capabilityInvocation");
|
|
81
|
-
let capabilityDelegation = try deserializeDidRequestKeySet(didRequestKeys: didRequestKeys, keyRole: "capabilityDelegation");
|
|
82
|
-
return DidRequestKeysBindingDto(authentication: authentication, assertionMethod: assertionMethod, keyAgreement: keyAgreement, capabilityInvocation: capabilityInvocation, capabilityDelegation: capabilityDelegation);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
func deserializeDidRequestKeySet(didRequestKeys: NSDictionary, keyRole: String) throws -> [String] {
|
|
86
|
-
let roleKeys: NSArray = try safeCast(didRequestKeys.value(forKey: keyRole));
|
|
87
|
-
var result: [String] = [];
|
|
88
|
-
try roleKeys.forEach { key in
|
|
89
|
-
result.append(try safeCast(key));
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
func deserializeHistorySearch(text: String?, type: String?) throws -> HistorySearchBindingDto? {
|
|
95
|
-
if text == nil {
|
|
96
|
-
return nil
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return HistorySearchBindingDto(
|
|
100
|
-
text: text!,
|
|
101
|
-
type: try opt(type, deserializeEnum)
|
|
102
|
-
)
|
|
11
|
+
private func enumList<T: CaseIterable>(_ entries: NSArray) throws -> [T] {
|
|
12
|
+
var result: [T] = []
|
|
13
|
+
try entries.forEach { entry in
|
|
14
|
+
result.append(try deserializeEnum(try safeCast(entry)))
|
|
15
|
+
}
|
|
16
|
+
return result
|
|
103
17
|
}
|
|
104
18
|
|
|
105
|
-
func
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
19
|
+
private func deserializeEnum<T: CaseIterable>(_ input: String) throws -> T {
|
|
20
|
+
if let entry = T.allCases.first(where: { value in
|
|
21
|
+
serializeEnumValue(value: value) == input
|
|
22
|
+
}) {
|
|
23
|
+
return entry
|
|
24
|
+
} else {
|
|
25
|
+
let description = "Invalid enum value for \(T.self): \(input)"
|
|
26
|
+
throw DecodingError.typeMismatch(
|
|
27
|
+
T.self,
|
|
28
|
+
DecodingError.Context(codingPath: [], debugDescription: description)
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private func opt<F, T>(_ input: F?, _ deserializeFn: @escaping (_ input: F) throws -> T) throws
|
|
34
|
+
-> T?
|
|
35
|
+
{
|
|
36
|
+
if input != nil {
|
|
37
|
+
return try deserializeFn(input!)
|
|
38
|
+
}
|
|
39
|
+
return nil
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private func safeCast<T>(_ input: Any?) throws -> T {
|
|
43
|
+
if let result = input as? T {
|
|
110
44
|
return result
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
func deserializePresentationSubmitCredentialRequest(_ input: NSDictionary) throws -> PresentationSubmitCredentialRequestBindingDto {
|
|
118
|
-
let claims: NSArray = try safeCast(input.value(forKey: "submitClaims"));
|
|
119
|
-
var submitClaims: [String] = [];
|
|
120
|
-
try claims.forEach { claim in
|
|
121
|
-
submitClaims.append(try safeCast(claim));
|
|
122
|
-
}
|
|
123
|
-
return PresentationSubmitCredentialRequestBindingDto(credentialId: try safeCast(input.value(forKey: "credentialId")), submitClaims: submitClaims);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
func deserializeCredentialSchemaListQuery(_ query: NSDictionary) throws -> CredentialSchemaListQueryBindingDto {
|
|
127
|
-
return CredentialSchemaListQueryBindingDto(
|
|
128
|
-
page: try safeCast(query.value(forKey: "page")),
|
|
129
|
-
pageSize: try safeCast(query.value(forKey: "pageSize")),
|
|
130
|
-
organisationId: try safeCast(query.value(forKey: "organisationId")),
|
|
131
|
-
sort: try opt(query.value(forKey: "sort") as? String, deserializeEnum),
|
|
132
|
-
sortDirection: try opt(query.value(forKey: "sortDirection") as? String, deserializeEnum),
|
|
133
|
-
name: query.value(forKey: "name") as? String,
|
|
134
|
-
ids: try opt(query.value(forKey: "ids") as? NSArray, deserializeIds),
|
|
135
|
-
exact: try opt(query.value(forKey: "exact") as? NSArray, enumList),
|
|
136
|
-
include: try opt(query.value(forKey: "include") as? NSArray, enumList)
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
func deserializeCredentialListQuery(_ query: NSDictionary) throws -> CredentialListQueryBindingDto {
|
|
141
|
-
return CredentialListQueryBindingDto(
|
|
142
|
-
page: try safeCast(query.value(forKey: "page")),
|
|
143
|
-
pageSize: try safeCast(query.value(forKey: "pageSize")),
|
|
144
|
-
sort: try opt(query.value(forKey: "sort") as? String, deserializeEnum),
|
|
145
|
-
sortDirection: try opt(query.value(forKey: "sortDirection") as? String, deserializeEnum),
|
|
146
|
-
organisationId: try safeCast(query.value(forKey: "organisationId")),
|
|
147
|
-
name: query.value(forKey: "name") as? String,
|
|
148
|
-
searchText: query.value(forKey: "searchText") as? String,
|
|
149
|
-
searchType: try opt(query.value(forKey: "searchType") as? NSArray, enumList),
|
|
150
|
-
exact: try opt(query.value(forKey: "exact") as? NSArray, enumList ),
|
|
151
|
-
role: try opt(query.value(forKey: "role") as? String, deserializeEnum),
|
|
152
|
-
ids: try opt(query.value(forKey: "ids") as? NSArray, deserializeIds),
|
|
153
|
-
status: try opt(query.value(forKey: "status") as? NSArray, enumList),
|
|
154
|
-
include: try opt(query.value(forKey: "include") as? NSArray, enumList)
|
|
155
|
-
)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
func deserializeDidListQuery(_ query: NSDictionary) throws -> DidListQueryBindingDto {
|
|
159
|
-
return DidListQueryBindingDto(
|
|
160
|
-
page: try safeCast(query.value(forKey: "page")),
|
|
161
|
-
pageSize: try safeCast(query.value(forKey: "pageSize")),
|
|
162
|
-
sort: try opt(query.value(forKey: "sort") as? String, deserializeEnum),
|
|
163
|
-
sortDirection: try opt(query.value(forKey: "sortDirection") as? String, deserializeEnum),
|
|
164
|
-
organisationId: try safeCast(query.value(forKey: "organisationId")),
|
|
165
|
-
name: query.value(forKey: "name") as? String,
|
|
166
|
-
did: query.value(forKey: "did") as? String,
|
|
167
|
-
type: try opt(query.value(forKey: "type") as? String, deserializeEnum),
|
|
168
|
-
deactivated: query.value(forKey: "deactivated") as? Bool,
|
|
169
|
-
exact: try opt(query.value(forKey: "exact") as? NSArray, { columns in try enumList(columns) } ),
|
|
170
|
-
keyAlgorithms: try opt(query.value(forKey: "keyAlgorithms") as? NSArray, deserializeIds),
|
|
171
|
-
keyRoles: try opt(query.value(forKey: "keyRoles") as? NSArray, { roles in try enumList(roles) }),
|
|
172
|
-
keyStorages: try opt(query.value(forKey: "keyStorages") as? NSArray, deserializeIds),
|
|
173
|
-
keyIds: try opt(query.value(forKey: "keyIds") as? NSArray, deserializeIds),
|
|
174
|
-
didMethods: try opt(query.value(forKey: "didMethods") as? NSArray, deserializeIds)
|
|
175
|
-
)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
func deserializeHistoryListQuery(_ query: NSDictionary) throws -> HistoryListQueryBindingDto {
|
|
179
|
-
return HistoryListQueryBindingDto(
|
|
180
|
-
page: try safeCast(query.value(forKey: "page")),
|
|
181
|
-
pageSize: try safeCast(query.value(forKey: "pageSize")),
|
|
182
|
-
organisationId: try safeCast(query.value(forKey: "organisationId")),
|
|
183
|
-
entityId: query.value(forKey: "entityId") as? String,
|
|
184
|
-
entityTypes: try opt(query.value(forKey: "entityTypes") as? NSArray, enumList),
|
|
185
|
-
action: try opt(query.value(forKey: "action") as? String, deserializeEnum),
|
|
186
|
-
createdDateFrom: query.value(forKey: "createdDateFrom") as? String,
|
|
187
|
-
createdDateTo: query.value(forKey: "createdDateTo") as? String,
|
|
188
|
-
didId: query.value(forKey: "didId") as? String,
|
|
189
|
-
credentialId: query.value(forKey: "credentialId") as? String,
|
|
190
|
-
credentialSchemaId: query.value(forKey: "credentialSchemaId") as? String,
|
|
191
|
-
proofSchemaId: query.value(forKey: "proofSchemaId") as? String,
|
|
192
|
-
search: try deserializeHistorySearch(
|
|
193
|
-
text: query.value(forKey: "searchText") as? String,
|
|
194
|
-
type: query.value(forKey: "searchType") as? String
|
|
195
|
-
)
|
|
196
|
-
)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
func deserializeProofSchemaListQuery(_ query: NSDictionary) throws -> ListProofSchemasFiltersBindingDto {
|
|
200
|
-
return ListProofSchemasFiltersBindingDto(
|
|
201
|
-
page: try safeCast(query.value(forKey: "page")),
|
|
202
|
-
pageSize: try safeCast(query.value(forKey: "pageSize")),
|
|
203
|
-
sort: try opt(query.value(forKey: "sort") as? String, deserializeEnum),
|
|
204
|
-
sortDirection: try opt(query.value(forKey: "sortDirection") as? String, deserializeEnum),
|
|
205
|
-
organisationId: try safeCast(query.value(forKey: "organisationId")),
|
|
206
|
-
name: query.value(forKey: "name") as? String,
|
|
207
|
-
exact: try opt(query.value(forKey: "exact") as? NSArray, { columns in try enumList(columns) } ),
|
|
208
|
-
ids: try opt(query.value(forKey: "ids") as? NSArray, deserializeIds)
|
|
209
|
-
)
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
func deserializeProofListQuery(_ query: NSDictionary) throws -> ProofListQueryBindingDto {
|
|
213
|
-
return ProofListQueryBindingDto(
|
|
214
|
-
page: try safeCast(query.value(forKey: "page")),
|
|
215
|
-
pageSize: try safeCast(query.value(forKey: "pageSize")),
|
|
216
|
-
organisationId: try safeCast(query.value(forKey: "organisationId")),
|
|
217
|
-
sort: try opt(query.value(forKey: "sort") as? String, deserializeEnum),
|
|
218
|
-
sortDirection: try opt(query.value(forKey: "sortDirection") as? String, deserializeEnum),
|
|
219
|
-
name: query.value(forKey: "name") as? String,
|
|
220
|
-
ids: try opt(query.value(forKey: "ids") as? NSArray, deserializeIds),
|
|
221
|
-
proofStates: try opt(query.value(forKey: "proofStates") as? NSArray, { columns in try enumList(columns) } ),
|
|
222
|
-
proofRoles: try opt(query.value(forKey: "proofRoles") as? NSArray, { columns in try enumList(columns) } ),
|
|
223
|
-
proofSchemaIds: query.value(forKey: "proofSchemaIds") as? [String],
|
|
224
|
-
exact: try opt(query.value(forKey: "exact") as? NSArray, { columns in try enumList(columns) } )
|
|
225
|
-
)
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
func deserializeImportProofSchemaRequest(_ request: NSDictionary) throws -> ImportProofSchemaRequestBindingsDto {
|
|
229
|
-
return ImportProofSchemaRequestBindingsDto(
|
|
230
|
-
schema: try deserializeImportProofSchema(try safeCast(request.value(forKey: "schema"))),
|
|
231
|
-
organisationId: try safeCast(request.value(forKey: "organisationId"))
|
|
232
|
-
)
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
func deserializeImportProofSchema(_ schema: NSDictionary) throws -> ImportProofSchemaBindingDto {
|
|
236
|
-
let proofInputSchemas: NSArray = try safeCast(schema.value(forKey: "proofInputSchemas"));
|
|
237
|
-
|
|
238
|
-
return ImportProofSchemaBindingDto(
|
|
239
|
-
id: try safeCast(schema.value(forKey: "id")),
|
|
240
|
-
createdDate: try safeCast(schema.value(forKey: "createdDate")),
|
|
241
|
-
lastModified: try safeCast(schema.value(forKey: "lastModified")),
|
|
242
|
-
name: try safeCast(schema.value(forKey: "name")),
|
|
243
|
-
organisationId: try safeCast(schema.value(forKey: "organisationId")),
|
|
244
|
-
expireDuration: try safeCast(schema.value(forKey: "expireDuration")),
|
|
245
|
-
importedSourceUrl: try safeCast(schema.value(forKey: "importedSourceUrl")),
|
|
246
|
-
proofInputSchemas: try proofInputSchemas.map { try deserializeImportProofSchemaInputSchema(try safeCast($0)) }
|
|
247
|
-
)
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
func deserializeCreateProofSchemaRequest(_ request: NSDictionary) throws -> CreateProofSchemaRequestDto {
|
|
251
|
-
let proofInputSchemas: NSArray = try safeCast(request.value(forKey: "proofInputSchemas"));
|
|
252
|
-
|
|
253
|
-
return CreateProofSchemaRequestDto(
|
|
254
|
-
name: try safeCast(request.value(forKey: "name")),
|
|
255
|
-
organisationId: try safeCast(request.value(forKey: "organisationId")),
|
|
256
|
-
expireDuration: try safeCast(request.value(forKey: "expireDuration")),
|
|
257
|
-
proofInputSchemas: try proofInputSchemas.map { try deserializeProofInputSchemaRequest(try safeCast($0)) }
|
|
258
|
-
)
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
func deserializeProofInputSchemaRequest(_ request: NSDictionary) throws -> ProofInputSchemaRequestDto {
|
|
262
|
-
let claimSchemas: NSArray = try safeCast(request.value(forKey: "claimSchemas"));
|
|
263
|
-
|
|
264
|
-
return ProofInputSchemaRequestDto(
|
|
265
|
-
credentialSchemaId: try safeCast(request.value(forKey: "credentialSchemaId")),
|
|
266
|
-
validityConstraint: try safeCast(request.value(forKey: "validityConstraint")),
|
|
267
|
-
claimSchemas: try claimSchemas.map { try deserializeProofClaimSchemaRequest(try safeCast($0)) }
|
|
268
|
-
)
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
func deserializeImportProofSchemaInputSchema(_ inputSchema: NSDictionary) throws -> ImportProofSchemaInputSchemaBindingDto {
|
|
272
|
-
let claimSchemas: NSArray = try safeCast(inputSchema.value(forKey: "claimSchemas"));
|
|
273
|
-
|
|
274
|
-
return ImportProofSchemaInputSchemaBindingDto(
|
|
275
|
-
claimSchemas: try claimSchemas.map { try deserializeImportProofSchemaClaimSchema(try safeCast($0)) },
|
|
276
|
-
credentialSchema: try deserializeImportProofSchemaCredentialSchema(try safeCast(inputSchema.value(forKey: "credentialSchema"))),
|
|
277
|
-
validityConstraint: inputSchema.value(forKey: "validityConstraint") as? Int64
|
|
278
|
-
)
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
func deserializeProofClaimSchemaRequest(_ request: NSDictionary) throws -> CreateProofSchemaClaimRequestDto {
|
|
282
|
-
return CreateProofSchemaClaimRequestDto(
|
|
283
|
-
id: try safeCast(request.value(forKey: "id")),
|
|
284
|
-
required: try safeCast(request.value(forKey: "required"))
|
|
285
|
-
)
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
func deserializeImportProofSchemaClaimSchema(_ request: NSDictionary) throws -> ImportProofSchemaClaimSchemaBindingDto {
|
|
289
|
-
let claims = request.value(forKey: "claims") as? NSArray;
|
|
290
|
-
|
|
291
|
-
return ImportProofSchemaClaimSchemaBindingDto(
|
|
292
|
-
id: try safeCast(request.value(forKey: "id")),
|
|
293
|
-
requested: try safeCast(request.value(forKey: "requested")),
|
|
294
|
-
required: try safeCast(request.value(forKey: "required")),
|
|
295
|
-
key: try safeCast(request.value(forKey: "key")),
|
|
296
|
-
dataType: try safeCast(request.value(forKey: "dataType")),
|
|
297
|
-
claims: try claims?.map { try deserializeImportProofSchemaClaimSchema(try safeCast($0)) },
|
|
298
|
-
array: try safeCast(request.value(forKey: "array"))
|
|
299
|
-
)
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
func deserializeImportProofSchemaCredentialSchema(_ request: NSDictionary) throws -> ImportProofSchemaCredentialSchemaBindingDto {
|
|
303
|
-
return ImportProofSchemaCredentialSchemaBindingDto(
|
|
304
|
-
id: try safeCast(request.value(forKey: "id")),
|
|
305
|
-
createdDate: try safeCast(request.value(forKey: "createdDate")),
|
|
306
|
-
lastModified: try safeCast(request.value(forKey: "lastModified")),
|
|
307
|
-
name: try safeCast(request.value(forKey: "name")),
|
|
308
|
-
format: try safeCast(request.value(forKey: "format")),
|
|
309
|
-
revocationMethod: try safeCast(request.value(forKey: "revocationMethod")),
|
|
310
|
-
walletStorageType: try opt(request.value(forKey: "walletStorageType") as? String, deserializeEnum),
|
|
311
|
-
schemaId: try safeCast(request.value(forKey: "schemaId")),
|
|
312
|
-
importedSourceUrl: try safeCast(request.value(forKey: "importedSourceUrl")),
|
|
313
|
-
schemaType: deserializeCredentialSchemaTypeBindingEnum(try safeCast(request.value(forKey: "schemaType"))),
|
|
314
|
-
layoutType: try opt(request.value(forKey: "layoutType") as? String, deserializeEnum),
|
|
315
|
-
layoutProperties: try opt((request.value(forKey: "layoutProperties") as? NSDictionary), deserializeCredentialSchemaRequestLayoutProperties)
|
|
316
|
-
)
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
func deserializeImportCredentialSchemaRequest(_ request: NSDictionary) throws -> ImportCredentialSchemaRequestBindingDto {
|
|
320
|
-
return ImportCredentialSchemaRequestBindingDto(
|
|
321
|
-
organisationId: try safeCast(request.value(forKey: "organisationId")),
|
|
322
|
-
schema: try deserializeImportCredentialSchemaRequestSchema(try safeCast(request.value(forKey: "schema")))
|
|
323
|
-
)
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
func deserializeImportCredentialSchemaRequestSchema(_ request: NSDictionary) throws -> ImportCredentialSchemaRequestSchemaBindingDto {
|
|
327
|
-
let claims: NSArray = try safeCast(request.value(forKey: "claims"));
|
|
328
|
-
|
|
329
|
-
return ImportCredentialSchemaRequestSchemaBindingDto(
|
|
330
|
-
id: try safeCast(request.value(forKey: "id")),
|
|
331
|
-
createdDate: try safeCast(request.value(forKey: "createdDate")),
|
|
332
|
-
lastModified: try safeCast(request.value(forKey: "lastModified")),
|
|
333
|
-
name: try safeCast(request.value(forKey: "name")),
|
|
334
|
-
format: try safeCast(request.value(forKey: "format")),
|
|
335
|
-
revocationMethod: try safeCast(request.value(forKey: "revocationMethod")),
|
|
336
|
-
organisationId: try safeCast(request.value(forKey: "organisationId")),
|
|
337
|
-
claims: try claims.map { try deserializeImportCredentialSchemaRequestClaim(try safeCast($0)) },
|
|
338
|
-
walletStorageType: try opt(request.value(forKey: "walletStorageType") as? String, deserializeEnum),
|
|
339
|
-
schemaId: try safeCast(request.value(forKey: "schemaId")),
|
|
340
|
-
importedSourceUrl: try safeCast(request.value(forKey: "importedSourceUrl")),
|
|
341
|
-
schemaType: deserializeCredentialSchemaTypeBindingEnum(try safeCast(request.value(forKey: "schemaType"))),
|
|
342
|
-
layoutType: try opt(request.value(forKey: "layoutType") as? String, deserializeEnum),
|
|
343
|
-
layoutProperties: try opt((request.value(forKey: "layoutProperties") as? NSDictionary), deserializeImportCredentialSchemaRequestLayoutProperties),
|
|
344
|
-
allowSuspension: request.value(forKey: "allowSuspension") as? Bool,
|
|
345
|
-
externalSchema: try safeCast(request.value(forKey: "externalSchema") as? Bool)
|
|
346
|
-
)
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
func deserializeImportCredentialSchemaRequestClaim(_ request: NSDictionary) throws -> ImportCredentialSchemaClaimSchemaBindingDto {
|
|
350
|
-
let claims = request.value(forKey: "claims") as? NSArray;
|
|
351
|
-
|
|
352
|
-
return ImportCredentialSchemaClaimSchemaBindingDto(
|
|
353
|
-
id: try safeCast(request.value(forKey: "id")),
|
|
354
|
-
createdDate: try safeCast(request.value(forKey: "createdDate")),
|
|
355
|
-
lastModified: try safeCast(request.value(forKey: "lastModified")),
|
|
356
|
-
required: try safeCast(request.value(forKey: "required")),
|
|
357
|
-
key: try safeCast(request.value(forKey: "key")),
|
|
358
|
-
datatype: try safeCast(request.value(forKey: "datatype")),
|
|
359
|
-
array: request.value(forKey: "array") as? Bool,
|
|
360
|
-
claims: try claims?.map { try deserializeImportCredentialSchemaRequestClaim(try safeCast($0)) }
|
|
361
|
-
)
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
func deserializeImportCredentialSchemaRequestLayoutProperties(_ request: NSDictionary) throws -> ImportCredentialSchemaLayoutPropertiesBindingDto {
|
|
365
|
-
return ImportCredentialSchemaLayoutPropertiesBindingDto(
|
|
366
|
-
background: try opt(request.value(forKey: "background") as? NSDictionary, deserializeImportCredentialSchemaBackgroundProperties),
|
|
367
|
-
logo: try opt(request.value(forKey: "logo") as? NSDictionary, deserializeImportCredentialSchemaLogoProperties),
|
|
368
|
-
primaryAttribute: request.value(forKey: "primaryAttribute") as? String,
|
|
369
|
-
secondaryAttribute: request.value(forKey: "secondaryAttribute") as? String,
|
|
370
|
-
pictureAttribute: request.value(forKey: "pictureAttribute") as? String,
|
|
371
|
-
code: try opt(request.value(forKey: "code") as? NSDictionary, deserializeImportCredentialSchemaCodeProperties)
|
|
372
|
-
)
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
func deserializeCredentialSchemaRequestLayoutProperties(_ request: NSDictionary) throws -> CredentialSchemaLayoutPropertiesBindingDto {
|
|
376
|
-
return CredentialSchemaLayoutPropertiesBindingDto(
|
|
377
|
-
background: try opt(request.value(forKey: "background") as? NSDictionary, deserializeImportCredentialSchemaBackgroundProperties),
|
|
378
|
-
logo: try opt(request.value(forKey: "logo") as? NSDictionary, deserializeImportCredentialSchemaLogoProperties),
|
|
379
|
-
primaryAttribute: request.value(forKey: "primaryAttribute") as? String,
|
|
380
|
-
secondaryAttribute: request.value(forKey: "secondaryAttribute") as? String,
|
|
381
|
-
pictureAttribute: request.value(forKey: "pictureAttribute") as? String,
|
|
382
|
-
code: try opt(request.value(forKey: "code") as? NSDictionary, deserializeImportCredentialSchemaCodeProperties)
|
|
383
|
-
)
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
func deserializeImportCredentialSchemaBackgroundProperties(_ request: NSDictionary) throws -> CredentialSchemaBackgroundPropertiesBindingDto {
|
|
387
|
-
return CredentialSchemaBackgroundPropertiesBindingDto(
|
|
388
|
-
color: request.value(forKey: "color") as? String,
|
|
389
|
-
image: request.value(forKey: "image") as? String
|
|
390
|
-
)
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
func deserializeImportCredentialSchemaLogoProperties(_ request: NSDictionary) throws -> CredentialSchemaLogoPropertiesBindingDto {
|
|
394
|
-
return CredentialSchemaLogoPropertiesBindingDto(
|
|
395
|
-
fontColor: request.value(forKey: "fontColor") as? String,
|
|
396
|
-
backgroundColor: request.value(forKey: "backgroundColor") as? String,
|
|
397
|
-
image: request.value(forKey: "image") as? String
|
|
398
|
-
)
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
func deserializeImportCredentialSchemaCodeProperties(_ request: NSDictionary) throws -> CredentialSchemaCodePropertiesBindingDto {
|
|
402
|
-
return CredentialSchemaCodePropertiesBindingDto(
|
|
403
|
-
attribute: try safeCast(request.value(forKey: "attribute")),
|
|
404
|
-
type: try deserializeEnum(try safeCast(request.value(forKey: "type")))
|
|
405
|
-
)
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
func deserializeCreateProofRequest(_ request: NSDictionary) throws -> CreateProofRequestBindingDto {
|
|
409
|
-
return CreateProofRequestBindingDto(
|
|
410
|
-
proofSchemaId: try safeCast(request.value(forKey: "proofSchemaId")),
|
|
411
|
-
verifierDidId: request.value(forKey: "verifierDidId") as? String,
|
|
412
|
-
verifierIdentifierId: request.value(forKey: "verifierIdentifierId") as? String,
|
|
413
|
-
exchange: try safeCast(request.value(forKey: "exchange")),
|
|
414
|
-
redirectUri: request.value(forKey: "redirectUri") as? String,
|
|
415
|
-
verifierKey: request.value(forKey: "verifierKey") as? String,
|
|
416
|
-
scanToVerify: try opt((request.value(forKey: "scanToVerify") as? NSDictionary), deserializeScanToVerifyRequest),
|
|
417
|
-
isoMdlEngagement: request.value(forKey: "isoMdlEngagement") as? String,
|
|
418
|
-
transport: request.value(forKey: "transport") as? [String]
|
|
419
|
-
)
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
func deserializeShareProofRequest(_ request: NSDictionary) throws -> ShareProofRequestBindingDto {
|
|
423
|
-
return ShareProofRequestBindingDto(
|
|
424
|
-
params: try opt((request.value(forKey: "params") as? NSDictionary), deserializeShareProofRequestParams)
|
|
425
|
-
)
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
func deserializeShareProofRequestParams(_ request: NSDictionary) throws -> ShareProofRequestParamsBindingDto {
|
|
429
|
-
return ShareProofRequestParamsBindingDto(
|
|
430
|
-
clientIdScheme: try opt(request.value(forKey: "clientIdScheme") as? String, deserializeEnum)
|
|
431
|
-
)
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
func deserializeKeyCheckCertificateRequest(_ request: NSDictionary) throws -> KeyCheckCertificateRequestBindingDto {
|
|
435
|
-
return KeyCheckCertificateRequestBindingDto(
|
|
436
|
-
certificate: (request.value(forKey: "certificate") as? String)!
|
|
437
|
-
)
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
func deserializeScanToVerifyRequest(_ request: NSDictionary) throws -> ScanToVerifyRequestBindingDto {
|
|
441
|
-
return ScanToVerifyRequestBindingDto(
|
|
442
|
-
credential: try safeCast(request.value(forKey: "credential")),
|
|
443
|
-
barcode: try safeCast(request.value(forKey: "barcode")),
|
|
444
|
-
barcodeType: try deserializeEnum(try safeCast(request.value(forKey: "barcodeType")))
|
|
445
|
-
)
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
func deserializeCreateTrustAnchorRequest(_ request: NSDictionary) throws -> CreateTrustAnchorRequestBindingDto {
|
|
449
|
-
return CreateTrustAnchorRequestBindingDto(
|
|
450
|
-
name: try safeCast(request.value(forKey: "name")),
|
|
451
|
-
type: try safeCast(request.value(forKey: "type")),
|
|
452
|
-
isPublisher: request.value(forKey: "isPublisher") as? Bool,
|
|
453
|
-
publisherReference: request.value(forKey: "publisherReference") as? String
|
|
454
|
-
)
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
func deserializeTrustAnchorListQuery(_ query: NSDictionary) throws -> ListTrustAnchorsFiltersBindings {
|
|
458
|
-
return ListTrustAnchorsFiltersBindings(
|
|
459
|
-
page: try safeCast(query.value(forKey: "page")),
|
|
460
|
-
pageSize: try safeCast(query.value(forKey: "pageSize")),
|
|
461
|
-
sort: try opt(query.value(forKey: "sort") as? String, deserializeEnum),
|
|
462
|
-
sortDirection: try opt(query.value(forKey: "sortDirection") as? String, deserializeEnum),
|
|
463
|
-
name: query.value(forKey: "name") as? String,
|
|
464
|
-
isPublisher: query.value(forKey: "isPublisher") as? Bool,
|
|
465
|
-
type: query.value(forKey: "type") as? String,
|
|
466
|
-
exact: try opt(query.value(forKey: "exact") as? NSArray, { columns in try enumList(columns) } )
|
|
467
|
-
)
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
func deserializeCreateTrustEntityRequest(_ request: NSDictionary) throws -> CreateTrustEntityRequestBindingDto {
|
|
471
|
-
return CreateTrustEntityRequestBindingDto(
|
|
472
|
-
name: try safeCast(request.value(forKey: "name")),
|
|
473
|
-
logo: request.value(forKey: "logo") as? String,
|
|
474
|
-
website: request.value(forKey: "website") as? String,
|
|
475
|
-
termsUrl: request.value(forKey: "termsUrl") as? String,
|
|
476
|
-
privacyUrl: request.value(forKey: "privacyUrl") as? String,
|
|
477
|
-
role: try deserializeEnum(try safeCast(request.value(forKey: "role"))),
|
|
478
|
-
trustAnchorId: try safeCast(request.value(forKey: "trustAnchorId")),
|
|
479
|
-
didId: try safeCast(request.value(forKey: "didId"))
|
|
480
|
-
)
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
func deserializeCreateRemoteTrustEntityRequest(_ request: NSDictionary) throws -> CreateRemoteTrustEntityRequestBindingDto {
|
|
484
|
-
return CreateRemoteTrustEntityRequestBindingDto(
|
|
485
|
-
didId: try safeCast(request.value(forKey: "didId")),
|
|
486
|
-
trustAnchorId: request.value(forKey: "trustAnchorId") as? String,
|
|
487
|
-
name: try safeCast(request.value(forKey: "name")),
|
|
488
|
-
logo: request.value(forKey: "logo") as? String,
|
|
489
|
-
termsUrl: request.value(forKey: "termsUrl") as? String,
|
|
490
|
-
privacyUrl: request.value(forKey: "privacyUrl") as? String,
|
|
491
|
-
website: request.value(forKey: "website") as? String,
|
|
492
|
-
role: try deserializeEnum(try safeCast(request.value(forKey: "role")))
|
|
493
|
-
)
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
func deserializeUpdateRemoteTrustEntityRequest(_ request: NSDictionary) throws -> UpdateRemoteTrustEntityFromDidRequestBindingDto {
|
|
497
|
-
return UpdateRemoteTrustEntityFromDidRequestBindingDto(
|
|
498
|
-
didId: try safeCast(request.value(forKey: "didId")),
|
|
499
|
-
action: try opt(request.value(forKey: "action") as? String, deserializeEnum),
|
|
500
|
-
name: try safeCast(request.value(forKey: "name")),
|
|
501
|
-
logo: try optionalString(request, key: "logo"),
|
|
502
|
-
website: try optionalString(request, key: "website"),
|
|
503
|
-
termsUrl: try optionalString(request, key: "termsUrl"),
|
|
504
|
-
privacyUrl: try optionalString(request, key: "privacyUrl"),
|
|
505
|
-
role: try opt(request.value(forKey: "role") as? String, deserializeEnum)
|
|
45
|
+
} else {
|
|
46
|
+
let description = "Invalid input for type \(T.self): \(String(describing: input))"
|
|
47
|
+
throw DecodingError.typeMismatch(
|
|
48
|
+
T.self,
|
|
49
|
+
DecodingError.Context(codingPath: [], debugDescription: description)
|
|
506
50
|
)
|
|
51
|
+
}
|
|
507
52
|
}
|
|
508
53
|
|
|
509
|
-
func
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
sort: try opt(query.value(forKey: "sort") as? String, deserializeEnum),
|
|
514
|
-
sortDirection: try opt(query.value(forKey: "sortDirection") as? String, deserializeEnum),
|
|
515
|
-
name: query.value(forKey: "name") as? String,
|
|
516
|
-
role: try opt(query.value(forKey: "role") as? String, deserializeEnum),
|
|
517
|
-
trustAnchor: query.value(forKey: "trustAnchor") as? String,
|
|
518
|
-
didId: query.value(forKey: "didId") as? String,
|
|
519
|
-
organisationId: query.value(forKey: "organisationId") as? String,
|
|
520
|
-
exact: try opt(query.value(forKey: "exact") as? NSArray, { columns in try enumList(columns) } )
|
|
521
|
-
)
|
|
54
|
+
func deserialize<T: Decodable>(_ value: Any) throws -> T {
|
|
55
|
+
let decoder = RNDecoder()
|
|
56
|
+
decoder.userInfo[customDecoderKey] = deserializeSpecific as CustomDecoder
|
|
57
|
+
return try decoder.decode(value)
|
|
522
58
|
}
|
|
523
59
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
return [.authentication, .assertionMethod, .keyAgreement, .capabilityInvocation, .capabilityDelegation]
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
extension DidTypeBindingEnum: CaseIterable {
|
|
531
|
-
public static var allCases: [DidTypeBindingEnum] {
|
|
532
|
-
return [.local, .remote]
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
extension SortDirection: CaseIterable {
|
|
537
|
-
public static var allCases: [SortDirection] {
|
|
538
|
-
return [.ascending, .descending]
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
extension SortableDidColumnBindingEnum: CaseIterable {
|
|
543
|
-
public static var allCases: [SortableDidColumnBindingEnum] {
|
|
544
|
-
return [.name, .createdDate, .method, .type, .did, .deactivated]
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
extension SortableCredentialColumnBindingEnum: CaseIterable {
|
|
549
|
-
public static var allCases: [SortableCredentialColumnBindingEnum] {
|
|
550
|
-
return [.createdDate, .schemaName, .issuerDid, .state]
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
extension CredentialListIncludeEntityTypeBindingEnum: CaseIterable {
|
|
555
|
-
public static var allCases: [CredentialListIncludeEntityTypeBindingEnum] {
|
|
556
|
-
return [.layoutProperties, .credential]
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
extension CredentialStateBindingEnum: CaseIterable {
|
|
561
|
-
public static var allCases: [CredentialStateBindingEnum] {
|
|
562
|
-
return [.created, .pending, .offered, .accepted, .rejected, .revoked, .error, .suspended]
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
extension ExactDidFilterColumnBindingEnum: CaseIterable {
|
|
567
|
-
public static var allCases: [ExactDidFilterColumnBindingEnum] {
|
|
568
|
-
return [.name, .did]
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
extension CredentialListQueryExactColumnBindingEnum: CaseIterable {
|
|
573
|
-
public static var allCases: [CredentialListQueryExactColumnBindingEnum] {
|
|
574
|
-
return [.name]
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
extension HistoryEntityTypeBindingEnum: CaseIterable {
|
|
579
|
-
public static var allCases: [HistoryEntityTypeBindingEnum] {
|
|
580
|
-
return [.key, .did, .credentialSchema, .credential, .proofSchema, .proof, .organisation, .backup]
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
extension HistorySearchEnumBindingEnum: CaseIterable {
|
|
585
|
-
public static var allCases: [HistorySearchEnumBindingEnum] {
|
|
586
|
-
return [.claimName, .claimValue, .credentialSchemaName, .issuerDid, .issuerName, .verifierDid, .verifierName, .proofSchemaName]
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
extension HistoryActionBindingEnum: CaseIterable {
|
|
591
|
-
public static var allCases: [HistoryActionBindingEnum] {
|
|
592
|
-
return [
|
|
593
|
-
.accepted,
|
|
594
|
-
.created,
|
|
595
|
-
.deactivated,
|
|
596
|
-
.deleted,
|
|
597
|
-
.errored,
|
|
598
|
-
.issued,
|
|
599
|
-
.offered,
|
|
600
|
-
.rejected,
|
|
601
|
-
.requested,
|
|
602
|
-
.revoked,
|
|
603
|
-
.suspended,
|
|
604
|
-
.pending,
|
|
605
|
-
.restored,
|
|
606
|
-
.shared,
|
|
607
|
-
.imported,
|
|
608
|
-
.claimsRemoved,
|
|
609
|
-
.activated,
|
|
610
|
-
.withdrawn,
|
|
611
|
-
.removed,
|
|
612
|
-
.retracted,
|
|
613
|
-
.updated
|
|
614
|
-
]
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
extension CredentialRoleBindingDto: CaseIterable {
|
|
619
|
-
public static var allCases: [CredentialRoleBindingDto] {
|
|
620
|
-
return [.holder, .issuer, .verifier]
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
extension SortableProofSchemaColumnBinding: CaseIterable {
|
|
625
|
-
public static var allCases: [SortableProofSchemaColumnBinding] {
|
|
626
|
-
return [.name, .createdDate]
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
extension ProofSchemaListQueryExactColumnBinding: CaseIterable {
|
|
631
|
-
public static var allCases: [ProofSchemaListQueryExactColumnBinding] {
|
|
632
|
-
return [.name]
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
extension SortableCredentialSchemaColumnBindingEnum: CaseIterable {
|
|
637
|
-
public static var allCases: [SortableCredentialSchemaColumnBindingEnum] {
|
|
638
|
-
return [.name, .format, .createdDate]
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
extension CredentialSchemaListQueryExactColumnBindingEnum: CaseIterable {
|
|
643
|
-
public static var allCases: [CredentialSchemaListQueryExactColumnBindingEnum] {
|
|
644
|
-
return [.name]
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
extension CredentialSchemaListIncludeEntityType: CaseIterable {
|
|
649
|
-
public static var allCases: [CredentialSchemaListIncludeEntityType] {
|
|
650
|
-
return [.layoutProperties]
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
extension SortableProofListColumnBinding: CaseIterable {
|
|
655
|
-
public static var allCases: [SortableProofListColumnBinding] {
|
|
656
|
-
return [.createdDate, .schemaName, .state, .verifierDid]
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
extension ProofListQueryExactColumnBindingEnum: CaseIterable {
|
|
661
|
-
public static var allCases: [ProofListQueryExactColumnBindingEnum] {
|
|
662
|
-
return [.name]
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
extension CredentialSchemaCodeTypeBindingDto: CaseIterable {
|
|
667
|
-
public static var allCases: [CredentialSchemaCodeTypeBindingDto] {
|
|
668
|
-
return [.barcode, .mrz, .qrCode]
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
extension LayoutTypeBindingEnum: CaseIterable {
|
|
673
|
-
public static var allCases: [LayoutTypeBindingEnum] {
|
|
674
|
-
return [.card, .document, .singleAttribute]
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
extension WalletStorageTypeBindingEnum: CaseIterable {
|
|
679
|
-
public static var allCases: [WalletStorageTypeBindingEnum] {
|
|
680
|
-
return [.hardware, .software, .remoteSecureElement]
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
extension ProofStateBindingEnum: CaseIterable {
|
|
685
|
-
public static var allCases: [ProofStateBindingEnum] {
|
|
686
|
-
return [
|
|
687
|
-
.created,
|
|
688
|
-
.pending,
|
|
689
|
-
.requested,
|
|
690
|
-
.accepted,
|
|
691
|
-
.rejected,
|
|
692
|
-
.retracted,
|
|
693
|
-
.error
|
|
694
|
-
]
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
extension ProofRoleBindingEnum: CaseIterable {
|
|
699
|
-
public static var allCases: [ProofRoleBindingEnum] {
|
|
700
|
-
return [.holder, .verifier]
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
extension ClientIdSchemeBindingEnum: CaseIterable {
|
|
705
|
-
public static var allCases: [ClientIdSchemeBindingEnum] {
|
|
706
|
-
return [.redirectUri, .verifierAttestation, .did, .x509SanDns]
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
extension ScanToVerifyBarcodeTypeBindingEnum: CaseIterable {
|
|
711
|
-
public static var allCases: [ScanToVerifyBarcodeTypeBindingEnum] {
|
|
712
|
-
return [.mrz, .pdf417]
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
extension SortableTrustAnchorColumnBindings: CaseIterable {
|
|
717
|
-
public static var allCases: [SortableTrustAnchorColumnBindings] {
|
|
718
|
-
return [.name, .createdDate, .type]
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
extension ExactTrustAnchorFilterColumnBindings: CaseIterable {
|
|
723
|
-
public static var allCases: [ExactTrustAnchorFilterColumnBindings] {
|
|
724
|
-
return [.name, .type]
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
extension SearchTypeBindingEnum: CaseIterable {
|
|
729
|
-
public static var allCases: [SearchTypeBindingEnum] {
|
|
730
|
-
return [.claimName, .claimValue, .credentialSchemaName]
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
extension TrustEntityRoleBindingEnum: CaseIterable {
|
|
735
|
-
public static var allCases: [TrustEntityRoleBindingEnum] {
|
|
736
|
-
return [.issuer, .verifier, .both]
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
extension TrustEntityStateBindingEnum: CaseIterable {
|
|
741
|
-
public static var allCases: [TrustEntityStateBindingEnum] {
|
|
742
|
-
return [.active, .removed, .withdrawn, .removedAndWithdrawn]
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
extension SortableTrustEntityColumnBindings: CaseIterable {
|
|
747
|
-
public static var allCases: [SortableTrustEntityColumnBindings] {
|
|
748
|
-
return [.name, .role]
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
extension ExactTrustEntityFilterColumnBindings: CaseIterable {
|
|
753
|
-
public static var allCases: [ExactTrustEntityFilterColumnBindings] {
|
|
754
|
-
return [.name]
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
extension TrustEntityUpdateActionBindingEnum: CaseIterable {
|
|
759
|
-
public static var allCases: [TrustEntityUpdateActionBindingEnum] {
|
|
760
|
-
return [.activate, .remove, .withdraw]
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
extension CacheTypeBindingDto: CaseIterable {
|
|
765
|
-
public static var allCases: [CacheTypeBindingDto] {
|
|
766
|
-
return [.didDocument, .jsonLdContext, .jsonSchema, .statusListCredential, .trustList, .vctMetadata]
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
private func deserializeEnum<T: CaseIterable>(_ input: String) throws -> T {
|
|
771
|
-
if let entry = T.allCases.first(where: { value in
|
|
772
|
-
serializeEnumValue(value: value) == input
|
|
773
|
-
}) {
|
|
774
|
-
return entry;
|
|
775
|
-
} else {
|
|
776
|
-
throw SerializationError("Invalid enum value for \(T.self): " + input);
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
private func opt<F, T>(_ input: F?, _ deserialize: @escaping (_ input: F) throws -> T) throws -> T? {
|
|
781
|
-
if (input != nil) {
|
|
782
|
-
return try deserialize(input!);
|
|
783
|
-
}
|
|
60
|
+
func deserializeOpt<T: Decodable>(_ value: Any?) throws -> T? {
|
|
61
|
+
if value == nil {
|
|
784
62
|
return nil
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
}
|
|
801
|
-
return
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return try deserialize(value!)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private func deserializeSpecific(_ value: Any, _ type: Any.Type, _ codingPath: [CodingKey]) throws
|
|
69
|
+
-> Any?
|
|
70
|
+
{
|
|
71
|
+
if type == CredentialSchemaTypeBindingEnum.self {
|
|
72
|
+
guard let data = value as? String else {
|
|
73
|
+
let description = "Expected to decode \(type) but found '\(value)' instead."
|
|
74
|
+
throw DecodingError.typeMismatch(
|
|
75
|
+
type,
|
|
76
|
+
DecodingError.Context(codingPath: codingPath, debugDescription: description)
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
return deserializeCredentialSchemaTypeBindingEnum(data)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if type == HistoryListQueryBindingDto.self {
|
|
83
|
+
guard let data = value as? NSDictionary else {
|
|
84
|
+
let description = "Expected to decode \(type) but found '\(value)' instead."
|
|
85
|
+
throw DecodingError.typeMismatch(
|
|
86
|
+
type,
|
|
87
|
+
DecodingError.Context(codingPath: codingPath, debugDescription: description)
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
return try deserializeHistoryListQuery(data)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if type == OptionalString.self {
|
|
94
|
+
if value is NSNull {
|
|
95
|
+
return OptionalString.none
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
guard let data = value as? String else {
|
|
99
|
+
let description = "Expected to decode \(type) but found '\(value)' instead."
|
|
100
|
+
throw DecodingError.typeMismatch(
|
|
101
|
+
type,
|
|
102
|
+
DecodingError.Context(codingPath: codingPath, debugDescription: description)
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
return OptionalString.some(value: data)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return nil
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private func deserializeCredentialSchemaTypeBindingEnum(_ credentialSchemaType: String)
|
|
112
|
+
-> CredentialSchemaTypeBindingEnum
|
|
113
|
+
{
|
|
114
|
+
switch credentialSchemaType {
|
|
115
|
+
case "PROCIVIS_ONE_SCHEMA2024":
|
|
116
|
+
return .procivisOneSchema2024
|
|
117
|
+
case "FALLBACK_SCHEMA2024":
|
|
118
|
+
return .fallbackSchema2024
|
|
119
|
+
case "MDOC":
|
|
120
|
+
return .mdoc
|
|
121
|
+
case "SD_JWT_VC":
|
|
122
|
+
return .sdJwtVc
|
|
123
|
+
case let other:
|
|
124
|
+
return .other(value: other)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private func deserializeHistoryListQuery(_ query: NSDictionary) throws -> HistoryListQueryBindingDto
|
|
129
|
+
{
|
|
130
|
+
return HistoryListQueryBindingDto(
|
|
131
|
+
page: try safeCast(query.value(forKey: "page")),
|
|
132
|
+
pageSize: try safeCast(query.value(forKey: "pageSize")),
|
|
133
|
+
organisationId: try safeCast(query.value(forKey: "organisationId")),
|
|
134
|
+
entityId: query.value(forKey: "entityId") as? String,
|
|
135
|
+
entityTypes: try opt(query.value(forKey: "entityTypes") as? NSArray, enumList),
|
|
136
|
+
action: try opt(query.value(forKey: "action") as? String, deserializeEnum),
|
|
137
|
+
createdDateFrom: query.value(forKey: "createdDateFrom") as? String,
|
|
138
|
+
createdDateTo: query.value(forKey: "createdDateTo") as? String,
|
|
139
|
+
identifierId: query.value(forKey: "identifierId") as? String,
|
|
140
|
+
credentialId: query.value(forKey: "credentialId") as? String,
|
|
141
|
+
credentialSchemaId: query.value(forKey: "credentialSchemaId") as? String,
|
|
142
|
+
proofSchemaId: query.value(forKey: "proofSchemaId") as? String,
|
|
143
|
+
search: try deserializeHistorySearch(
|
|
144
|
+
text: query.value(forKey: "searchText") as? String,
|
|
145
|
+
type: query.value(forKey: "searchType") as? String
|
|
146
|
+
)
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private func deserializeHistorySearch(text: String?, type: String?) throws
|
|
151
|
+
-> HistorySearchBindingDto?
|
|
152
|
+
{
|
|
153
|
+
if text == nil {
|
|
154
|
+
return nil
|
|
155
|
+
}
|
|
819
156
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
case "FALLBACK_SCHEMA2024":
|
|
825
|
-
return .fallbackSchema2024
|
|
826
|
-
case "MDOC":
|
|
827
|
-
return .mdoc
|
|
828
|
-
case "SD_JWT_VC":
|
|
829
|
-
return .sdJwtVc
|
|
830
|
-
case let other:
|
|
831
|
-
return .other(value: other)
|
|
832
|
-
}
|
|
833
|
-
|
|
157
|
+
return HistorySearchBindingDto(
|
|
158
|
+
text: text!,
|
|
159
|
+
type: try opt(type, deserializeEnum)
|
|
160
|
+
)
|
|
834
161
|
}
|