@procivis/react-native-one-core 1.60807.0 → 1.73295.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +68 -25
- package/android/src/main/java/ch/procivis/one/core/SerializeSpecific.kt +63 -0
- package/core-sdk.json +6 -6
- package/dist/src/cache.d.ts +4 -1
- package/dist/src/cache.js +3 -0
- package/dist/src/config.d.ts +7 -4
- package/dist/src/config.js +3 -1
- package/dist/src/core.d.ts +12 -10
- package/dist/src/core.js +4 -2
- package/dist/src/credential.d.ts +21 -16
- package/dist/src/credentialSchema.d.ts +7 -16
- package/dist/src/credentialSchema.js +7 -13
- package/dist/src/history.d.ts +2 -0
- package/dist/src/identifier.d.ts +1 -1
- package/dist/src/nfc.d.ts +1 -0
- package/dist/src/nfc.js +3 -1
- package/dist/src/proof.d.ts +42 -3
- package/dist/src/proofSchema.d.ts +2 -3
- package/dist/src/trust.d.ts +8 -3
- package/dist/src/walletUnit.d.ts +10 -21
- package/dist/src/walletUnit.js +7 -7
- package/ios/ProcivisOneCoreModule.m +18 -15
- package/ios/ProcivisOneCoreModule.swift +68 -42
- package/ios/RSEKeyStorage.swift +67 -51
- package/ios/Serialize.swift +45 -11
- package/package.json +1 -1
package/ios/Serialize.swift
CHANGED
|
@@ -16,15 +16,15 @@ func serializeAny<T: Encodable>(_ value: T) throws -> Any {
|
|
|
16
16
|
|
|
17
17
|
// Enum values serialization
|
|
18
18
|
func serializeEnumValue<T>(value: T) -> String {
|
|
19
|
-
|
|
19
|
+
return String(describing: value).snakeCased()
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
private let snakeCaseRegex = try! NSRegularExpression(pattern: "([a-z0-9])([A-Z])", options: [])
|
|
23
23
|
extension String {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
28
|
}
|
|
29
29
|
|
|
30
30
|
private func serializeSpecific(_ value: Encodable) throws -> Any? {
|
|
@@ -39,7 +39,11 @@ private func serializeSpecific(_ value: Encodable) throws -> Any? {
|
|
|
39
39
|
return try serialize(proofRequestClaimValue: data)
|
|
40
40
|
case let data as HandleInvitationResponseBindingEnum:
|
|
41
41
|
return try serialize(invitationResponse: data)
|
|
42
|
-
|
|
42
|
+
case let data as CredentialQueryResponseBindingDto:
|
|
43
|
+
return try serialize(credentialQuery: data)
|
|
44
|
+
case let data as PresentationDefinitionV2ClaimValueBindingDto:
|
|
45
|
+
return try serialize(presentationDefinitionV2ClaimValue: data)
|
|
46
|
+
|
|
43
47
|
default:
|
|
44
48
|
return nil
|
|
45
49
|
}
|
|
@@ -97,17 +101,21 @@ private func serialize(proofRequestClaimValue: ProofRequestClaimValueBindingDto)
|
|
|
97
101
|
|
|
98
102
|
private func serialize(invitationResponse: HandleInvitationResponseBindingEnum) throws -> NSDictionary {
|
|
99
103
|
switch (invitationResponse) {
|
|
100
|
-
case let .credentialIssuance(interactionId,
|
|
104
|
+
case let .credentialIssuance(interactionId, keyStorageSecurityLevels, keyAlgorithms, txCode):
|
|
101
105
|
var result: [String: Any] = [
|
|
102
|
-
"interactionId": interactionId
|
|
103
|
-
"credentialIds": credentialIds,
|
|
104
|
-
"credentialConfigurationsSupported": try serializeAny(credentialConfigurationsSupported)
|
|
106
|
+
"interactionId": interactionId
|
|
105
107
|
];
|
|
108
|
+
if let keyStorageSecurityLevels = keyStorageSecurityLevels {
|
|
109
|
+
result["keyStorageSecurityLevels"] = keyStorageSecurityLevels.map { serializeEnumValue(value: $0) }
|
|
110
|
+
}
|
|
111
|
+
if let keyAlgorithms = keyAlgorithms {
|
|
112
|
+
result["keyAlgorithms"] = try serializeAny(keyAlgorithms)
|
|
113
|
+
}
|
|
106
114
|
if let txCode = txCode {
|
|
107
115
|
result["txCode"] = try serializeAny(txCode)
|
|
108
116
|
}
|
|
109
117
|
return result as NSDictionary;
|
|
110
|
-
|
|
118
|
+
|
|
111
119
|
case let .proofRequest(interactionId, proofId):
|
|
112
120
|
return [
|
|
113
121
|
"interactionId": interactionId,
|
|
@@ -121,3 +129,29 @@ private func serialize(invitationResponse: HandleInvitationResponseBindingEnum)
|
|
|
121
129
|
];
|
|
122
130
|
}
|
|
123
131
|
}
|
|
132
|
+
|
|
133
|
+
private func serialize(credentialQuery: CredentialQueryResponseBindingDto) throws -> Any {
|
|
134
|
+
var result: [String: Any] = ["multiple": credentialQuery.multiple]
|
|
135
|
+
switch (credentialQuery.credentialOrFailureHint) {
|
|
136
|
+
case let .applicableCredentials(applicableCredentials: value):
|
|
137
|
+
result["applicableCredentials"] = try serializeAny(value);
|
|
138
|
+
case let .failureHint(failureHint: value):
|
|
139
|
+
result["failureHint"] = try serializeAny(value);
|
|
140
|
+
}
|
|
141
|
+
return result as NSDictionary;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private func serialize(presentationDefinitionV2ClaimValue: PresentationDefinitionV2ClaimValueBindingDto) throws -> Any {
|
|
145
|
+
switch (presentationDefinitionV2ClaimValue) {
|
|
146
|
+
case let .boolean(value):
|
|
147
|
+
return value;
|
|
148
|
+
case let .float(value):
|
|
149
|
+
return value;
|
|
150
|
+
case let .integer(value):
|
|
151
|
+
return NSNumber(value: value);
|
|
152
|
+
case let .string(value):
|
|
153
|
+
return value;
|
|
154
|
+
case .nested(value: let values):
|
|
155
|
+
return try values.map { try serializeAny($0) }
|
|
156
|
+
}
|
|
157
|
+
}
|