@procivis/react-native-one-core 1.60807.0 → 1.67952.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.
@@ -22,6 +22,7 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
22
22
  override fun getName() = "ProcivisOneCoreModule"
23
23
 
24
24
  private var oneCore: OneCoreBindingInterface? = null
25
+ private var nfcHce: NfcHce = NfcHCE(reactContext)
25
26
  private val scope = CoroutineScope(EmptyCoroutineContext)
26
27
 
27
28
  private fun getCore(): OneCoreBindingInterface {
@@ -60,7 +61,7 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
60
61
  remoteSecureElement = ubiqu,
61
62
  bleCentral = AndroidBLECentral(context),
62
63
  blePeripheral = AndroidBLEPeripheral(context),
63
- nfcHce = NfcHCE(context),
64
+ nfcHce = nfcHce,
64
65
  nfcScanner = NfcScanner(context) { context.currentActivity }
65
66
  )
66
67
  )
@@ -204,8 +205,7 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
204
205
  promise: Promise
205
206
  ) {
206
207
  asyncCall(promise, scope) {
207
- getCore().holderAcceptCredential(interactionId, didId, identifierId, keyId, txCode)
208
- return@asyncCall null
208
+ return@asyncCall getCore().holderAcceptCredential(interactionId, didId, identifierId, keyId, txCode)
209
209
  }
210
210
  }
211
211
 
@@ -241,6 +241,14 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
241
241
  }
242
242
  }
243
243
 
244
+ @ReactMethod
245
+ fun getPresentationDefinitionV2(proofId: String, promise: Promise) {
246
+ asyncCall(promise, scope) {
247
+ val presentationDefinition = getCore().getPresentationDefinitionV2(proofId)
248
+ return@asyncCall convertToRN(presentationDefinition)
249
+ }
250
+ }
251
+
244
252
  @ReactMethod
245
253
  fun holderRejectProof(interactionId: String, promise: Promise) {
246
254
  asyncCall(promise, scope) {
@@ -290,6 +298,49 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
290
298
  }
291
299
  }
292
300
 
301
+ @ReactMethod
302
+ fun holderSubmitProofV2(
303
+ interactionId: String,
304
+ credentials: ReadableMap,
305
+ promise: Promise
306
+ ) {
307
+ asyncCall(promise, scope) {
308
+ val submission =
309
+ mutableMapOf<String, List<PresentationSubmitV2CredentialRequestBindingDto>>()
310
+ for (entry in credentials.entryIterator) {
311
+ val credentialList = when (val credentialValue = entry.value) {
312
+ is ReadableMap -> {
313
+ // Single credential object - convert to list
314
+ listOf(
315
+ construct<PresentationSubmitV2CredentialRequestBindingDto>(
316
+ credentialValue
317
+ )
318
+ )
319
+ }
320
+
321
+ is ReadableArray -> {
322
+ // Array of credentials - convert each one
323
+ (0 until credentialValue.size()).map { index ->
324
+ construct<PresentationSubmitV2CredentialRequestBindingDto>(
325
+ credentialValue.getMap(index)!!
326
+ )
327
+ }
328
+ }
329
+
330
+ else -> {
331
+ throw IllegalArgumentException("Credential value must be either a Map or Array")
332
+ }
333
+ }
334
+ submission[entry.key] = credentialList
335
+ }
336
+ getCore().holderSubmitProofV2(
337
+ interactionId,
338
+ submission
339
+ )
340
+ return@asyncCall null
341
+ }
342
+ }
343
+
293
344
  @ReactMethod
294
345
  fun getCredentials(query: ReadableMap, promise: Promise) {
295
346
  asyncCall(promise, scope) {
@@ -385,10 +436,9 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
385
436
  }
386
437
 
387
438
  @ReactMethod
388
- fun proposeProof(exchange: String, organisationId: String, engagement: ReadableArray, promise: Promise) {
439
+ fun proposeProof(request: ReadableMap, promise: Promise) {
389
440
  asyncCall(promise, scope) {
390
- val engagement = DeserializeSpecific.ids(engagement)
391
- val result = getCore().proposeProof(exchange, organisationId, engagement)
441
+ val result = getCore().proposeProof(construct(request))
392
442
  return@asyncCall convertToRN(result)
393
443
  }
394
444
  }
@@ -664,6 +714,13 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
664
714
  }
665
715
  }
666
716
 
717
+ @ReactMethod
718
+ fun isNfcHceSupported(promise: Promise) {
719
+ asyncCall(promise, scope) {
720
+ return@asyncCall nfcHce.isSupported()
721
+ }
722
+ }
723
+
667
724
  // ===== Ubiqu specific methods
668
725
  @ReactMethod
669
726
  fun changeRSEPin(promise: Promise) {
@@ -12,6 +12,8 @@ object SerializeSpecific {
12
12
  HistoryMetadataBinding::class.java,
13
13
  ClaimBindingDto::class.java,
14
14
  ProofRequestClaimBindingDto::class.java,
15
+ CredentialQueryResponseBindingDto::class.java,
16
+ PresentationDefinitionV2ClaimBindingDto::class.java
15
17
  )
16
18
 
17
19
  fun isCustomConversionType(input: Any?): Boolean {
@@ -33,6 +35,12 @@ object SerializeSpecific {
33
35
  if (input is ProofRequestClaimBindingDto) {
34
36
  return proofClaim(input)
35
37
  }
38
+ if (input is CredentialQueryResponseBindingDto) {
39
+ return credentialQuery(input)
40
+ }
41
+ if (input is PresentationDefinitionV2ClaimBindingDto) {
42
+ return presentationDefinitionV2Claim(input)
43
+ }
36
44
  throw IllegalArgumentException("Invalid map conversion: $input")
37
45
  }
38
46
 
@@ -53,6 +61,22 @@ object SerializeSpecific {
53
61
  }
54
62
  }
55
63
 
64
+ private fun credentialQuery(dto: CredentialQueryResponseBindingDto): ReadableMap {
65
+ val result = Arguments.createMap()
66
+ result.putBoolean("multiple", dto.multiple)
67
+ when (val value = dto.credentialOrFailureHint) {
68
+ is ApplicableCredentialOrFailureHintBindingEnum.ApplicableCredentials -> result.putArray(
69
+ "applicableCredentials",
70
+ convertToRN(value.applicableCredentials) as ReadableArray
71
+ )
72
+
73
+ is ApplicableCredentialOrFailureHintBindingEnum.FailureHint -> {
74
+ result.putMap("failureHint", convertToRN(value.failureHint) as ReadableMap)
75
+ }
76
+ }
77
+ return result
78
+ }
79
+
56
80
  private fun claim(c: ClaimBindingDto): ReadableMap {
57
81
  val result = Arguments.createMap()
58
82
  result.putString("id", c.id)
@@ -70,6 +94,7 @@ object SerializeSpecific {
70
94
  result.putInt("value", value.value.toInt())
71
95
  }
72
96
  }
97
+
73
98
  is ClaimValueBindingDto.String -> result.putString("value", value.value)
74
99
  is ClaimValueBindingDto.Nested ->
75
100
  result.putArray("value", convertToRN(value.value) as ReadableArray)
@@ -94,6 +119,44 @@ object SerializeSpecific {
94
119
 
95
120
  return result
96
121
  }
122
+
123
+ private fun presentationDefinitionV2Claim(c: PresentationDefinitionV2ClaimBindingDto): ReadableMap {
124
+ val result = Arguments.createMap()
125
+ result.putString("path", c.path)
126
+ result.putMap("schema", convertToRN(c.schema) as ReadableMap)
127
+ result.putBoolean("userSelection", c.userSelection)
128
+ result.putBoolean("required", c.required)
129
+
130
+ when (val value = c.value) {
131
+ is PresentationDefinitionV2ClaimValueBindingDto.Boolean -> result.putBoolean(
132
+ "value",
133
+ value.value
134
+ )
135
+
136
+ is PresentationDefinitionV2ClaimValueBindingDto.Float -> result.putDouble(
137
+ "value",
138
+ value.value
139
+ )
140
+
141
+ is PresentationDefinitionV2ClaimValueBindingDto.Integer -> {
142
+ if (value.value < Int.MIN_VALUE || value.value > Int.MAX_VALUE) {
143
+ result.putDouble("value", value.value.toDouble())
144
+ } else {
145
+ result.putInt("value", value.value.toInt())
146
+ }
147
+ }
148
+
149
+ is PresentationDefinitionV2ClaimValueBindingDto.String -> result.putString(
150
+ "value",
151
+ value.value
152
+ )
153
+
154
+ is PresentationDefinitionV2ClaimValueBindingDto.Nested ->
155
+ result.putArray("value", convertToRN(value.value) as ReadableArray)
156
+ }
157
+
158
+ return result
159
+ }
97
160
  }
98
161
 
99
162
  object Str {
package/core-sdk.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "android": {
3
3
  "debug": {
4
- "url": "https://onesdk.blob.core.windows.net/core-sdk/60807/android/onecore-debug.aar",
5
- "sha1": "164dfcb986d8f86596e69ceed8a470562d3b0b6f"
4
+ "url": "https://onesdk.blob.core.windows.net/core-sdk/67952/android/onecore-debug.aar",
5
+ "sha1": "18023ed5e0e3b38249cff431a20c25b6e179390f"
6
6
  },
7
7
  "release": {
8
- "url": "https://onesdk.blob.core.windows.net/core-sdk/60807/android/onecore-release.aar",
9
- "sha1": "da72ce7724c932b14b19df2911ec7c2586c31130"
8
+ "url": "https://onesdk.blob.core.windows.net/core-sdk/67952/android/onecore-release.aar",
9
+ "sha1": "8f8c1133d953ea827a7fe81b3bf2715188931fcc"
10
10
  }
11
11
  },
12
12
  "ios": {
13
- "url": "https://onesdk.blob.core.windows.net/core-sdk/60807/ios/deploy.zip",
14
- "sha1": "7b5d19a6621d7e3eb0fcc492e70681001d5f3483"
13
+ "url": "https://onesdk.blob.core.windows.net/core-sdk/67952/ios/deploy.zip",
14
+ "sha1": "0b2637eddebc58b5972276b2143e34312a2bd01a"
15
15
  }
16
16
  }
@@ -71,9 +71,11 @@ export declare enum DataTypeEnum {
71
71
  String = "STRING",
72
72
  Number = "NUMBER",
73
73
  Date = "DATE",
74
- File = "FILE",
74
+ Picture = "PICTURE",
75
+ SwiyuPicture = "SWIYU_PICTURE",
75
76
  Boolean = "BOOLEAN",
76
- Object = "OBJECT"
77
+ Object = "OBJECT",
78
+ Array = "ARRAY"
77
79
  }
78
80
  type DataTypeError = string | Record<string, string>;
79
81
  export interface StringDataTypeParams {
@@ -107,10 +109,10 @@ export type DataTypeParams = {
107
109
  type: DataTypeEnum.Date;
108
110
  params?: DateDataTypeParams;
109
111
  } | {
110
- type: DataTypeEnum.File;
112
+ type: DataTypeEnum.Picture | DataTypeEnum.SwiyuPicture;
111
113
  params?: FileDataTypeParams;
112
114
  } | {
113
- type: DataTypeEnum.Object;
115
+ type: DataTypeEnum.Object | DataTypeEnum.Array | DataTypeEnum.Boolean;
114
116
  params?: undefined;
115
117
  };
116
118
  export declare enum IssuanceProtocolFeatureEnum {
@@ -146,5 +148,6 @@ export interface Config {
146
148
  cacheEntities: ConfigEntities;
147
149
  task: ConfigEntities;
148
150
  credentialIssuer: ConfigEntities<undefined, {}>;
151
+ walletProvider: ConfigEntities;
149
152
  }
150
153
  export {};
@@ -38,9 +38,11 @@ export var DataTypeEnum;
38
38
  DataTypeEnum["String"] = "STRING";
39
39
  DataTypeEnum["Number"] = "NUMBER";
40
40
  DataTypeEnum["Date"] = "DATE";
41
- DataTypeEnum["File"] = "FILE";
41
+ DataTypeEnum["Picture"] = "PICTURE";
42
+ DataTypeEnum["SwiyuPicture"] = "SWIYU_PICTURE";
42
43
  DataTypeEnum["Boolean"] = "BOOLEAN";
43
44
  DataTypeEnum["Object"] = "OBJECT";
45
+ DataTypeEnum["Array"] = "ARRAY";
44
46
  })(DataTypeEnum || (DataTypeEnum = {}));
45
47
  export var IssuanceProtocolFeatureEnum;
46
48
  (function (IssuanceProtocolFeatureEnum) {
@@ -6,7 +6,7 @@ import { DidListItem, DidListQuery, DidRequest } from "./did";
6
6
  import { HistoryListItem, HistoryListQuery } from "./history";
7
7
  import { KeyRequest } from "./key";
8
8
  import { ItemList } from "./list";
9
- import { CreateProofRequest, InvitationResultProofRequest, PresentationDefinition, PresentationDefinitionRequestedCredential, PresentationSubmitCredentialRequest, ProofDetail, ProofListItem, ProofListQuery, ProposeProofResponse, ShareProofRequest, ShareProofResponse } from "./proof";
9
+ import { CreateProofRequest, InvitationResultProofRequest, PresentationDefinition, PresentationDefinitionRequestedCredential, PresentationDefinitionV2, PresentationSubmitCredentialRequest, PresentationSubmitV2CredentialRequest, ProofDetail, ProofListItem, ProofListQuery, ProposeProofRequest, ProposeProofResponse, ShareProofRequest, ShareProofResponse } from "./proof";
10
10
  import { CreateProofSchemaRequest, ImportProofSchemaRequest, ProofSchema, ProofSchemaListItem, ProofSchemaListQuery, ShareProofSchemaResponse } from "./proofSchema";
11
11
  import { CreateRemoteTrustEntityRequest, CreateTrustAnchorRequest, CreateTrustEntityRequest, RemoteTrustEntity, ResolvedIdentifierTrustEntity, ResolveTrustEntityByIdentifierRequest, TrustAnchor, TrustAnchorListItem, TrustAnchorListQuery, TrustEntity, TrustEntityListItem, TrustEntityListQuery, UpdateRemoteTrustEntityRequest } from "./trust";
12
12
  import { CacheType } from "./cache";
@@ -76,7 +76,7 @@ export interface ONECore {
76
76
  * request for proof).
77
77
  */
78
78
  handleInvitation(request: HandleInvitationRequest): Promise<InvitationResult>;
79
- holderAcceptCredential(interactionId: InvitationResultCredentialIssuance["interactionId"], didId: DidListItem["id"] | undefined, identifierId: IdentifierListItem["id"] | undefined, keyId: string | undefined, txCode: string | undefined): Promise<void>;
79
+ holderAcceptCredential(interactionId: InvitationResultCredentialIssuance["interactionId"], didId: DidListItem["id"] | undefined, identifierId: IdentifierListItem["id"] | undefined, keyId: string | undefined, txCode: string | undefined): Promise<CredentialDetail["id"]>;
80
80
  holderRejectCredential(interactionId: InvitationResultCredentialIssuance["interactionId"]): Promise<void>;
81
81
  /** For wallets, starts the OID4VCI Authorization Code Flow. */
82
82
  initiateIssuance(request: InitiateIssuanceRequest): Promise<InitiateIssuanceResponse>;
@@ -89,8 +89,10 @@ export interface ONECore {
89
89
  * "myapp://example/credential-offer?code=xxx&clientId=myWallet&..." */
90
90
  url: string): Promise<ContinueIssuanceResponse>;
91
91
  getPresentationDefinition(proofId: ProofDetail["id"]): Promise<PresentationDefinition>;
92
+ getPresentationDefinitionV2(proofId: ProofDetail["id"]): Promise<PresentationDefinitionV2>;
92
93
  holderRejectProof(interactionId: InvitationResultProofRequest["interactionId"]): Promise<void>;
93
94
  holderSubmitProof(interactionId: InvitationResultProofRequest["interactionId"], credentials: Record<PresentationDefinitionRequestedCredential["id"], PresentationSubmitCredentialRequest | PresentationSubmitCredentialRequest[]>, didId: DidListItem["id"] | undefined, identifierId: IdentifierListItem["id"] | undefined, keyId: string | undefined): Promise<void>;
95
+ holderSubmitProofV2(interactionId: InvitationResultProofRequest["interactionId"], credentials: Record<string, PresentationSubmitV2CredentialRequest | PresentationSubmitV2CredentialRequest[]>): Promise<void>;
94
96
  getCredentials(query: CredentialListQuery): Promise<ItemList<CredentialListItem>>;
95
97
  runTask(task: string): Promise<string>;
96
98
  deleteProofClaims(proofId: ProofDetail["id"]): Promise<void>;
@@ -112,7 +114,7 @@ export interface ONECore {
112
114
  * Reference the `verificationEngagement` entry of your configuration
113
115
  * for your options for `engagement`.
114
116
  */
115
- proposeProof(exchange: string, organisationId: string, engagement: string[]): Promise<ProposeProofResponse>;
117
+ proposeProof(request: ProposeProofRequest): Promise<ProposeProofResponse>;
116
118
  createProofSchema(request: CreateProofSchemaRequest): Promise<ProofSchema["id"]>;
117
119
  getProofSchemas(query: ProofSchemaListQuery): Promise<ItemList<ProofSchemaListItem>>;
118
120
  getProofSchema(proofSchemaId: ProofSchema["id"]): Promise<ProofSchema>;
@@ -181,4 +183,4 @@ export interface ONECore {
181
183
  */
182
184
  uninitialize(deleteData: boolean): Promise<void>;
183
185
  }
184
- export declare const interfaceMethodNames: readonly ["getVersion", "getConfig", "createOrganisation", "upsertOrganisation", "generateKey", "createDid", "getDids", "createIdentifier", "getIdentifier", "getIdentifiers", "deleteIdentifier", "handleInvitation", "holderAcceptCredential", "holderRejectCredential", "initiateIssuance", "continueIssuance", "getPresentationDefinition", "holderRejectProof", "holderSubmitProof", "getCredentials", "runTask", "deleteProofClaims", "getCredential", "deleteCredential", "importCredentialSchema", "getCredentialSchema", "getCredentialSchemas", "deleteCredentialSchema", "createProof", "shareProof", "shareProofSchema", "shareCredentialSchema", "getProof", "getProofs", "deleteProof", "proposeProof", "createProofSchema", "getProofSchemas", "getProofSchema", "deleteProofSchema", "importProofSchema", "checkRevocation", "createTrustAnchor", "deleteTrustAnchor", "getTrustAnchor", "getTrustAnchors", "createTrustEntity", "getTrustEntity", "getTrustEntities", "getTrustEntityByDid", "resolveTrustEntityByIdentifier", "createRemoteTrustEntity", "getRemoteTrustEntity", "updateRemoteTrustEntity", "getHistory", "getHistoryEntry", "createBackup", "backupInfo", "deleteCache", "unpackBackup", "finalizeImport", "rollbackImport", "resolveJsonldContext", "holderRegisterWalletUnit", "holderRefreshWalletUnit", "holderGetWalletUnitAttestation", "nfcReadIsoMdlEngagement", "nfcStopIsoMdlEngagement", "uninitialize"];
186
+ export declare const interfaceMethodNames: readonly ["getVersion", "getConfig", "createOrganisation", "upsertOrganisation", "generateKey", "createDid", "getDids", "createIdentifier", "getIdentifier", "getIdentifiers", "deleteIdentifier", "handleInvitation", "holderAcceptCredential", "holderRejectCredential", "initiateIssuance", "continueIssuance", "getPresentationDefinition", "getPresentationDefinitionV2", "holderRejectProof", "holderSubmitProof", "holderSubmitProofV2", "getCredentials", "runTask", "deleteProofClaims", "getCredential", "deleteCredential", "importCredentialSchema", "getCredentialSchema", "getCredentialSchemas", "deleteCredentialSchema", "createProof", "shareProof", "shareProofSchema", "shareCredentialSchema", "getProof", "getProofs", "deleteProof", "proposeProof", "createProofSchema", "getProofSchemas", "getProofSchema", "deleteProofSchema", "importProofSchema", "checkRevocation", "createTrustAnchor", "deleteTrustAnchor", "getTrustAnchor", "getTrustAnchors", "createTrustEntity", "getTrustEntity", "getTrustEntities", "getTrustEntityByDid", "resolveTrustEntityByIdentifier", "createRemoteTrustEntity", "getRemoteTrustEntity", "updateRemoteTrustEntity", "getHistory", "getHistoryEntry", "createBackup", "backupInfo", "deleteCache", "unpackBackup", "finalizeImport", "rollbackImport", "resolveJsonldContext", "holderRegisterWalletUnit", "holderRefreshWalletUnit", "holderGetWalletUnitAttestation", "nfcReadIsoMdlEngagement", "nfcStopIsoMdlEngagement", "uninitialize"];
package/dist/src/core.js CHANGED
@@ -33,8 +33,10 @@ export const interfaceMethodNames = [
33
33
  "initiateIssuance",
34
34
  "continueIssuance",
35
35
  "getPresentationDefinition",
36
+ "getPresentationDefinitionV2",
36
37
  "holderRejectProof",
37
38
  "holderSubmitProof",
39
+ "holderSubmitProofV2",
38
40
  "getCredentials",
39
41
  "runTask",
40
42
  "deleteProofClaims",
@@ -1,5 +1,5 @@
1
1
  import { DataTypeEnum } from "./config";
2
- import { CredentialSchema } from "./credentialSchema";
2
+ import { CredentialSchema, WalletStorageType } from "./credentialSchema";
3
3
  import { ListQuery, SortDirection } from "./list";
4
4
  import { IdentifierListItem } from "./identifier";
5
5
  export declare enum CredentialStateEnum {
@@ -13,7 +13,7 @@ export declare enum CredentialStateEnum {
13
13
  ERROR = "ERROR"
14
14
  }
15
15
  export type ClaimValue = {
16
- dataType: DataTypeEnum.String | DataTypeEnum.Date | DataTypeEnum.File;
16
+ dataType: DataTypeEnum.String | DataTypeEnum.Date | DataTypeEnum.Picture | DataTypeEnum.SwiyuPicture;
17
17
  value: string;
18
18
  array: false;
19
19
  } | {
@@ -95,10 +95,10 @@ export type CredentialListQuery = ListQuery & {
95
95
  sort?: SortableCredentialColumnEnum;
96
96
  sortDirection?: SortDirection;
97
97
  exact?: CredentialListQueryExactColumnEnum[];
98
- role?: CredentialRoleEnum;
98
+ roles?: CredentialRoleEnum[];
99
99
  ids?: Array<CredentialListItem["id"]>;
100
- status?: CredentialStateEnum[];
101
- profile?: string;
100
+ states?: CredentialStateEnum[];
101
+ profiles?: string[];
102
102
  credentialSchemaIds?: Array<CredentialSchema["id"]>;
103
103
  include?: CredentialListIncludeEntityType[];
104
104
  /** accepts the RFC3339 format, e.g. use the {@link Date.toISOString} */
@@ -135,16 +135,14 @@ export interface CredentialRevocationCheckResponse {
135
135
  export interface InvitationResultCredentialIssuance {
136
136
  /** For reference. */
137
137
  interactionId: string;
138
- /** Offered credential. */
139
- credentialIds: Array<CredentialListItem["id"]>;
140
138
  /** Metadata for entering a transaction code.
141
139
  * If a pre-authorized code is issued with a transaction code object, the wallet
142
140
  * user must input a transaction code to receive the offered credential. This code
143
141
  * is typically sent through a separate channel such as SMS or email.
144
142
  */
145
143
  txCode?: OpenID4VCITxCode;
146
- /** Metadata for selecting an appropriate key. */
147
- credentialConfigurationsSupported: Record<CredentialListItem["id"], CredentialConfigurationSupported>;
144
+ /** Required storage type for holder binding key */
145
+ walletStorageType?: WalletStorageType;
148
146
  }
149
147
  export interface OpenID4VCITxCode {
150
148
  inputMode?: OpenID4VCITxCodeInputMode;
@@ -176,13 +174,8 @@ export interface InitiateIssuanceResponse {
176
174
  export interface ContinueIssuanceResponse {
177
175
  /** For reference. */
178
176
  interactionId: string;
179
- /** Offered credentials. */
180
- credentialIds: Array<CredentialListItem["id"]>;
181
- /** Metadata for selecting an appropriate key. */
182
- credentialConfigurationsSupported: Record<CredentialListItem["id"], CredentialConfigurationSupported>;
183
- }
184
- export interface CredentialConfigurationSupported {
185
- proofTypesSupported: Record<string, OpenID4VCIProofTypeSupported>;
177
+ /** Required storage type for holder binding key */
178
+ walletStorageType?: WalletStorageType;
186
179
  }
187
180
  export interface OpenID4VCIProofTypeSupported {
188
181
  proofSigningAlgValuesSupported: string[];
@@ -75,7 +75,8 @@ export interface CredentialSchemaListQuery extends ListQuery {
75
75
  export declare enum WalletStorageType {
76
76
  HARDWARE = "HARDWARE",
77
77
  SOFTWARE = "SOFTWARE",
78
- REMOTE_SECURE_ELEMENT = "REMOTE_SECURE_ELEMENT"
78
+ REMOTE_SECURE_ELEMENT = "REMOTE_SECURE_ELEMENT",
79
+ EUDI_COMPLIANT = "EUDI_COMPLIANT"
79
80
  }
80
81
  export declare enum KnownCredentialSchemaType {
81
82
  PROCIVIS_ONE_SCHEMA2024 = "PROCIVIS_ONE_SCHEMA2024",
@@ -18,6 +18,7 @@ export var WalletStorageType;
18
18
  WalletStorageType["HARDWARE"] = "HARDWARE";
19
19
  WalletStorageType["SOFTWARE"] = "SOFTWARE";
20
20
  WalletStorageType["REMOTE_SECURE_ELEMENT"] = "REMOTE_SECURE_ELEMENT";
21
+ WalletStorageType["EUDI_COMPLIANT"] = "EUDI_COMPLIANT";
21
22
  })(WalletStorageType || (WalletStorageType = {}));
22
23
  export var KnownCredentialSchemaType;
23
24
  (function (KnownCredentialSchemaType) {
@@ -65,6 +65,7 @@ export interface HistoryListQuery extends ListQuery {
65
65
  credentialSchemaId?: string;
66
66
  proofSchemaId?: string;
67
67
  search?: HistoryListSearch;
68
+ user?: string;
68
69
  }
69
70
  export interface HistoryListSearch {
70
71
  text: string;
@@ -88,4 +89,5 @@ export interface HistoryListItem {
88
89
  entityType: HistoryEntityTypeEnum;
89
90
  organisationId: string;
90
91
  metadata?: HistoryMetadata;
92
+ user?: string;
91
93
  }
@@ -115,7 +115,7 @@ export interface IdentifierListQuery extends ListQuery {
115
115
  sortDirection?: SortDirection;
116
116
  name?: string;
117
117
  types?: IdentifierTypeEnum[];
118
- state?: IdentifierStateEnum;
118
+ states?: IdentifierStateEnum[];
119
119
  exact?: ExactIdentifierFilterColumnEnum[];
120
120
  didMethods?: string[];
121
121
  isRemote?: boolean;
package/dist/src/nfc.d.ts CHANGED
@@ -3,3 +3,4 @@ export interface NfcScanRequest {
3
3
  failureMessage?: string;
4
4
  successMessage?: string;
5
5
  }
6
+ export declare const isNfcHceSupported: () => Promise<boolean>;
package/dist/src/nfc.js CHANGED
@@ -1 +1,3 @@
1
- export {};
1
+ import { NativeModules } from "react-native";
2
+ const NativeModule = NativeModules.ProcivisOneCoreModule;
3
+ export const isNfcHceSupported = async () => NativeModule.isNfcHceSupported();
@@ -1,5 +1,5 @@
1
1
  import { Claim, CredentialDetail, CredentialListItem } from "./credential";
2
- import { CredentialSchema } from "./credentialSchema";
2
+ import { ClaimSchema, CredentialSchema } from "./credentialSchema";
3
3
  import { ListQuery, SortDirection } from "./list";
4
4
  import { ProofInputClaimSchema, ProofSchemaListItem } from "./proofSchema";
5
5
  import { DidListItem } from "./did";
@@ -136,6 +136,40 @@ export interface PresentationSubmitCredentialRequest {
136
136
  credentialId: CredentialListItem["id"];
137
137
  submitClaims: Array<PresentationDefinitionField["id"]>;
138
138
  }
139
+ export interface PresentationDefinitionV2 {
140
+ credentialQueries: Record<string, PresentationDefinitionV2CredentialQuery>;
141
+ credentialSets: Array<{
142
+ required: boolean;
143
+ options: Array<Array<string>>;
144
+ }>;
145
+ }
146
+ export type PresentationDefinitionV2CredentialQuery = {
147
+ multiple: boolean;
148
+ } & (ApplicableCredentials | FailureHint);
149
+ export interface ApplicableCredentials {
150
+ applicableCredentials: Array<PresentationDefinitionV2CredentialDetail>;
151
+ }
152
+ export interface FailureHint {
153
+ failureHint: {
154
+ credentialSchema?: CredentialSchema;
155
+ reason: "NO_CREDENTIAL" | "VALIDITY" | "CONSTRAINT";
156
+ };
157
+ }
158
+ export interface PresentationDefinitionV2CredentialDetail extends Omit<CredentialDetail, "claims"> {
159
+ claims: Array<PresentationDefinitionV2CredentialClaim>;
160
+ }
161
+ export interface PresentationDefinitionV2CredentialClaim {
162
+ path: string;
163
+ schema: ClaimSchema;
164
+ value: PresentationDefinitionV2ClaimValue;
165
+ userSelection: boolean;
166
+ required: boolean;
167
+ }
168
+ export type PresentationDefinitionV2ClaimValue = string | number | boolean | PresentationDefinitionV2CredentialClaim[];
169
+ export interface PresentationSubmitV2CredentialRequest {
170
+ credentialId: CredentialListItem["id"];
171
+ userSelections: Array<string>;
172
+ }
139
173
  export declare enum SortableProofColumnEnum {
140
174
  SCHEMA_NAME = "SCHEMA_NAME",
141
175
  VERIFIER = "VERIFIER",
@@ -154,7 +188,7 @@ export interface ProofListQuery extends ListQuery {
154
188
  proofRoles?: ProofRoleEnum[];
155
189
  proofSchemaIds?: string[];
156
190
  exact?: ExactProofFilterColumnEnum[];
157
- profile?: string;
191
+ profiles?: string[];
158
192
  /** accepts the RFC3339 format, e.g. use the {@link Date.toISOString} */
159
193
  createdDateAfter?: string;
160
194
  /** accepts the RFC3339 format, e.g. use the {@link Date.toISOString} */
@@ -172,6 +206,12 @@ export interface ProofListQuery extends ListQuery {
172
206
  /** accepts the RFC3339 format, e.g. use the {@link Date.toISOString} */
173
207
  completedDateBefore?: string;
174
208
  }
209
+ export interface ProposeProofRequest {
210
+ protocol: string;
211
+ organisationId: string;
212
+ engagement: string[];
213
+ uiMessage?: string;
214
+ }
175
215
  export interface ProposeProofResponse {
176
216
  proofId: string;
177
217
  interactionId: string;
@@ -107,13 +107,18 @@ export interface CreateTrustEntityRequest {
107
107
  content?: string;
108
108
  organisationId: UpsertOrganisationRequest["id"];
109
109
  }
110
- export interface TrustEntityListQuery {
110
+ export interface TrustEntityListQuery extends Omit<ListQuery, "organisationId"> {
111
111
  sort?: SortableTrustEntityColumnEnum;
112
112
  sortDirection?: SortDirection;
113
+ organisationId?: string;
113
114
  name?: string;
114
115
  exact?: ExactTrustEntityFilterColumnEnum[];
115
- type?: string;
116
- isPublisher?: boolean;
116
+ role?: TrustEntityRoleEnum;
117
+ trustAnchor?: TrustAnchor["id"];
118
+ didId?: DidListItem["id"];
119
+ types?: TrustEntityTypeEnum[];
120
+ entityKey?: string;
121
+ states?: TrustEntityStateEnum[];
117
122
  /** accepts the RFC3339 format, e.g. use the {@link Date.toISOString} */
118
123
  createdDateAfter?: string;
119
124
  /** accepts the RFC3339 format, e.g. use the {@link Date.toISOString} */
@@ -91,6 +91,10 @@ RCT_EXTERN_METHOD(getPresentationDefinition:(NSString *)proofId
91
91
  resolver:(RCTPromiseResolveBlock)resolve
92
92
  rejecter:(RCTPromiseRejectBlock)reject)
93
93
 
94
+ RCT_EXTERN_METHOD(getPresentationDefinitionV2:(NSString *)proofId
95
+ resolver:(RCTPromiseResolveBlock)resolve
96
+ rejecter:(RCTPromiseRejectBlock)reject)
97
+
94
98
  RCT_EXTERN_METHOD(holderRejectProof:(NSString *)interactionId
95
99
  resolver:(RCTPromiseResolveBlock)resolve
96
100
  rejecter:(RCTPromiseRejectBlock)reject)
@@ -103,6 +107,11 @@ RCT_EXTERN_METHOD(holderSubmitProof:(NSString *)interactionId
103
107
  resolver:(RCTPromiseResolveBlock)resolve
104
108
  rejecter:(RCTPromiseRejectBlock)reject)
105
109
 
110
+ RCT_EXTERN_METHOD(holderSubmitProofV2:(NSString *)interactionId
111
+ submission:(NSDictionary *)submission
112
+ resolver:(RCTPromiseResolveBlock)resolve
113
+ rejecter:(RCTPromiseRejectBlock)reject)
114
+
106
115
  RCT_EXTERN_METHOD(getCredentials:(NSDictionary *)query
107
116
  resolver:(RCTPromiseResolveBlock)resolve
108
117
  rejecter:(RCTPromiseRejectBlock)reject)
@@ -188,9 +197,7 @@ RCT_EXTERN_METHOD(deleteProof:(NSString *)proofId
188
197
  resolver:(RCTPromiseResolveBlock)resolve
189
198
  rejecter:(RCTPromiseRejectBlock)reject)
190
199
 
191
- RCT_EXTERN_METHOD(proposeProof:(NSString *)exchange
192
- organisationId:(NSString *)organisationId
193
- engagement:(NSArray *)engagement
200
+ RCT_EXTERN_METHOD(proposeProof:(NSDictionary *)request
194
201
  resolver:(RCTPromiseResolveBlock)resolve
195
202
  rejecter:(RCTPromiseRejectBlock)reject)
196
203
 
@@ -297,14 +304,17 @@ RCT_EXTERN_METHOD(nfcReadIsoMdlEngagement:(NSDictionary *)request
297
304
  RCT_EXTERN_METHOD(nfcStopIsoMdlEngagement:(RCTPromiseResolveBlock)resolve
298
305
  rejecter:(RCTPromiseRejectBlock)reject)
299
306
 
300
- RCT_EXTERN_METHOD(uninitialize:(BOOL *)deleteData
307
+ RCT_EXTERN_METHOD(deleteCache:(NSArray *)types
301
308
  resolver:(RCTPromiseResolveBlock)resolve
302
309
  rejecter:(RCTPromiseRejectBlock)reject)
303
310
 
304
- RCT_EXTERN_METHOD(deleteCache:(NSArray *)types
311
+ RCT_EXTERN_METHOD(uninitialize:(BOOL *)deleteData
305
312
  resolver:(RCTPromiseResolveBlock)resolve
306
313
  rejecter:(RCTPromiseRejectBlock)reject)
307
314
 
315
+ RCT_EXTERN_METHOD(isNfcHceSupported:(RCTPromiseResolveBlock)resolve
316
+ rejecter:(RCTPromiseRejectBlock)reject)
317
+
308
318
  RCT_EXTERN_METHOD(changeRSEPin:(RCTPromiseResolveBlock)resolve
309
319
  rejecter:(RCTPromiseRejectBlock)reject)
310
320
 
@@ -13,6 +13,14 @@ class ProcivisOneCoreModule: RCTEventEmitter {
13
13
  private static let TAG = "ProcivisOneCoreModule"
14
14
  private var core: OneCoreBindingProtocol? = nil
15
15
  private var rseKeyStorage: NativeKeyStorage? = nil
16
+ private var nfcHce: NfcHce? = nil
17
+
18
+ public override init() {
19
+ super.init()
20
+ if #available(iOS 17.4, *) {
21
+ nfcHce = NFCHCE()
22
+ }
23
+ }
16
24
 
17
25
  @objc(initialize:resolver:rejecter:)
18
26
  func initialize(
@@ -60,6 +68,7 @@ class ProcivisOneCoreModule: RCTEventEmitter {
60
68
  rseKeyStorage = RSEKeyStorage()
61
69
  }
62
70
  }
71
+
63
72
  self.core = try initializeCore(
64
73
  dataDirPath: dataDirPath,
65
74
  params: InitParamsDto(
@@ -68,7 +77,7 @@ class ProcivisOneCoreModule: RCTEventEmitter {
68
77
  remoteSecureElement: rseKeyStorage,
69
78
  bleCentral: IOSBLECentral(),
70
79
  blePeripheral: IOSBLEPeripheral(),
71
- nfcHce: nil,
80
+ nfcHce: nfcHce,
72
81
  nfcScanner: NFCScanner()
73
82
  )
74
83
  )
@@ -235,14 +244,13 @@ class ProcivisOneCoreModule: RCTEventEmitter {
235
244
  reject: @escaping RCTPromiseRejectBlock
236
245
  ) {
237
246
  asyncCall(resolve, reject) {
238
- try await self.getCore().holderAcceptCredential(
247
+ return try await self.getCore().holderAcceptCredential(
239
248
  interactionId: interactionId,
240
249
  didId: didId,
241
250
  identifierId: identifierId,
242
251
  keyId: keyId,
243
252
  txCode: txCode
244
253
  )
245
- return nil as NSDictionary?
246
254
  }
247
255
  }
248
256
 
@@ -294,6 +302,18 @@ class ProcivisOneCoreModule: RCTEventEmitter {
294
302
  }
295
303
  }
296
304
 
305
+ @objc(getPresentationDefinitionV2:resolver:rejecter:)
306
+ func getPresentationDefinitionV2(
307
+ proofId: String,
308
+ resolve: @escaping RCTPromiseResolveBlock,
309
+ reject: @escaping RCTPromiseRejectBlock
310
+ ) {
311
+ asyncCall(resolve, reject) {
312
+ let result = try await self.getCore().getPresentationDefinitionV2(proofId: proofId)
313
+ return try serializeAny(result)
314
+ }
315
+ }
316
+
297
317
  @objc(holderRejectProof:resolver:rejecter:)
298
318
  func rejectProof(
299
319
  interactionId: String,
@@ -328,6 +348,22 @@ class ProcivisOneCoreModule: RCTEventEmitter {
328
348
  }
329
349
  }
330
350
 
351
+ @objc(holderSubmitProofV2:submission:resolver:rejecter:)
352
+ func holderSubmitProofV2(
353
+ interactionId: String,
354
+ submission: NSDictionary,
355
+ resolve: @escaping RCTPromiseResolveBlock,
356
+ reject: @escaping RCTPromiseRejectBlock
357
+ ) {
358
+ asyncCall(resolve, reject) {
359
+ try await self.getCore().holderSubmitProofV2(
360
+ interactionId: interactionId,
361
+ submission: try deserialize(submission),
362
+ )
363
+ return nil as NSDictionary?
364
+ }
365
+ }
366
+
331
367
  @objc(getCredentials:resolver:rejecter:)
332
368
  func getCredentials(
333
369
  query: NSDictionary,
@@ -583,20 +619,14 @@ class ProcivisOneCoreModule: RCTEventEmitter {
583
619
  }
584
620
  }
585
621
 
586
- @objc(proposeProof:organisationId:engagement:resolver:rejecter:)
622
+ @objc(proposeProof:resolver:rejecter:)
587
623
  func proposeProof(
588
- exchange: String,
589
- organisationId: String,
590
- engagement: NSArray,
624
+ request: NSDictionary,
591
625
  resolve: @escaping RCTPromiseResolveBlock,
592
626
  reject: @escaping RCTPromiseRejectBlock
593
627
  ) {
594
628
  asyncCall(resolve, reject) {
595
- let result = try await self.getCore().proposeProof(
596
- exchange: exchange,
597
- organisationId: organisationId,
598
- engagement: try deserialize(engagement)
599
- )
629
+ let result = try await self.getCore().proposeProof(request: try deserialize(request))
600
630
  return try serializeAny(result)
601
631
  }
602
632
  }
@@ -938,6 +968,19 @@ class ProcivisOneCoreModule: RCTEventEmitter {
938
968
  }
939
969
  }
940
970
 
971
+ @objc(isNfcHceSupported:rejecter:)
972
+ func isNfcHceSupported(
973
+ resolve: @escaping RCTPromiseResolveBlock,
974
+ reject: @escaping RCTPromiseRejectBlock
975
+ ) {
976
+ asyncCall(resolve, reject) {
977
+ if let nfcHce = self.nfcHce {
978
+ return try await nfcHce.isSupported()
979
+ }
980
+ return false
981
+ }
982
+ }
983
+
941
984
  // MARK: Ubiqu specific methods
942
985
 
943
986
  @objc(changeRSEPin:rejecter:)
@@ -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
- return String(describing: value).snakeCased()
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
- 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
- }
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,18 @@ 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, credentialIds, txCode, credentialConfigurationsSupported):
104
+ case let .credentialIssuance(interactionId, walletStorageType, 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 walletStorageType = walletStorageType {
109
+ result["walletStorageType"] = serializeEnumValue(value: walletStorageType)
110
+ }
106
111
  if let txCode = txCode {
107
112
  result["txCode"] = try serializeAny(txCode)
108
113
  }
109
114
  return result as NSDictionary;
110
-
115
+
111
116
  case let .proofRequest(interactionId, proofId):
112
117
  return [
113
118
  "interactionId": interactionId,
@@ -121,3 +126,29 @@ private func serialize(invitationResponse: HandleInvitationResponseBindingEnum)
121
126
  ];
122
127
  }
123
128
  }
129
+
130
+ private func serialize(credentialQuery: CredentialQueryResponseBindingDto) throws -> Any {
131
+ var result: [String: Any] = ["multiple": credentialQuery.multiple]
132
+ switch (credentialQuery.credentialOrFailureHint) {
133
+ case let .applicableCredentials(applicableCredentials: value):
134
+ result["applicableCredentials"] = try serializeAny(value);
135
+ case let .failureHint(failureHint: value):
136
+ result["failureHint"] = try serializeAny(value);
137
+ }
138
+ return result as NSDictionary;
139
+ }
140
+
141
+ private func serialize(presentationDefinitionV2ClaimValue: PresentationDefinitionV2ClaimValueBindingDto) throws -> Any {
142
+ switch (presentationDefinitionV2ClaimValue) {
143
+ case let .boolean(value):
144
+ return value;
145
+ case let .float(value):
146
+ return value;
147
+ case let .integer(value):
148
+ return NSNumber(value: value);
149
+ case let .string(value):
150
+ return value;
151
+ case .nested(value: let values):
152
+ return try values.map { try serializeAny($0) }
153
+ }
154
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procivis/react-native-one-core",
3
- "version": "1.60807.0",
3
+ "version": "1.67952.1",
4
4
  "author": "Procivis AG (https://procivis.ch)",
5
5
  "license": "Apache-2.0",
6
6
  "description": "ONE core bindings for React Native",