@procivis/react-native-one-core 1.133039.0 → 1.136613.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/DeserializeSpecific.kt +20 -1
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +7 -5
- package/core-sdk.json +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/src/core.d.ts +1 -1
- package/dist/src/core.js +1 -1
- package/dist/src/one-core-uniffi-intf.d.ts +338 -288
- package/dist/src/one-core-uniffi-intf.js +53 -18
- package/ios/Deserialize.swift +60 -5
- package/ios/ProcivisOneCoreModule.m +2 -1
- package/ios/ProcivisOneCoreModule.swift +10 -7
- package/package.json +1 -1
|
@@ -42,24 +42,6 @@ export var CertificateState;
|
|
|
42
42
|
CertificateState["REVOKED"] = "REVOKED";
|
|
43
43
|
CertificateState["EXPIRED"] = "EXPIRED";
|
|
44
44
|
})(CertificateState || (CertificateState = {}));
|
|
45
|
-
export var CharacteristicPermission;
|
|
46
|
-
(function (CharacteristicPermission) {
|
|
47
|
-
CharacteristicPermission["READ"] = "READ";
|
|
48
|
-
CharacteristicPermission["WRITE"] = "WRITE";
|
|
49
|
-
})(CharacteristicPermission || (CharacteristicPermission = {}));
|
|
50
|
-
export var CharacteristicProperty;
|
|
51
|
-
(function (CharacteristicProperty) {
|
|
52
|
-
CharacteristicProperty["READ"] = "READ";
|
|
53
|
-
CharacteristicProperty["WRITE"] = "WRITE";
|
|
54
|
-
CharacteristicProperty["NOTIFY"] = "NOTIFY";
|
|
55
|
-
CharacteristicProperty["WRITE_WITHOUT_RESPONSE"] = "WRITE_WITHOUT_RESPONSE";
|
|
56
|
-
CharacteristicProperty["INDICATE"] = "INDICATE";
|
|
57
|
-
})(CharacteristicProperty || (CharacteristicProperty = {}));
|
|
58
|
-
export var CharacteristicWriteType;
|
|
59
|
-
(function (CharacteristicWriteType) {
|
|
60
|
-
CharacteristicWriteType["WITH_RESPONSE"] = "WITH_RESPONSE";
|
|
61
|
-
CharacteristicWriteType["WITHOUT_RESPONSE"] = "WITHOUT_RESPONSE";
|
|
62
|
-
})(CharacteristicWriteType || (CharacteristicWriteType = {}));
|
|
63
45
|
export var ClientIdScheme;
|
|
64
46
|
(function (ClientIdScheme) {
|
|
65
47
|
ClientIdScheme["REDIRECT_URI"] = "REDIRECT_URI";
|
|
@@ -89,8 +71,17 @@ export var CredentialListQuerySearchType;
|
|
|
89
71
|
})(CredentialListQuerySearchType || (CredentialListQuerySearchType = {}));
|
|
90
72
|
export var CredentialQueryFailureReason;
|
|
91
73
|
(function (CredentialQueryFailureReason) {
|
|
74
|
+
/** The wallet holds no credential of the requested type. */
|
|
92
75
|
CredentialQueryFailureReason["NO_CREDENTIAL"] = "NO_CREDENTIAL";
|
|
76
|
+
/**
|
|
77
|
+
* Credentials of the requested type exist, but none is currently
|
|
78
|
+
* valid.
|
|
79
|
+
*/
|
|
93
80
|
CredentialQueryFailureReason["VALIDITY"] = "VALIDITY";
|
|
81
|
+
/**
|
|
82
|
+
* Credentials of the requested type exist, but none satisfies the
|
|
83
|
+
* constraints of the request.
|
|
84
|
+
*/
|
|
94
85
|
CredentialQueryFailureReason["CONSTRAINT"] = "CONSTRAINT";
|
|
95
86
|
})(CredentialQueryFailureReason || (CredentialQueryFailureReason = {}));
|
|
96
87
|
export var CredentialRole;
|
|
@@ -157,6 +148,7 @@ export var EcosystemRole;
|
|
|
157
148
|
export var EcosystemTrustResult;
|
|
158
149
|
(function (EcosystemTrustResult) {
|
|
159
150
|
EcosystemTrustResult["TRUSTED"] = "TRUSTED";
|
|
151
|
+
EcosystemTrustResult["COMPLIANT"] = "COMPLIANT";
|
|
160
152
|
EcosystemTrustResult["NOT_TRUSTED"] = "NOT_TRUSTED";
|
|
161
153
|
})(EcosystemTrustResult || (EcosystemTrustResult = {}));
|
|
162
154
|
export var HistoryAction;
|
|
@@ -311,22 +303,64 @@ export var ProofListQueryExactColumn;
|
|
|
311
303
|
})(ProofListQueryExactColumn || (ProofListQueryExactColumn = {}));
|
|
312
304
|
export var ProofRole;
|
|
313
305
|
(function (ProofRole) {
|
|
306
|
+
/** The system received this request. */
|
|
314
307
|
ProofRole["HOLDER"] = "HOLDER";
|
|
308
|
+
/** The system made this request. */
|
|
315
309
|
ProofRole["VERIFIER"] = "VERIFIER";
|
|
316
310
|
})(ProofRole || (ProofRole = {}));
|
|
317
311
|
export var ProofSchemaListQueryExactColumn;
|
|
318
312
|
(function (ProofSchemaListQueryExactColumn) {
|
|
319
313
|
ProofSchemaListQueryExactColumn["NAME"] = "NAME";
|
|
320
314
|
})(ProofSchemaListQueryExactColumn || (ProofSchemaListQueryExactColumn = {}));
|
|
315
|
+
/**
|
|
316
|
+
* State of a proof request. Some states mean something different
|
|
317
|
+
* depending on whether the system is the holder or the verifier of the
|
|
318
|
+
* request. See [Proof States as a Verifier](https://docs.procivis.ch/verify/states)
|
|
319
|
+
* and [Proof States as a Holder](https://docs.procivis.ch/hold/manage-credentials-requests#proof-request-states-as-a-holder)
|
|
320
|
+
* for complete state diagrams.
|
|
321
|
+
*/
|
|
321
322
|
export var ProofState;
|
|
322
323
|
(function (ProofState) {
|
|
324
|
+
/**
|
|
325
|
+
* For verifiers, the request was created but not yet shared with a
|
|
326
|
+
* wallet.
|
|
327
|
+
*/
|
|
323
328
|
ProofState["CREATED"] = "CREATED";
|
|
329
|
+
/**
|
|
330
|
+
* Waiting for the other party. For verifiers, the request was shared
|
|
331
|
+
* or, for `ISO_MDL`, created from the wallet's engagement data. For
|
|
332
|
+
* holders, device engagement was started with `proposeProof`.
|
|
333
|
+
*/
|
|
324
334
|
ProofState["PENDING"] = "PENDING";
|
|
335
|
+
/**
|
|
336
|
+
* The request reached the wallet and is waiting for the holder to
|
|
337
|
+
* respond.
|
|
338
|
+
*/
|
|
325
339
|
ProofState["REQUESTED"] = "REQUESTED";
|
|
340
|
+
/**
|
|
341
|
+
* For verifiers, the presentation was received and verified. For
|
|
342
|
+
* holders, the presentation was submitted.
|
|
343
|
+
*/
|
|
326
344
|
ProofState["ACCEPTED"] = "ACCEPTED";
|
|
345
|
+
/**
|
|
346
|
+
* The holder rejected the request. Not all protocols report a
|
|
347
|
+
* rejection to the verifier.
|
|
348
|
+
*/
|
|
327
349
|
ProofState["REJECTED"] = "REJECTED";
|
|
350
|
+
/**
|
|
351
|
+
* The request was cancelled with `deleteProof` after it reached
|
|
352
|
+
* `REQUESTED`. The history of the interaction is retained.
|
|
353
|
+
*/
|
|
328
354
|
ProofState["RETRACTED"] = "RETRACTED";
|
|
355
|
+
/**
|
|
356
|
+
* A technical error occurred or, for verifiers, the presentation
|
|
357
|
+
* could not be verified.
|
|
358
|
+
*/
|
|
329
359
|
ProofState["ERROR"] = "ERROR";
|
|
360
|
+
/**
|
|
361
|
+
* For verifiers, the shared request expired before a wallet
|
|
362
|
+
* connected. Share it again with `shareProof`.
|
|
363
|
+
*/
|
|
330
364
|
ProofState["INTERACTION_EXPIRED"] = "INTERACTION_EXPIRED";
|
|
331
365
|
})(ProofState || (ProofState = {}));
|
|
332
366
|
export var SortDirection;
|
|
@@ -392,6 +426,7 @@ export var TransactionCodeType;
|
|
|
392
426
|
export var TrustResolutionResult;
|
|
393
427
|
(function (TrustResolutionResult) {
|
|
394
428
|
TrustResolutionResult["TRUSTED"] = "TRUSTED";
|
|
429
|
+
TrustResolutionResult["COMPLIANT"] = "COMPLIANT";
|
|
395
430
|
TrustResolutionResult["UNTRUSTED"] = "UNTRUSTED";
|
|
396
431
|
TrustResolutionResult["UNKNOWN"] = "UNKNOWN";
|
|
397
432
|
})(TrustResolutionResult || (TrustResolutionResult = {}));
|
package/ios/Deserialize.swift
CHANGED
|
@@ -30,7 +30,10 @@ private func deserializeEnum<T: CaseIterable>(_ input: String) throws -> T {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
private func opt<F, T>(
|
|
33
|
+
private func opt<F, T>(
|
|
34
|
+
_ input: F?,
|
|
35
|
+
_ deserializeFn: @escaping (_ input: F) throws -> T
|
|
36
|
+
) throws
|
|
34
37
|
-> T?
|
|
35
38
|
{
|
|
36
39
|
if input != nil {
|
|
@@ -43,7 +46,8 @@ private func safeCast<T>(_ input: Any?) throws -> T {
|
|
|
43
46
|
if let result = input as? T {
|
|
44
47
|
return result
|
|
45
48
|
} else {
|
|
46
|
-
let description =
|
|
49
|
+
let description =
|
|
50
|
+
"Invalid input for type \(T.self): \(String(describing: input))"
|
|
47
51
|
throw DecodingError.typeMismatch(
|
|
48
52
|
T.self,
|
|
49
53
|
DecodingError.Context(codingPath: [], debugDescription: description)
|
|
@@ -65,7 +69,11 @@ func deserializeOpt<T: Decodable>(_ value: Any?) throws -> T? {
|
|
|
65
69
|
return try deserialize(value!)
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
private func deserializeSpecific(
|
|
72
|
+
private func deserializeSpecific(
|
|
73
|
+
_ value: Any,
|
|
74
|
+
_ type: Any.Type,
|
|
75
|
+
_ codingPath: [CodingKey]
|
|
76
|
+
) throws
|
|
69
77
|
-> Any?
|
|
70
78
|
{
|
|
71
79
|
if type == OptionalString.self {
|
|
@@ -74,10 +82,14 @@ private func deserializeSpecific(_ value: Any, _ type: Any.Type, _ codingPath: [
|
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
guard let data = value as? String else {
|
|
77
|
-
let description =
|
|
85
|
+
let description =
|
|
86
|
+
"Expected to decode \(type) but found '\(value)' instead."
|
|
78
87
|
throw DecodingError.typeMismatch(
|
|
79
88
|
type,
|
|
80
|
-
DecodingError.Context(
|
|
89
|
+
DecodingError.Context(
|
|
90
|
+
codingPath: codingPath,
|
|
91
|
+
debugDescription: description
|
|
92
|
+
)
|
|
81
93
|
)
|
|
82
94
|
}
|
|
83
95
|
return OptionalString.some(value: data)
|
|
@@ -85,3 +97,46 @@ private func deserializeSpecific(_ value: Any, _ type: Any.Type, _ codingPath: [
|
|
|
85
97
|
|
|
86
98
|
return nil
|
|
87
99
|
}
|
|
100
|
+
|
|
101
|
+
func deserializeHandleInvitationRequest(_ request: NSDictionary) throws
|
|
102
|
+
-> HandleInvitationRequest
|
|
103
|
+
{
|
|
104
|
+
let data = try deserializeHandleInvitationRequestData(
|
|
105
|
+
request["data"] as? NSDictionary
|
|
106
|
+
)
|
|
107
|
+
guard let organisationId = request["organisationId"] as? String else {
|
|
108
|
+
throw DecodingError.typeMismatch(
|
|
109
|
+
HandleInvitationRequest.self,
|
|
110
|
+
DecodingError.Context(
|
|
111
|
+
codingPath: [],
|
|
112
|
+
debugDescription: "missing organisationId"
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
return HandleInvitationRequest(
|
|
117
|
+
data: data,
|
|
118
|
+
organisationId: organisationId,
|
|
119
|
+
transport: try deserializeOpt(request["transport"]),
|
|
120
|
+
redirectUri: try deserializeOpt(request["redirectUri"]),
|
|
121
|
+
ecosystem: try deserializeOpt(request["ecosystem"])
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
func deserializeHandleInvitationRequestData(_ data: NSDictionary?) throws
|
|
126
|
+
-> HandleInvitationRequestData
|
|
127
|
+
{
|
|
128
|
+
guard let data = data,
|
|
129
|
+
let enum_type = data["type_"] as? String,
|
|
130
|
+
enum_type == "URL",
|
|
131
|
+
let url = data["url"] as? String
|
|
132
|
+
else {
|
|
133
|
+
throw DecodingError.typeMismatch(
|
|
134
|
+
HandleInvitationRequestData.self,
|
|
135
|
+
DecodingError.Context(
|
|
136
|
+
codingPath: [],
|
|
137
|
+
debugDescription: "Invalid HandleInvitationRequestData"
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
return HandleInvitationRequestData.url(url: url)
|
|
142
|
+
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
RCT_EXTERN_METHOD(supportedEvents)
|
|
19
19
|
|
|
20
20
|
RCT_EXTERN_METHOD(initialize:(NSString *)configJson
|
|
21
|
+
dataDirPath:(NSString *)dataDirPath
|
|
21
22
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
22
23
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
23
24
|
|
|
@@ -31,7 +32,7 @@ RCT_EXTERN_METHOD(createOrganisation:(NSDictionary *)request
|
|
|
31
32
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
32
33
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
33
34
|
|
|
34
|
-
RCT_EXTERN_METHOD(
|
|
35
|
+
RCT_EXTERN_METHOD(updateOrganisation:(NSDictionary *)request
|
|
35
36
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
36
37
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
37
38
|
|
|
@@ -22,9 +22,10 @@ class ProcivisOneCoreModule: RCTEventEmitter {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
@objc(initialize:resolver:rejecter:)
|
|
25
|
+
@objc(initialize:dataDirPath:resolver:rejecter:)
|
|
26
26
|
func initialize(
|
|
27
27
|
configJson: String,
|
|
28
|
+
dataDirPath: String?,
|
|
28
29
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
29
30
|
reject: @escaping RCTPromiseRejectBlock
|
|
30
31
|
) {
|
|
@@ -60,8 +61,10 @@ class ProcivisOneCoreModule: RCTEventEmitter {
|
|
|
60
61
|
bleCentral: IOSBLECentral(),
|
|
61
62
|
blePeripheral: IOSBLEPeripheral(),
|
|
62
63
|
nfcHce: nfcHce,
|
|
63
|
-
nfcScanner: NFCScanner()
|
|
64
|
-
|
|
64
|
+
nfcScanner: NFCScanner(),
|
|
65
|
+
credentialManager: nil,
|
|
66
|
+
),
|
|
67
|
+
dataDirPath: dataDirPath,
|
|
65
68
|
)
|
|
66
69
|
|
|
67
70
|
return nil as NSDictionary?
|
|
@@ -110,14 +113,14 @@ class ProcivisOneCoreModule: RCTEventEmitter {
|
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
@objc(
|
|
114
|
-
func
|
|
116
|
+
@objc(updateOrganisation:resolver:rejecter:)
|
|
117
|
+
func updateOrganisation(
|
|
115
118
|
request: NSDictionary,
|
|
116
119
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
117
120
|
reject: @escaping RCTPromiseRejectBlock
|
|
118
121
|
) {
|
|
119
122
|
asyncCall(resolve, reject) {
|
|
120
|
-
try await self.getCore().
|
|
123
|
+
try await self.getCore().updateOrganisation(request: try deserialize(request))
|
|
121
124
|
return nil as NSDictionary?
|
|
122
125
|
}
|
|
123
126
|
}
|
|
@@ -222,7 +225,7 @@ class ProcivisOneCoreModule: RCTEventEmitter {
|
|
|
222
225
|
reject: @escaping RCTPromiseRejectBlock
|
|
223
226
|
) {
|
|
224
227
|
asyncCall(resolve, reject) {
|
|
225
|
-
let result = try await self.getCore().handleInvitation(request: try
|
|
228
|
+
let result = try await self.getCore().handleInvitation(request: try deserializeHandleInvitationRequest(request))
|
|
226
229
|
return try serializeAny(result)
|
|
227
230
|
}
|
|
228
231
|
}
|