@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/EventEmitter.swift
CHANGED
|
@@ -1,79 +1,91 @@
|
|
|
1
1
|
import Foundation
|
|
2
|
-
import React
|
|
3
2
|
import ProcivisOneCore
|
|
3
|
+
import React
|
|
4
4
|
|
|
5
5
|
@objc(ProcivisOneCoreEventEmitter)
|
|
6
6
|
class ProcivisOneCoreEventEmitter: NSObject {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
self.sendEvent(with: .rseShowPin, body: [
|
|
49
|
-
"flowType": flowType.rawValue,
|
|
50
|
-
"stage": stage.rawValue,
|
|
51
|
-
])
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
func sendHidePinEvent() {
|
|
55
|
-
self.sendEvent(with: .rseHidePin, body: nil)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
func sendPinStageChangeEvent(stage: PinFlowStage) {
|
|
59
|
-
self.sendEvent(with: .rsePinStageChanged, body: [
|
|
60
|
-
"stage": stage.rawValue,
|
|
61
|
-
])
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
func sendDigitsEnteredEvent(amount: Int) {
|
|
65
|
-
self.sendEvent(with: .rseDigitsEntered, body: [
|
|
66
|
-
"digitsEntered": amount,
|
|
67
|
-
])
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
func sendIncorrectPinEvent(attemptsLeft: Int) {
|
|
71
|
-
self.sendEvent(with: .rseIncorrectPin, body: [
|
|
72
|
-
"attemptsLeft": attemptsLeft,
|
|
73
|
-
])
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
private func sendEvent(with name: EventName!, body: Any!) {
|
|
77
|
-
self.eventEmitter?.sendEvent(withName: name.rawValue, body: body)
|
|
7
|
+
|
|
8
|
+
enum EventName: String, CaseIterable {
|
|
9
|
+
|
|
10
|
+
case rseShowPin = "RSE_SHOW_PIN"
|
|
11
|
+
case rseHidePin = "RSE_HIDE_PIN"
|
|
12
|
+
case rsePinStageChanged = "RSE_PIN_STAGE"
|
|
13
|
+
case rseDigitsEntered = "RSE_DIGITS_ENTERED"
|
|
14
|
+
case rseIncorrectPin = "RSE_INCORRECT_PIN"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
enum PinFlowType: String {
|
|
18
|
+
|
|
19
|
+
case subscribe = "SUBSCRIBE"
|
|
20
|
+
case transaction = "TRANSACTION"
|
|
21
|
+
case addBiometrics = "ADD_BIOMETRICS"
|
|
22
|
+
case changePin = "CHANGE_PIN"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
enum PinFlowStage: String {
|
|
26
|
+
|
|
27
|
+
case checkCurrentPin = "CHECK_CURRENT_PIN"
|
|
28
|
+
case newFirstPin = "NEW_FIRST_PIN"
|
|
29
|
+
case newSecondPin = "NEW_SECOND_PIN"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static let shared: ProcivisOneCoreEventEmitter = {
|
|
33
|
+
return ProcivisOneCoreEventEmitter()
|
|
34
|
+
}()
|
|
35
|
+
weak var eventEmitter: RCTEventEmitter?
|
|
36
|
+
|
|
37
|
+
static var supportedEvents: [String] {
|
|
38
|
+
return EventName.allCases.map(\.rawValue)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static var hasListeners: Bool = false
|
|
42
|
+
|
|
43
|
+
func sendShowPinEvent(flowType: PinFlowType, stage: PinFlowStage) throws {
|
|
44
|
+
guard ProcivisOneCoreEventEmitter.hasListeners else {
|
|
45
|
+
throw NativeKeyStorageError.Unknown(reason: "No UI listener")
|
|
78
46
|
}
|
|
47
|
+
|
|
48
|
+
self.sendEvent(
|
|
49
|
+
with: .rseShowPin,
|
|
50
|
+
body: [
|
|
51
|
+
"flowType": flowType.rawValue,
|
|
52
|
+
"stage": stage.rawValue,
|
|
53
|
+
]
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
func sendHidePinEvent() {
|
|
58
|
+
self.sendEvent(with: .rseHidePin, body: nil)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
func sendPinStageChangeEvent(stage: PinFlowStage) {
|
|
62
|
+
self.sendEvent(
|
|
63
|
+
with: .rsePinStageChanged,
|
|
64
|
+
body: [
|
|
65
|
+
"stage": stage.rawValue
|
|
66
|
+
]
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
func sendDigitsEnteredEvent(amount: Int) {
|
|
71
|
+
self.sendEvent(
|
|
72
|
+
with: .rseDigitsEntered,
|
|
73
|
+
body: [
|
|
74
|
+
"digitsEntered": amount
|
|
75
|
+
]
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
func sendIncorrectPinEvent(attemptsLeft: Int) {
|
|
80
|
+
self.sendEvent(
|
|
81
|
+
with: .rseIncorrectPin,
|
|
82
|
+
body: [
|
|
83
|
+
"attemptsLeft": attemptsLeft
|
|
84
|
+
]
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private func sendEvent(with name: EventName!, body: Any!) {
|
|
89
|
+
self.eventEmitter?.sendEvent(withName: name.rawValue, body: body)
|
|
90
|
+
}
|
|
79
91
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
+ (BOOL)requiresMainQueueSetup
|
|
14
14
|
{
|
|
15
|
-
|
|
15
|
+
return NO;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
RCT_EXTERN_METHOD(supportedEvents)
|
|
@@ -47,6 +47,22 @@ RCT_EXTERN_METHOD(getDids:(NSDictionary *)query
|
|
|
47
47
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
48
48
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
49
49
|
|
|
50
|
+
RCT_EXTERN_METHOD(createIdentifier:(NSDictionary *)identifierRequest
|
|
51
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
52
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
53
|
+
|
|
54
|
+
RCT_EXTERN_METHOD(getIdentifiers:(NSDictionary *)query
|
|
55
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
56
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
57
|
+
|
|
58
|
+
RCT_EXTERN_METHOD(getIdentifier:(NSString *)identifierId
|
|
59
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
60
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
61
|
+
|
|
62
|
+
RCT_EXTERN_METHOD(deleteIdentifier:(NSString *)identifierId
|
|
63
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
64
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
65
|
+
|
|
50
66
|
RCT_EXTERN_METHOD(handleInvitation:(NSString *)url
|
|
51
67
|
organisationId:(NSString *)organisationId
|
|
52
68
|
transport:(NSArray *)transport
|
|
@@ -55,6 +71,7 @@ RCT_EXTERN_METHOD(handleInvitation:(NSString *)url
|
|
|
55
71
|
|
|
56
72
|
RCT_EXTERN_METHOD(holderAcceptCredential:(NSString *)interactionId
|
|
57
73
|
didId:(NSString *)didId
|
|
74
|
+
identifierId:(NSString *)identifierId
|
|
58
75
|
keyId:(NSString *)keyId
|
|
59
76
|
txCode:(NSString *)txCode
|
|
60
77
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
@@ -75,6 +92,7 @@ RCT_EXTERN_METHOD(holderRejectProof:(NSString *)interactionId
|
|
|
75
92
|
RCT_EXTERN_METHOD(holderSubmitProof:(NSString *)interactionId
|
|
76
93
|
credentials:(NSDictionary *)credentials
|
|
77
94
|
didId:(NSString *)didId
|
|
95
|
+
identifierId:(NSString *)identifierId
|
|
78
96
|
keyId:(NSString *)keyId
|
|
79
97
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
80
98
|
rejecter:(RCTPromiseRejectBlock)reject)
|