@procivis/react-native-one-core 1.26730.0 → 1.33398.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/README.md +66 -17
- package/android/build.gradle +19 -7
- package/android/src/main/java/ch/procivis/one/core/Deserialize.kt +5 -1
- package/android/src/main/java/ch/procivis/one/core/DeserializeSpecific.kt +10 -3
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +158 -73
- package/android/src/main/java/ch/procivis/one/core/SerializeSpecific.kt +7 -1
- package/android/src/main/java/ch/procivis/one/core/Util.kt +42 -10
- package/core-sdk.json +6 -6
- package/dist/index.d.ts +3 -8
- package/dist/index.js +22 -22
- package/dist/src/cache.d.ts +12 -0
- package/dist/src/cache.js +14 -0
- package/dist/src/config.d.ts +29 -4
- package/dist/src/config.js +19 -0
- package/dist/src/core.d.ts +18 -6
- package/dist/src/core.js +1 -0
- package/dist/src/credential.d.ts +14 -1
- package/dist/src/credential.js +5 -0
- package/dist/src/did.d.ts +9 -5
- package/dist/src/error.d.ts +10 -17
- package/dist/src/error.js +5 -14
- package/dist/src/history.d.ts +0 -1
- package/dist/src/history.js +0 -1
- package/dist/src/key.d.ts +3 -0
- package/dist/src/proof.d.ts +13 -1
- package/dist/src/proof.js +5 -0
- package/dist/src/proofSchema.d.ts +2 -0
- package/dist/src/trust.d.ts +85 -19
- package/dist/src/trust.js +28 -7
- package/ios/Deserialize.swift +162 -21
- package/ios/ProcivisOneCoreModule.m +46 -4
- package/ios/ProcivisOneCoreModule.swift +179 -82
- package/ios/Serialize.swift +72 -15
- package/ios/Util.swift +20 -24
- package/package.json +2 -2
package/ios/Serialize.swift
CHANGED
|
@@ -58,6 +58,7 @@ func serialize(config: ConfigBindingDto) -> NSDictionary {
|
|
|
58
58
|
"datatype": config.datatype,
|
|
59
59
|
"keyAlgorithm": config.keyAlgorithm,
|
|
60
60
|
"keyStorage": config.keyStorage,
|
|
61
|
+
"trustManagement": config.trustManagement,
|
|
61
62
|
"cacheEntities": config.cacheEntities,
|
|
62
63
|
]
|
|
63
64
|
}
|
|
@@ -212,7 +213,8 @@ func serialize(credentialDetail: CredentialDetailBindingDto) -> NSDictionary {
|
|
|
212
213
|
"role": serializeEnumValue(value: credentialDetail.role),
|
|
213
214
|
]
|
|
214
215
|
result.addOpt("revocationDate", credentialDetail.revocationDate)
|
|
215
|
-
result.addOpt("issuerDid", credentialDetail.issuerDid)
|
|
216
|
+
result.addOpt("issuerDid", opt(credentialDetail.issuerDid, {issuerDid in serialize(didListItem: issuerDid)}))
|
|
217
|
+
result.addOpt("holderDid", opt(credentialDetail.holderDid, {holderDid in serialize(didListItem: holderDid)}))
|
|
216
218
|
result.addOpt("redirectUri", credentialDetail.redirectUri)
|
|
217
219
|
result.addOpt("lvvcIssuanceDate", credentialDetail.lvvcIssuanceDate)
|
|
218
220
|
result.addOpt("suspendEndDate", credentialDetail.suspendEndDate)
|
|
@@ -297,7 +299,8 @@ func serialize(proofRequest: ProofRequestBindingDto) -> NSDictionary {
|
|
|
297
299
|
"exchange": proofRequest.exchange,
|
|
298
300
|
]
|
|
299
301
|
result.addOpt("proofSchema", opt(proofRequest.proofSchema, {proofSchema in serialize(proofSchemaListItem: proofSchema) }))
|
|
300
|
-
result.addOpt("verifierDid", proofRequest.verifierDid)
|
|
302
|
+
result.addOpt("verifierDid", opt(proofRequest.verifierDid, {verifierDid in serialize(didListItem: verifierDid)}))
|
|
303
|
+
result.addOpt("holderDid", opt(proofRequest.holderDid, {holderDid in serialize(didListItem: holderDid)}))
|
|
301
304
|
result.addOpt("redirectUri", proofRequest.redirectUri)
|
|
302
305
|
return result as NSDictionary
|
|
303
306
|
}
|
|
@@ -378,6 +381,7 @@ func serialize(proofRequestClaimValue: ProofRequestClaimValueBindingDto) -> Any
|
|
|
378
381
|
func serialize(proofClaimSchema: ProofClaimSchemaBindingDto) -> NSDictionary {
|
|
379
382
|
return [
|
|
380
383
|
"id": proofClaimSchema.id,
|
|
384
|
+
"requested": proofClaimSchema.requested,
|
|
381
385
|
"required": proofClaimSchema.required,
|
|
382
386
|
"key": proofClaimSchema.key,
|
|
383
387
|
"dataType": proofClaimSchema.dataType,
|
|
@@ -529,12 +533,16 @@ func serialize(importBackupMetadata: MetadataBindingDto) -> NSDictionary {
|
|
|
529
533
|
|
|
530
534
|
func serialize(invitationResponse: HandleInvitationResponseBindingEnum) -> NSDictionary {
|
|
531
535
|
switch (invitationResponse) {
|
|
532
|
-
case let .credentialIssuance(interactionId, credentialIds):
|
|
533
|
-
|
|
536
|
+
case let .credentialIssuance(interactionId, credentialIds, txCode):
|
|
537
|
+
var result: [String: Any] = [
|
|
534
538
|
"interactionId": interactionId,
|
|
535
539
|
"credentialIds": credentialIds
|
|
536
540
|
];
|
|
537
541
|
|
|
542
|
+
result.addOpt("txCode", opt(txCode, { serialize(txCode: $0) }));
|
|
543
|
+
|
|
544
|
+
return result as NSDictionary;
|
|
545
|
+
|
|
538
546
|
case let .proofRequest(interactionId, proofId):
|
|
539
547
|
return [
|
|
540
548
|
"interactionId": interactionId,
|
|
@@ -543,6 +551,16 @@ func serialize(invitationResponse: HandleInvitationResponseBindingEnum) -> NSDic
|
|
|
543
551
|
}
|
|
544
552
|
}
|
|
545
553
|
|
|
554
|
+
func serialize(txCode: OpenId4vciTxCodeBindingDto) -> NSDictionary {
|
|
555
|
+
var result: [String: Any] = [:];
|
|
556
|
+
|
|
557
|
+
result.addOpt("inputMode", opt(txCode.inputMode, serializeEnumValue));
|
|
558
|
+
result.addOpt("length", txCode.length);
|
|
559
|
+
result.addOpt("description", txCode.description);
|
|
560
|
+
|
|
561
|
+
return result as NSDictionary;
|
|
562
|
+
}
|
|
563
|
+
|
|
546
564
|
func serialize(shareProofResponse: ShareProofResponseBindingDto) -> NSDictionary {
|
|
547
565
|
return [
|
|
548
566
|
"url": shareProofResponse.url,
|
|
@@ -568,18 +586,15 @@ func serialize(resolveJsonLdContextResponse: ResolveJsonLdContextResponseBinding
|
|
|
568
586
|
}
|
|
569
587
|
|
|
570
588
|
func serialize(trustAnchor: GetTrustAnchorResponseBindingDto) -> NSDictionary {
|
|
571
|
-
|
|
589
|
+
return [
|
|
572
590
|
"id": trustAnchor.id,
|
|
573
591
|
"createdDate": trustAnchor.createdDate,
|
|
574
592
|
"lastModified": trustAnchor.lastModified,
|
|
575
593
|
"name": trustAnchor.name,
|
|
576
594
|
"type": trustAnchor.type,
|
|
577
|
-
"
|
|
578
|
-
"
|
|
595
|
+
"isPublisher": trustAnchor.isPublisher,
|
|
596
|
+
"publisherReference": trustAnchor.publisherReference,
|
|
579
597
|
]
|
|
580
|
-
result.addOpt("publisherReference", trustAnchor.publisherReference)
|
|
581
|
-
result.addOpt("priority", trustAnchor.priority)
|
|
582
|
-
return result as NSDictionary
|
|
583
598
|
}
|
|
584
599
|
|
|
585
600
|
func serialize(trustAnchorList: TrustAnchorsListBindingDto) -> NSDictionary {
|
|
@@ -590,18 +605,60 @@ func serialize(trustAnchorList: TrustAnchorsListBindingDto) -> NSDictionary {
|
|
|
590
605
|
]
|
|
591
606
|
}
|
|
592
607
|
|
|
608
|
+
func serialize(trustEntityList: TrustEntitiesListBindingDto) -> NSDictionary {
|
|
609
|
+
return [
|
|
610
|
+
"totalItems": trustEntityList.totalItems,
|
|
611
|
+
"totalPages": trustEntityList.totalPages,
|
|
612
|
+
"values": trustEntityList.values.map { serialize(trustEntityListItem: $0) },
|
|
613
|
+
]
|
|
614
|
+
}
|
|
615
|
+
|
|
593
616
|
func serialize(trustAnchorListItem: TrustAnchorsListItemResponseBindingDto) -> NSDictionary {
|
|
594
|
-
|
|
617
|
+
return [
|
|
595
618
|
"id": trustAnchorListItem.id,
|
|
596
619
|
"createdDate": trustAnchorListItem.createdDate,
|
|
597
620
|
"lastModified": trustAnchorListItem.lastModified,
|
|
598
621
|
"name": trustAnchorListItem.name,
|
|
599
622
|
"type": trustAnchorListItem.type,
|
|
600
|
-
"
|
|
601
|
-
"
|
|
623
|
+
"isPublisher": trustAnchorListItem.isPublisher,
|
|
624
|
+
"publisherReference": trustAnchorListItem.publisherReference,
|
|
602
625
|
"entities": trustAnchorListItem.entities,
|
|
603
626
|
]
|
|
604
|
-
|
|
605
|
-
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
func serialize(trustEntity: GetTrustEntityResponseBindingDto) -> NSDictionary {
|
|
630
|
+
var result: [String: Any] = [
|
|
631
|
+
"id": trustEntity.id,
|
|
632
|
+
"organisationId": trustEntity.organisationId,
|
|
633
|
+
"createdDate": trustEntity.createdDate,
|
|
634
|
+
"lastModified": trustEntity.lastModified,
|
|
635
|
+
"name": trustEntity.name,
|
|
636
|
+
"role": serializeEnumValue(value: trustEntity.role),
|
|
637
|
+
"trustAnchor": serialize(trustAnchor: trustEntity.trustAnchor),
|
|
638
|
+
"did": serialize(didListItem: trustEntity.did),
|
|
639
|
+
"state": serializeEnumValue(value: trustEntity.state),
|
|
640
|
+
]
|
|
641
|
+
result.addOpt("logo", trustEntity.logo)
|
|
642
|
+
result.addOpt("website", trustEntity.website)
|
|
643
|
+
result.addOpt("termsUrl", trustEntity.termsUrl)
|
|
644
|
+
result.addOpt("privacyUrl", trustEntity.privacyUrl)
|
|
645
|
+
return result as NSDictionary
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
func serialize(trustEntityListItem: TrustEntitiesListItemResponseBindingDto) -> NSDictionary {
|
|
649
|
+
var result: [String: Any] = [
|
|
650
|
+
"id": trustEntityListItem.id,
|
|
651
|
+
"createdDate": trustEntityListItem.createdDate,
|
|
652
|
+
"lastModified": trustEntityListItem.lastModified,
|
|
653
|
+
"name": trustEntityListItem.name,
|
|
654
|
+
"role": serializeEnumValue(value: trustEntityListItem.role),
|
|
655
|
+
"trustAnchor": serialize(trustAnchor: trustEntityListItem.trustAnchor),
|
|
656
|
+
"did": serialize(didListItem: trustEntityListItem.did),
|
|
657
|
+
"state": serializeEnumValue(value: trustEntityListItem.state),
|
|
658
|
+
]
|
|
659
|
+
result.addOpt("logo", trustEntityListItem.logo)
|
|
660
|
+
result.addOpt("website", trustEntityListItem.website)
|
|
661
|
+
result.addOpt("termsUrl", trustEntityListItem.termsUrl)
|
|
662
|
+
result.addOpt("privacyUrl", trustEntityListItem.privacyUrl)
|
|
606
663
|
return result as NSDictionary
|
|
607
664
|
}
|
package/ios/Util.swift
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
|
|
10
10
|
// Error handling
|
|
11
|
-
func
|
|
11
|
+
func syncCall<Result>(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
12
12
|
_ reject: @escaping RCTPromiseRejectBlock, _ function: () throws -> Result) {
|
|
13
13
|
do {
|
|
14
14
|
resolve(try function());
|
|
@@ -17,31 +17,27 @@ func asyncCall<Result>(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
reject("UnknownError", input, error)
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (match.numberOfRanges != 3) {
|
|
33
|
-
reject("UnknownError", input, error)
|
|
34
|
-
return
|
|
20
|
+
func asyncCall<Result>(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
21
|
+
_ reject: @escaping RCTPromiseRejectBlock, _ function: @escaping () async throws -> Result) {
|
|
22
|
+
Task {
|
|
23
|
+
do {
|
|
24
|
+
resolve(try await function());
|
|
25
|
+
} catch {
|
|
26
|
+
handleError(error: error, reject);
|
|
27
|
+
}
|
|
35
28
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private func handleError(error: Error, _ reject: @escaping RCTPromiseRejectBlock) {
|
|
32
|
+
if case BindingError.ErrorResponse(data: let errorResponse) = error {
|
|
33
|
+
var userInfo: [String: Any] = [NSUnderlyingErrorKey: error]
|
|
34
|
+
if let cause = errorResponse.cause?.message {
|
|
35
|
+
userInfo["cause"] = cause
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
reject(errorResponse.code, errorResponse.message, NSError(domain: "one-core", code: 1, userInfo: userInfo))
|
|
41
39
|
return
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
let message = String(input[m])
|
|
46
|
-
reject(code, message, error)
|
|
42
|
+
reject("UnknownError", String(describing: error), error)
|
|
47
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@procivis/react-native-one-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33398.0",
|
|
4
4
|
"author": "Procivis AG (https://procivis.ch)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "ONE core bindings for React Native",
|
|
@@ -37,4 +37,4 @@
|
|
|
37
37
|
"jest": "^29.5.0",
|
|
38
38
|
"typescript": "^5.1.6"
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|