@pagopa/io-react-native-iso18013 0.8.2 → 0.8.4

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.
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
 
18
18
  # Module dependencies
19
19
  s.dependency "IOWalletCBOR", "0.2.1"
20
- s.dependency "IOWalletProximity", "1.4.1"
20
+ s.dependency "IOWalletProximity", "1.5.0"
21
21
 
22
22
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
23
23
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -83,8 +83,8 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
83
83
  dependencies {
84
84
  implementation "com.facebook.react:react-android"
85
85
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
86
- implementation "it.pagopa.io.wallet.proximity:proximity:2.4.1"
87
- implementation "it.pagopa.io.wallet.cbor:cbor:1.4.1"
86
+ implementation "it.pagopa.io.wallet.proximity:proximity:2.5.0"
87
+ implementation "it.pagopa.io.wallet.cbor:cbor:1.4.2"
88
88
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
89
89
  testImplementation('junit:junit:4.13.2')
90
90
  }
@@ -7,6 +7,7 @@
7
7
  <service
8
8
  android:name="com.ioreactnativeiso18013.IoNfcEngagementService"
9
9
  android:exported="true"
10
+ android:enabled="false"
10
11
  android:permission="android.permission.BIND_NFC_SERVICE">
11
12
  <intent-filter>
12
13
  <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE" />
@@ -6,6 +6,7 @@
6
6
  <service
7
7
  android:name="com.ioreactnativeiso18013.IoNfcEngagementService"
8
8
  android:exported="true"
9
+ android:enabled="false"
9
10
  android:permission="android.permission.BIND_NFC_SERVICE">
10
11
  <intent-filter>
11
12
  <action android:name="android.nfc.action.NDEF_DISCOVERED" />
@@ -52,11 +52,8 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
52
52
  }
53
53
 
54
54
  override fun invalidate() {
55
+ this.dispose()
55
56
  super.invalidate()
56
- nfcEventJob?.cancel()
57
- nfcEventJob = null
58
- nfcScope.coroutineContext[Job]?.cancel()
59
- reactApplicationContext.currentActivity?.let { NfcEngagementService.disable(it) }
60
57
  }
61
58
 
62
59
  /**
@@ -106,8 +103,7 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
106
103
  // NFC engagement
107
104
 
108
105
  if (parsedEngagementModes.any { it == EngagementMode.NFC }) {
109
- val readerTrustStore = certificatesList.takeIf { it.isNotEmpty() }
110
- ?.map { chain -> chain.map<ByteArray, Any> { it } }
106
+ val readerTrustStore = certificatesList.map { chain -> chain.map<ByteArray, Any> { it } }
111
107
 
112
108
  check(
113
109
  NfcEngagementEventBus.setupNfcService(
@@ -127,9 +123,7 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
127
123
 
128
124
  if (parsedEngagementModes.any { it == EngagementMode.QR_CODE }) {
129
125
  qrEngagement = QrEngagement.build(reactApplicationContext, methods).apply {
130
- if (certificatesList.isNotEmpty()) {
131
- withReaderTrustStore(certificatesList)
132
- }
126
+ withReaderTrustStore(certificatesList)
133
127
  }
134
128
  qrEngagement?.configure()
135
129
  setupProximityHandler()
@@ -164,15 +158,7 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
164
158
  @ReactMethod
165
159
  fun close(promise: Promise) {
166
160
  try {
167
- qrEngagement?.close()
168
- qrEngagement = null
169
- deviceRetrievalHelper?.disconnect()
170
- deviceRetrievalHelper = null
171
- sessionRetrievalMethod = null
172
- sessionTranscript = null
173
- nfcEventJob?.cancel()
174
- nfcEventJob = null
175
- reactApplicationContext.currentActivity?.let { NfcEngagementService.disable(it) }
161
+ this.dispose()
176
162
  promise.resolve(true)
177
163
  } catch (e: Exception) {
178
164
  promise.reject(ModuleErrorCodes.CLOSE_ERROR, message = e.message, e)
@@ -386,6 +372,11 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
386
372
  }
387
373
  }
388
374
 
375
+ @ReactMethod
376
+ fun setHceModalMessage(message: String) {
377
+ // Android does not support alert messages for NFC reading
378
+ }
379
+
389
380
  /**
390
381
  * Sets the proximity handler along with the possible dispatched events and their callbacks.
391
382
  * The events are then sent to React Native via `RCTEventEmitter`.
@@ -524,6 +515,21 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
524
515
  .emit(eventName, data)
525
516
  }
526
517
 
518
+ /**
519
+ * Disposes the resources
520
+ */
521
+ private fun dispose() {
522
+ qrEngagement?.close()
523
+ qrEngagement = null
524
+ deviceRetrievalHelper?.disconnect()
525
+ deviceRetrievalHelper = null
526
+ sessionRetrievalMethod = null
527
+ sessionTranscript = null
528
+ nfcEventJob?.cancel()
529
+ nfcEventJob = null
530
+ reactApplicationContext.currentActivity?.let { NfcEngagementService.disable(it) }
531
+ }
532
+
527
533
  /**
528
534
  * Keep: Required for RN built in Event Emitter Calls.
529
535
  * This fixes the warning: `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <resources>
3
- <string name="nfc_engagement_service_desc">NFC Engagement Service</string>
3
+ <string name="nfc_engagement_service_desc">IT-Wallet Proximity</string>
4
4
  <string name="nfc_engagement_aid_group_desc">ISO 18013-5 NFC Engagement</string>
5
5
  </resources>
@@ -34,6 +34,8 @@ RCT_EXTERN_METHOD(generateOID4VPDeviceResponse: (NSString *)clientId
34
34
  withResolver: (RCTPromiseResolveBlock)resolve
35
35
  withRejecter: (RCTPromiseRejectBlock)reject)
36
36
 
37
+ RCT_EXTERN_METHOD(setHceModalMessage: (NSString)message)
38
+
37
39
  + (BOOL)requiresMainQueueSetup
38
40
  {
39
41
  return YES;
@@ -398,10 +398,10 @@ class IoReactNativeIso18013: RCTEventEmitter, ISO18013Delegate {
398
398
  /**
399
399
  Converts a device requested from the `onDocumentRequestReceived` callback into a serializable JSON.
400
400
  - Parameters:
401
- - request: The request returned from `onDocumentRequestReceived` which contains an array of tuples consists of a doctype, namespaces and the requested claims with a boolean value indicating wether or not the device which is making the request has an intent to retain the data.
401
+ - request: The request returned from `onDocumentRequestReceived` which contains an array of tuples consists of a doctype, namespaces, the requested claims with a boolean value indicating wether or not the device which is making the request has an intent to retain the data, and optional certificate data from the verifier X.509 certificate.
402
402
  - Returns: A JSON string representing the device request or nil if an error occurs.
403
403
  */
404
- private func deviceRequestToJson(request: [(docType: String, nameSpaces: [String: [String: Bool]], isAuthenticated: Bool)]?) -> String? {
404
+ private func deviceRequestToJson(request: [(docType: String, nameSpaces: [String: [String: Bool]], isAuthenticated: Bool, certificateData: [String: String]?)]?) -> String? {
405
405
  var jsonRequest : [String: AnyHashable] = [:]
406
406
  request?.forEach({
407
407
  item in
@@ -412,6 +412,9 @@ class IoReactNativeIso18013: RCTEventEmitter, ISO18013Delegate {
412
412
  })
413
413
 
414
414
  subReq["isAuthenticated"] = item.isAuthenticated
415
+ if let certData = item.certificateData {
416
+ subReq["certificateData"] = certData
417
+ }
415
418
 
416
419
  jsonRequest[item.docType] = subReq
417
420
  })
@@ -493,6 +496,20 @@ class IoReactNativeIso18013: RCTEventEmitter, ISO18013Delegate {
493
496
  }
494
497
  }
495
498
 
499
+ /**
500
+ Sets a custom message to be displayed in the NFC HCE modal during NFC engagement.
501
+
502
+ - Parameters:
503
+ - message: The custom message to be displayed in the NFC HCE modal.
504
+ */
505
+ @objc func setHceModalMessage(
506
+ _ message: String
507
+ ) {
508
+ if #available(iOS 17.4, *) {
509
+ ISO18013.shared.setNfcHceMessage(message: message)
510
+ }
511
+ }
512
+
496
513
  /**
497
514
  Custom Error which is thrown when a parsing error occurs in our utility functions which converts data from the bridge to what
498
515
  our underlying functions expect.
@@ -249,14 +249,14 @@ ISO18013_5.addListener(
249
249
 
250
250
  Starts the proximity flow with the specified engagement and retrieval modes. By default enables both QR code and NFC engagement with both BLE and NFC retrieval. NFC engagement requires iOS 17.4+ on iOS and HCE support on Android.
251
251
 
252
- | Parameter | Platform | Default | Description |
253
- | ------------------- | ----------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------- |
254
- | `peripheralMode` | Android | `true` | Whether the device is in peripheral mode |
255
- | `centralClientMode` | Android | `false` | Whether the device is in central client mode |
256
- | `clearBleCache` | Android | `true` | Whether the BLE cache should be cleared |
257
- | `certificates` | Android/iOS | `[]` | Two-dimensional array of base64 strings representing DER encoded X.509 certificates used to authenticate the verifier app |
258
- | `engagementModes` | Android/iOS | `['qrcode', 'nfc']` | Array of engagement modes to activate (`'qrcode'` and/or `'nfc'`) |
259
- | `retrievalMethods` | Android/iOS | `['ble', 'nfc']` | Array of supported retrieval methods (`'ble'` and/or `'nfc'`) |
252
+ | Parameter | Platform | Default | Description |
253
+ | ------------------- | ----------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------- |
254
+ | `peripheralMode` | Android | `true` | Whether the device is in peripheral mode |
255
+ | `centralClientMode` | Android | `false` | Whether the device is in central client mode |
256
+ | `clearBleCache` | Android | `true` | Whether the BLE cache should be cleared |
257
+ | `certificates` | Android/iOS | `[]` | Two-dimensional array of base64 strings representing DER encoded X.509 certificates used to authenticate the verifier app |
258
+ | `engagementModes` | Android/iOS | `['qrcode', 'nfc']` | Array of engagement modes to activate (`'qrcode'` and/or `'nfc'`) |
259
+ | `retrievalMethods` | Android/iOS | `['ble', 'nfc']` | Array of supported retrieval methods (`'ble'` and/or `'nfc'`) |
260
260
 
261
261
  ```typescript
262
262
  import { ISO18013_5 } from '@pagopa/io-react-native-iso18013';
@@ -339,6 +339,16 @@ import { ISO18013_5 } from '@pagopa/io-react-native-iso18013';
339
339
  await ISO18013_5.close();
340
340
  ```
341
341
 
342
+ #### `setHceModalMessage` (iOS Only)
343
+
344
+ Sets the message to display in the HCE system modal
345
+
346
+ ```typescript
347
+ import { ISO18013_5 } from '@pagopa/io-react-native-iso18013';
348
+
349
+ await ISO18013_5.setHceModalMessage('My custom message');
350
+ ```
351
+
342
352
  ## Proximity Sequence Diagram
343
353
 
344
354
  This section describes a high level overview of the happy flow interactions between an app implementing the `io-react-native-iso18013` library and a verifier app.
@@ -2,5 +2,5 @@
2
2
 
3
3
  export { parseVerifierRequest } from "./request.js";
4
4
  export { OnErrorPayloadSchema, ModuleErrorSchema } from "./error.js";
5
- export { ErrorCode, addListener, startEngagement, close, generateResponse, sendErrorResponse, sendResponse } from "./proximity.js";
5
+ export { ErrorCode, addListener, startEngagement, close, generateResponse, sendErrorResponse, sendResponse, setHceModalMessage } from "./proximity.js";
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["parseVerifierRequest","OnErrorPayloadSchema","ModuleErrorSchema","ErrorCode","addListener","startEngagement","close","generateResponse","sendErrorResponse","sendResponse"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/index.ts"],"mappings":";;AAAA,SAA+BA,oBAAoB,QAAQ,cAAW;AAEtE,SAEEC,oBAAoB,EACpBC,iBAAiB,QAGZ,YAAS;AAEhB,SACEC,SAAS,EAKTC,WAAW,EACXC,eAAe,EACfC,KAAK,EACLC,gBAAgB,EAChBC,iBAAiB,EACjBC,YAAY,QACP,gBAAa","ignoreList":[]}
1
+ {"version":3,"names":["parseVerifierRequest","OnErrorPayloadSchema","ModuleErrorSchema","ErrorCode","addListener","startEngagement","close","generateResponse","sendErrorResponse","sendResponse","setHceModalMessage"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/index.ts"],"mappings":";;AAAA,SAA+BA,oBAAoB,QAAQ,cAAW;AAEtE,SAEEC,oBAAoB,EACpBC,iBAAiB,QAGZ,YAAS;AAEhB,SACEC,SAAS,EAKTC,WAAW,EACXC,eAAe,EACfC,KAAK,EACLC,gBAAgB,EAChBC,iBAAiB,EACjBC,YAAY,EACZC,kBAAkB,QACb,gBAAa","ignoreList":[]}
@@ -51,8 +51,8 @@ export let ErrorCode = /*#__PURE__*/function (ErrorCode) {
51
51
  * @param config.centralClientMode (Android only) - Whether the device is in central client mode. Defaults to false
52
52
  * @param config.clearBleCache (Android only) - Whether the BLE cache should be cleared. Defaults to true
53
53
  * @param config.certificates - Two-dimensional array of base64 strings representing DER encoded X.509 certificate which are used to authenticate the verifier app
54
- * @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr', 'nfc']
55
- * @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble', 'nfc']
54
+ * @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr']
55
+ * @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble']
56
56
  * @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
57
57
  */
58
58
  export function startEngagement(config = {}) {
@@ -61,8 +61,8 @@ export function startEngagement(config = {}) {
61
61
  centralClientMode = false,
62
62
  clearBleCache = true,
63
63
  certificates = [],
64
- engagementModes = ['qrcode', 'nfc'],
65
- retrievalMethods = ['ble', 'nfc']
64
+ engagementModes = ['qrcode'],
65
+ retrievalMethods = ['ble']
66
66
  } = config;
67
67
  if (Platform.OS === 'ios') {
68
68
  return IoReactNativeIso18013.startEngagement(certificates, engagementModes, retrievalMethods);
@@ -124,4 +124,14 @@ export function sendResponse(response) {
124
124
  export function addListener(event, callback) {
125
125
  return eventEmitter.addListener(event, callback);
126
126
  }
127
+
128
+ /**
129
+ * **iOS only**
130
+ *
131
+ * Sets a custom message to be displayed in the NFC HCE modal during NFC engagement.
132
+ * @param message - The custom message to be displayed in the NFC HCE modal.
133
+ */
134
+ export function setHceModalMessage(message) {
135
+ IoReactNativeIso18013.setHceModalMessage(message);
136
+ }
127
137
  //# sourceMappingURL=proximity.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeEventEmitter","Platform","IoReactNativeIso18013","eventEmitter","ErrorCode","startEngagement","config","peripheralMode","centralClientMode","clearBleCache","certificates","engagementModes","retrievalMethods","OS","close","sendErrorResponse","code","generateResponse","documents","acceptedFields","sendResponse","response","addListener","event","callback"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/proximity.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAC3D,SAASC,qBAAqB,QAAQ,aAAI;AAG1C,MAAMC,YAAY,GAAG,IAAIH,kBAAkB,CAACE,qBAAqB,CAAC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,WAAYE,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;;AAMrB;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,MAOC,GAAG,CAAC,CAAC,EACY;EAClB,MAAM;IACJC,cAAc,GAAG,IAAI;IACrBC,iBAAiB,GAAG,KAAK;IACzBC,aAAa,GAAG,IAAI;IACpBC,YAAY,GAAG,EAAE;IACjBC,eAAe,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC;IACnCC,gBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK;EAClC,CAAC,GAAGN,MAAM;EAEV,IAAIL,QAAQ,CAACY,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOX,qBAAqB,CAACG,eAAe,CAC1CK,YAAY,EACZC,eAAe,EACfC,gBACF,CAAC;EACH,CAAC,MAAM;IACL,OAAOV,qBAAqB,CAACG,eAAe,CAC1CE,cAAc,EACdC,iBAAiB,EACjBC,aAAa,EACbC,YAAY,EACZC,eAAe,EACfC,gBACF,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,KAAKA,CAAA,EAAqB;EACxC,OAAOZ,qBAAqB,CAACY,KAAK,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,IAAe,EAAoB;EACnE,OAAOd,qBAAqB,CAACa,iBAAiB,CAACC,IAAI,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,SAAmC,EACnCC,cAA8B,EACb;EACjB,OAAOjB,qBAAqB,CAACe,gBAAgB,CAACC,SAAS,EAAEC,cAAc,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,QAAgB,EAAoB;EAC/D,OAAOnB,qBAAqB,CAACkB,YAAY,CAACC,QAAQ,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CACzBC,KAAQ,EACRC,QAA0C,EAC1C;EACA,OAAOrB,YAAY,CAACmB,WAAW,CAACC,KAAK,EAAEC,QAAQ,CAAC;AAClD","ignoreList":[]}
1
+ {"version":3,"names":["NativeEventEmitter","Platform","IoReactNativeIso18013","eventEmitter","ErrorCode","startEngagement","config","peripheralMode","centralClientMode","clearBleCache","certificates","engagementModes","retrievalMethods","OS","close","sendErrorResponse","code","generateResponse","documents","acceptedFields","sendResponse","response","addListener","event","callback","setHceModalMessage","message"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/proximity.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAC3D,SAASC,qBAAqB,QAAQ,aAAI;AAG1C,MAAMC,YAAY,GAAG,IAAIH,kBAAkB,CAACE,qBAAqB,CAAC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,WAAYE,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS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/D,OAAOnB,qBAAqB,CAACkB,YAAY,CAACC,QAAQ,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CACzBC,KAAQ,EACRC,QAA0C,EAC1C;EACA,OAAOrB,YAAY,CAACmB,WAAW,CAACC,KAAK,EAAEC,QAAQ,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,OAAe,EAAQ;EACxDxB,qBAAqB,CAACuB,kBAAkB,CAACC,OAAO,CAAC;AACnD","ignoreList":[]}
@@ -4,8 +4,23 @@ import { z } from 'zod';
4
4
 
5
5
  // Inner data: a record of booleans with the attributes and the intent to retain flag
6
6
  const booleanFieldGroup = z.record(z.string(), z.boolean());
7
+
8
+ // Parses raw X.509 subject fields from the verifier certificate
9
+ // and maps them to readable internal names.
10
+ const certificateDataSchema = z.object({
11
+ C: z.string().optional(),
12
+ O: z.string().optional(),
13
+ SERIALNUMBER: z.string().optional(),
14
+ CN: z.string().optional()
15
+ }).transform(certificate => ({
16
+ country: certificate.C,
17
+ organization: certificate.O,
18
+ serialNumber: certificate.SERIALNUMBER,
19
+ commonName: certificate.CN
20
+ }));
7
21
  const credentialEntrySchema = z.object({
8
- isAuthenticated: z.boolean()
22
+ isAuthenticated: z.boolean(),
23
+ certificateData: certificateDataSchema.optional()
9
24
  }).catchall(booleanFieldGroup);
10
25
  const VerifierRequest = z.object({
11
26
  request: z.record(z.string(), credentialEntrySchema)
@@ -18,12 +33,18 @@ const VerifierRequest = z.object({
18
33
  * Example:
19
34
  * `{
20
35
  * "org.iso.18013.5.1.mDL": {
21
- * "isAuthenticated": true,
22
36
  * "org.iso.18013.5.1": {
23
37
  * "hair_colour": true,
24
38
  * "given_name_national_character": true,
25
39
  * "family_name_national_character": true,
26
40
  * "given_name": true,
41
+ * },
42
+ * "isAuthenticated": true,
43
+ * "certificateData": {
44
+ * "country": "UT",
45
+ * "organization": "EUDI Wallet Reference Implementation",
46
+ * "serialNumber": "001",
47
+ * "commonName": "EUDI Proximity Verifier"
27
48
  * }
28
49
  * }
29
50
  * }`
@@ -1 +1 @@
1
- {"version":3,"names":["z","booleanFieldGroup","record","string","boolean","credentialEntrySchema","object","isAuthenticated","catchall","VerifierRequest","request","parseVerifierRequest","input","parse"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/request.ts"],"mappings":";;AAAA,SAASA,CAAC,QAAQ,KAAK;;AAEvB;AACA,MAAMC,iBAAiB,GAAGD,CAAC,CAACE,MAAM,CAACF,CAAC,CAACG,MAAM,CAAC,CAAC,EAAEH,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC;AAE3D,MAAMC,qBAAqB,GAAGL,CAAC,CAC5BM,MAAM,CAAC;EACNC,eAAe,EAAEP,CAAC,CAACI,OAAO,CAAC;AAC7B,CAAC,CAAC,CACDI,QAAQ,CAACP,iBAAiB,CAAC;AAE9B,MAAMQ,eAAe,GAAGT,CAAC,CAACM,MAAM,CAAC;EAC/BI,OAAO,EAAEV,CAAC,CAACE,MAAM,CAACF,CAAC,CAACG,MAAM,CAAC,CAAC,EAAEE,qBAAqB;AACrD,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,oBAAoB,GAAIC,KAAc,IAAsB;EACvE,OAAOH,eAAe,CAACI,KAAK,CAACD,KAAK,CAAC;AACrC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["z","booleanFieldGroup","record","string","boolean","certificateDataSchema","object","C","optional","O","SERIALNUMBER","CN","transform","certificate","country","organization","serialNumber","commonName","credentialEntrySchema","isAuthenticated","certificateData","catchall","VerifierRequest","request","parseVerifierRequest","input","parse"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/request.ts"],"mappings":";;AAAA,SAASA,CAAC,QAAQ,KAAK;;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A;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,oBAAoB,GAAIC,KAAc,IAAsB;EACvE,OAAOH,eAAe,CAACI,KAAK,CAACD,KAAK,CAAC;AACrC,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  export { type VerifierRequest, parseVerifierRequest } from './request';
2
2
  export { type OnErrorPayload, OnErrorPayloadSchema, ModuleErrorSchema, type ModuleErrorCodes, type ModuleError, } from './error';
3
- export { ErrorCode, type Events, type EventsPayload, type EngagementMode, type RetrievalMethod, addListener, startEngagement, close, generateResponse, sendErrorResponse, sendResponse, } from './proximity';
3
+ export { ErrorCode, type Events, type EventsPayload, type EngagementMode, type RetrievalMethod, addListener, startEngagement, close, generateResponse, sendErrorResponse, sendResponse, setHceModalMessage, } from './proximity';
4
4
  export { type RequestedDocument, type AcceptedFields } from '../types';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,SAAS,EACT,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,WAAW,EACX,eAAe,EACf,KAAK,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,SAAS,EACT,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,WAAW,EACX,eAAe,EACf,KAAK,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC"}
@@ -60,8 +60,8 @@ export type RetrievalMethod = 'ble' | 'nfc';
60
60
  * @param config.centralClientMode (Android only) - Whether the device is in central client mode. Defaults to false
61
61
  * @param config.clearBleCache (Android only) - Whether the BLE cache should be cleared. Defaults to true
62
62
  * @param config.certificates - Two-dimensional array of base64 strings representing DER encoded X.509 certificate which are used to authenticate the verifier app
63
- * @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr', 'nfc']
64
- * @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble', 'nfc']
63
+ * @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr']
64
+ * @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble']
65
65
  * @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
66
66
  */
67
67
  export declare function startEngagement(config?: {
@@ -111,4 +111,11 @@ export declare function sendResponse(response: string): Promise<boolean>;
111
111
  * @param callback - The callback to be called when the event is emitted. The callback will receive the event payload as an argument.
112
112
  */
113
113
  export declare function addListener<E extends Events>(event: E, callback: (data: EventsPayload[E]) => void): import("react-native").EmitterSubscription;
114
+ /**
115
+ * **iOS only**
116
+ *
117
+ * Sets a custom message to be displayed in the NFC HCE modal during NFC engagement.
118
+ * @param message - The custom message to be displayed in the NFC HCE modal.
119
+ */
120
+ export declare function setHceModalMessage(message: string): void;
114
121
  //# sourceMappingURL=proximity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proximity.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/proximity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,YAAY,EAAE,SAAS,CAAC;IACxB,YAAY,EAAE,SAAS,CAAC;IACxB,kBAAkB,EAAE,SAAS,CAAC;IAC9B,iBAAiB,EAAE,SAAS,CAAC;IAG7B,yBAAyB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,eAAe,CAAA;KAAE,CAAC;IAC9E,oBAAoB,EAAE,SAAS,CAAC;IAChC,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;AAEzC;;;;GAIG;AACH,oBAAY,SAAS;IACnB,kBAAkB,KAAK;IACvB,aAAa,KAAK;IAClB,kBAAkB,KAAK;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,MAAM,GAAE;IACN,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CA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AAC,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAC1C,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,8CAG3C;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAExD"}
@@ -2,6 +2,22 @@ import { z } from 'zod';
2
2
  declare const VerifierRequest: z.ZodObject<{
3
3
  request: z.ZodRecord<z.ZodString, z.ZodObject<{
4
4
  isAuthenticated: z.ZodBoolean;
5
+ certificateData: z.ZodOptional<z.ZodPipe<z.ZodObject<{
6
+ C: z.ZodOptional<z.ZodString>;
7
+ O: z.ZodOptional<z.ZodString>;
8
+ SERIALNUMBER: z.ZodOptional<z.ZodString>;
9
+ CN: z.ZodOptional<z.ZodString>;
10
+ }, z.core.$strip>, z.ZodTransform<{
11
+ country: string | undefined;
12
+ organization: string | undefined;
13
+ serialNumber: string | undefined;
14
+ commonName: string | undefined;
15
+ }, {
16
+ C?: string | undefined;
17
+ O?: string | undefined;
18
+ SERIALNUMBER?: string | undefined;
19
+ CN?: string | undefined;
20
+ }>>>;
5
21
  }, z.core.$catchall<z.ZodRecord<z.ZodString, z.ZodBoolean>>>>;
6
22
  }, z.core.$strip>;
7
23
  /**
@@ -11,12 +27,18 @@ declare const VerifierRequest: z.ZodObject<{
11
27
  * Example:
12
28
  * `{
13
29
  * "org.iso.18013.5.1.mDL": {
14
- * "isAuthenticated": true,
15
30
  * "org.iso.18013.5.1": {
16
31
  * "hair_colour": true,
17
32
  * "given_name_national_character": true,
18
33
  * "family_name_national_character": true,
19
34
  * "given_name": true,
35
+ * },
36
+ * "isAuthenticated": true,
37
+ * "certificateData": {
38
+ * "country": "UT",
39
+ * "organization": "EUDI Wallet Reference Implementation",
40
+ * "serialNumber": "001",
41
+ * "commonName": "EUDI Proximity Verifier"
20
42
  * }
21
43
  * }
22
44
  * }`
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,QAAA,MAAM,eAAe;;;;iBAEnB,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,KAAG,eAErD,CAAC"}
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4BxB,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;iBAEnB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,KAAG,eAErD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-iso18013",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "React Native bridge for iso18013 methods",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -249,14 +249,14 @@ ISO18013_5.addListener(
249
249
 
250
250
  Starts the proximity flow with the specified engagement and retrieval modes. By default enables both QR code and NFC engagement with both BLE and NFC retrieval. NFC engagement requires iOS 17.4+ on iOS and HCE support on Android.
251
251
 
252
- | Parameter | Platform | Default | Description |
253
- | ------------------- | ----------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------- |
254
- | `peripheralMode` | Android | `true` | Whether the device is in peripheral mode |
255
- | `centralClientMode` | Android | `false` | Whether the device is in central client mode |
256
- | `clearBleCache` | Android | `true` | Whether the BLE cache should be cleared |
257
- | `certificates` | Android/iOS | `[]` | Two-dimensional array of base64 strings representing DER encoded X.509 certificates used to authenticate the verifier app |
258
- | `engagementModes` | Android/iOS | `['qrcode', 'nfc']` | Array of engagement modes to activate (`'qrcode'` and/or `'nfc'`) |
259
- | `retrievalMethods` | Android/iOS | `['ble', 'nfc']` | Array of supported retrieval methods (`'ble'` and/or `'nfc'`) |
252
+ | Parameter | Platform | Default | Description |
253
+ | ------------------- | ----------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------- |
254
+ | `peripheralMode` | Android | `true` | Whether the device is in peripheral mode |
255
+ | `centralClientMode` | Android | `false` | Whether the device is in central client mode |
256
+ | `clearBleCache` | Android | `true` | Whether the BLE cache should be cleared |
257
+ | `certificates` | Android/iOS | `[]` | Two-dimensional array of base64 strings representing DER encoded X.509 certificates used to authenticate the verifier app |
258
+ | `engagementModes` | Android/iOS | `['qrcode', 'nfc']` | Array of engagement modes to activate (`'qrcode'` and/or `'nfc'`) |
259
+ | `retrievalMethods` | Android/iOS | `['ble', 'nfc']` | Array of supported retrieval methods (`'ble'` and/or `'nfc'`) |
260
260
 
261
261
  ```typescript
262
262
  import { ISO18013_5 } from '@pagopa/io-react-native-iso18013';
@@ -339,6 +339,16 @@ import { ISO18013_5 } from '@pagopa/io-react-native-iso18013';
339
339
  await ISO18013_5.close();
340
340
  ```
341
341
 
342
+ #### `setHceModalMessage` (iOS Only)
343
+
344
+ Sets the message to display in the HCE system modal
345
+
346
+ ```typescript
347
+ import { ISO18013_5 } from '@pagopa/io-react-native-iso18013';
348
+
349
+ await ISO18013_5.setHceModalMessage('My custom message');
350
+ ```
351
+
342
352
  ## Proximity Sequence Diagram
343
353
 
344
354
  This section describes a high level overview of the happy flow interactions between an app implementing the `io-react-native-iso18013` library and a verifier app.
@@ -20,6 +20,7 @@ export {
20
20
  generateResponse,
21
21
  sendErrorResponse,
22
22
  sendResponse,
23
+ setHceModalMessage,
23
24
  } from './proximity';
24
25
 
25
26
  export { type RequestedDocument, type AcceptedFields } from '../types';
@@ -65,8 +65,8 @@ export type RetrievalMethod = 'ble' | 'nfc';
65
65
  * @param config.centralClientMode (Android only) - Whether the device is in central client mode. Defaults to false
66
66
  * @param config.clearBleCache (Android only) - Whether the BLE cache should be cleared. Defaults to true
67
67
  * @param config.certificates - Two-dimensional array of base64 strings representing DER encoded X.509 certificate which are used to authenticate the verifier app
68
- * @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr', 'nfc']
69
- * @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble', 'nfc']
68
+ * @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr']
69
+ * @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble']
70
70
  * @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
71
71
  */
72
72
  export function startEngagement(
@@ -84,8 +84,8 @@ export function startEngagement(
84
84
  centralClientMode = false,
85
85
  clearBleCache = true,
86
86
  certificates = [],
87
- engagementModes = ['qrcode', 'nfc'],
88
- retrievalMethods = ['ble', 'nfc'],
87
+ engagementModes = ['qrcode'],
88
+ retrievalMethods = ['ble'],
89
89
  } = config;
90
90
 
91
91
  if (Platform.OS === 'ios') {
@@ -165,3 +165,13 @@ export function addListener<E extends Events>(
165
165
  ) {
166
166
  return eventEmitter.addListener(event, callback);
167
167
  }
168
+
169
+ /**
170
+ * **iOS only**
171
+ *
172
+ * Sets a custom message to be displayed in the NFC HCE modal during NFC engagement.
173
+ * @param message - The custom message to be displayed in the NFC HCE modal.
174
+ */
175
+ export function setHceModalMessage(message: string): void {
176
+ IoReactNativeIso18013.setHceModalMessage(message);
177
+ }
@@ -3,9 +3,26 @@ import { z } from 'zod';
3
3
  // Inner data: a record of booleans with the attributes and the intent to retain flag
4
4
  const booleanFieldGroup = z.record(z.string(), z.boolean());
5
5
 
6
+ // Parses raw X.509 subject fields from the verifier certificate
7
+ // and maps them to readable internal names.
8
+ const certificateDataSchema = z
9
+ .object({
10
+ C: z.string().optional(),
11
+ O: z.string().optional(),
12
+ SERIALNUMBER: z.string().optional(),
13
+ CN: z.string().optional(),
14
+ })
15
+ .transform((certificate) => ({
16
+ country: certificate.C,
17
+ organization: certificate.O,
18
+ serialNumber: certificate.SERIALNUMBER,
19
+ commonName: certificate.CN,
20
+ }));
21
+
6
22
  const credentialEntrySchema = z
7
23
  .object({
8
24
  isAuthenticated: z.boolean(),
25
+ certificateData: certificateDataSchema.optional(),
9
26
  })
10
27
  .catchall(booleanFieldGroup);
11
28
 
@@ -20,12 +37,18 @@ const VerifierRequest = z.object({
20
37
  * Example:
21
38
  * `{
22
39
  * "org.iso.18013.5.1.mDL": {
23
- * "isAuthenticated": true,
24
40
  * "org.iso.18013.5.1": {
25
41
  * "hair_colour": true,
26
42
  * "given_name_national_character": true,
27
43
  * "family_name_national_character": true,
28
44
  * "given_name": true,
45
+ * },
46
+ * "isAuthenticated": true,
47
+ * "certificateData": {
48
+ * "country": "UT",
49
+ * "organization": "EUDI Wallet Reference Implementation",
50
+ * "serialNumber": "001",
51
+ * "commonName": "EUDI Proximity Verifier"
29
52
  * }
30
53
  * }
31
54
  * }`