@pagopa/io-react-native-cie 1.2.1 → 1.2.2

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 CHANGED
@@ -73,14 +73,15 @@ More info in the [official Android documentation](https://developer.android.com/
73
73
  <string>We need to use NFC</string>
74
74
  ```
75
75
  [More info on Apple's doc](https://developer.apple.com/documentation/bundleresources/information-property-list/nfcreaderusagedescription?language=objc)
76
- 3. Add the required ISO7816 identifiers into your `info.plist`
76
+ 3. Add the required ISO7816 identifiers into your `info.plist`. **IMPORTART**: the NFC tags order is important!
77
77
  ```xml
78
78
  <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
79
79
  <array>
80
- <string>A0000000308000000009816001</string>
81
- <string>A00000000039</string>
82
- <string>A0000002471001</string>
83
- <string>00000000000000</string>
80
+ <string>A0000002471001</string>
81
+ <string>A0000000308000000009816001</string>
82
+ <string>A00000000039</string>
83
+ <string>A0000002472001</string>
84
+ <string>00000000000000</string>
84
85
  </array>
85
86
  ```
86
87
  [More info on Apple's doc](https://developer.apple.com/documentation/corenfc/nfciso7816tag).
@@ -97,24 +98,24 @@ To run the example app, follow the instructions in [example/README.md](./example
97
98
 
98
99
  List of available functions
99
100
 
100
- | Function | Return | Description |
101
- | :---------------------------------------------------------------------------------------------------------------------- | :----------------- | :----------------------------------------------------------------------------- |
102
- | `hasNFCFeature()` | `Promise<boolean>` | (Android) Checks if the device supports NFC feature |
103
- | `isNfcEnabled()` | `Promise<boolean>` | (Android) Checks if the NFC is currently enabled |
104
- | `isCieAuthenticationSupported()` | `Promise<boolean>` | (Android) Checks if the device supports CIE autentication |
105
- | `openNfcSettings()` | `Promise<void>` | (Android) Opens NFC system settings page |
106
- | `addListener(event: CieEvent, listener: CieEventHandlers)` | `() => void` | Adds a NFC event listener and returns a function to unsubscribe from the event |
107
- | `removeListener(event: CieEvent)` | `void` | Removes all listeners for the specified event |
108
- | `removeAllListeners()` | `void` | Removes all registered listeners |
109
- | `setCustomIdpUrl(url?: string)` | `void` | Updates IDP url, if `undefined` will use the default IDP url |
110
- | `setAlertMessage(key: AlertMessageKey, value: string)` | `void` | (iOS) Updates iOS NFC modal alert message |
111
- | `setCurrentAlertMessage(value: string)` | `void` | (iOS) Updates currently displayed iOS NFC modal alert message |
112
- | `startInternalAuthentication(challenge: string, resultEncoding?: 'hex' \| 'base64', timeout?: number)` | `Promise<void>` | Start the CIE IAS/NIS Internal Authentication |
113
- | `startMRTDReading(can: string, resultEncoding?: 'hex' \| 'base64', timeout?: number)` | `Promise<void>` | Start PACE MRTD reading (reads MRTD data using CAN) |
114
- | `startInternalAuthAndMRTDReading(can: string, challenge: string, resultEncoding?: 'hex' \| 'base64', timeout?: number)` | `Promise<void>` | Start combined Internal Authentication + PACE MRTD reading |
115
- | `startReadingAttributes(timeout: number)` | `Promise<void>` | Start the CIE attributes reading process |
116
- | `startReading(pin: string, authenticationUrl: string, timeout: number)` | `Promise<void>` | Start the CIE reading process fro authentication |
117
- | `stopReading()` | `Promise<void>` | (Android) Stops all reading process |
101
+ | Function | Return | Description |
102
+ | :------------------------------------------------------------------------------------------------------------------- | :----------------- | :----------------------------------------------------------------------------- |
103
+ | `hasNFCFeature()` | `Promise<boolean>` | (Android) Checks if the device supports NFC feature |
104
+ | `isNfcEnabled()` | `Promise<boolean>` | (Android) Checks if the NFC is currently enabled |
105
+ | `isCieAuthenticationSupported()` | `Promise<boolean>` | (Android) Checks if the device supports CIE autentication |
106
+ | `openNfcSettings()` | `Promise<void>` | (Android) Opens NFC system settings page |
107
+ | `addListener(event: CieEvent, listener: CieEventHandlers)` | `() => void` | Adds a NFC event listener and returns a function to unsubscribe from the event |
108
+ | `removeListener(event: CieEvent)` | `void` | Removes all listeners for the specified event |
109
+ | `removeAllListeners()` | `void` | Removes all registered listeners |
110
+ | `setCustomIdpUrl(url?: string)` | `void` | Updates IDP url, if `undefined` will use the default IDP url |
111
+ | `setAlertMessage(key: AlertMessageKey, value: string)` | `void` | (iOS) Updates iOS NFC modal alert message |
112
+ | `setCurrentAlertMessage(value: string)` | `void` | (iOS) Updates currently displayed iOS NFC modal alert message |
113
+ | `startInternalAuthentication(challenge: string, resultEncoding?: ResultEncoding, timeout?: number)` | `Promise<void>` | Start the CIE IAS/NIS Internal Authentication |
114
+ | `startMRTDReading(can: string, resultEncoding?: ResultEncoding, timeout?: number)` | `Promise<void>` | Start PACE MRTD reading (reads MRTD data using CAN) |
115
+ | `startInternalAuthAndMRTDReading(can: string, challenge: string, resultEncoding?: ResultEncoding, timeout?: number)` | `Promise<void>` | Start combined Internal Authentication + PACE MRTD reading |
116
+ | `startReadingAttributes(timeout: number)` | `Promise<void>` | Start the CIE attributes reading process |
117
+ | `startReading(pin: string, authenticationUrl: string, timeout: number)` | `Promise<void>` | Start the CIE reading process fro authentication |
118
+ | `stopReading()` | `Promise<void>` | (Android) Stops all reading process |
118
119
 
119
120
  ## Usage
120
121
 
@@ -396,6 +397,54 @@ type NfcError = {
396
397
 
397
398
  Error event that may be sent during the CIE reading process. Contains the name of the error and an optional message. Error names and order may vary based on the platform.
398
399
 
400
+ ```typescript
401
+ type InternalAuthResponse = {
402
+ nis: string,
403
+ publicKey: string,
404
+ sod: string,
405
+ signedChallenge: string,
406
+ });
407
+ ```
408
+
409
+ Represent the CIE response coming from NIS Internal Auth.
410
+ All string value are Hex, Base64 or Base64 url encoded
411
+
412
+ ```typescript
413
+ type MrtdResponse = {
414
+ dg1: string,
415
+ dg11: string,
416
+ sod: string,
417
+ });
418
+ ```
419
+
420
+ Represent the CIE response coming from MRTD with PACE reading
421
+ All string value are Hex, Base64 or Base64 url encoded.
422
+
423
+ ```typescript
424
+ type InternalAuthAndMrtdResponse = {
425
+ nis_data: {
426
+ nis: string,
427
+ publicKey: string,
428
+ sod: string,
429
+ signedChallenge: string,
430
+ },
431
+ mrtd_data: {
432
+ dg1: string,
433
+ dg11: string,
434
+ sod: string,
435
+ },
436
+ });
437
+ ```
438
+
439
+ Represent the CIE response coming from NIS Internal Auth and MRTD with PACE reading during the same NFC session.
440
+ All string value are Hex, Base64 or Base64 url encoded.
441
+
442
+ ```typescript
443
+ type ResultEncoding = 'hex' | 'base64' | 'base64url';
444
+ ```
445
+
446
+ Supported types of encoding for Internal Auth and Mrtd reponse payloads.
447
+
399
448
  ## Errors
400
449
 
401
450
  The CIE reading function may throw exceptions if the reading process cannot be initiated. These exceptions indicate issues with input validation or system compatibility.
@@ -439,12 +439,14 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
439
439
  const val NAME = "IoReactNativeCie"
440
440
 
441
441
  enum class ResultEncoding(val value: String) {
442
+ HEX("hex"),
442
443
  BASE64("base64"),
443
- HEX("hex");
444
+ BASE64URL("base64url");
444
445
 
445
446
  fun encode(data: ByteArray): String = when (this) {
446
- BASE64 -> Base64.encodeToString(data, Base64.URL_SAFE or Base64.NO_WRAP)
447
447
  HEX -> data.toHex().uppercase()
448
+ BASE64 -> Base64.encodeToString(data, Base64.DEFAULT or Base64.NO_WRAP)
449
+ BASE64URL -> Base64.encodeToString(data, Base64.URL_SAFE or Base64.NO_WRAP)
448
450
  }
449
451
 
450
452
  companion object {
@@ -452,6 +454,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
452
454
  return when (value) {
453
455
  "hex" -> HEX
454
456
  "base64" -> BASE64
457
+ "base64url" -> BASE64URL
455
458
  else -> BASE64 // Default
456
459
  }
457
460
  }
@@ -32,6 +32,11 @@ extension Array where Element == UInt8 {
32
32
  return Data(self).toHexString()
33
33
  }
34
34
 
35
+ /// Converts the byte array to a base64 encoded string.
36
+ func base64EncodedString() -> String {
37
+ return Data(self).base64EncodedString()
38
+ }
39
+
35
40
  /// Converts the byte array to a base64url encoded string.
36
41
  func base64UrlEncodedString() -> String {
37
42
  return Data(self).base64UrlEncodedString()
@@ -42,6 +47,8 @@ extension Array where Element == UInt8 {
42
47
  case .HEX:
43
48
  return Data(self).toHexString()
44
49
  case .BASE64:
50
+ return Data(self).base64EncodedString()
51
+ case .BASE64URL:
45
52
  return Data(self).base64UrlEncodedString()
46
53
  }
47
54
  }
@@ -8,6 +8,7 @@
8
8
  enum DataEncoding: String, Sendable {
9
9
  case HEX = "HEX"
10
10
  case BASE64 = "BASE64"
11
+ case BASE64URL = "BASE64URL"
11
12
 
12
13
  static func from(string: String?) -> DataEncoding {
13
14
  return DataEncoding(rawValue: string?.uppercased() ?? "") ?? .BASE64
@@ -100,7 +100,7 @@ export const setCurrentAlertMessage = value => {
100
100
  * Initiates the internal authentication process using the provided challenge and timeout.
101
101
  *
102
102
  * @param challenge - The challenge string to be used for authentication.
103
- * @param resultEncoding - The encoding of the result byte arrays, either 'base64' or 'hex' (default: 'base64')
103
+ * @param resultEncoding - The encoding of the result byte arrays, either 'base64', 'base64url' or 'hex' (default: 'base64')
104
104
  * @param timeout - Optional timeout in milliseconds (default: 10000) (**Note**: Android only)
105
105
  * @returns A promise that resolves when the authentication process has ended.
106
106
  */
@@ -1 +1 @@
1
- {"version":3,"names":["NativeEventEmitter","IoReactNativeCie","getDefaultIdpUrl","DEFAULT_TIMEOUT","eventEmitter","addListener","event","listener","subscription","remove","removeListener","removeAllListeners","setCustomIdpUrl","url","setAlertMessage","key","value","setCurrentAlertMessage","startInternalAuthentication","challenge","resultEncoding","timeout","startMRTDReading","can","startInternalAuthAndMRTDReading","startReadingAttributes","startReading","pin","authenticationUrl","stopReading"],"sourceRoot":"../../../src","sources":["manager/index.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,cAAc;AACjD,SAASC,gBAAgB,QAAQ,cAAW;AAE5C,SAASC,gBAAgB,QAAQ,YAAS;AAE1C,MAAMC,eAAe,GAAG,KAAK;AAE7B,MAAMC,YAAY,GAAG,IAAIJ,kBAAkB,CAACC,gBAAgB,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,WAAW,GAAGA,CAClBC,KAAQ,EACRC,QAA6B,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OF,gBAAgB,CAACiB,2BAA2B,CACjDC,SAAS,EACTC,cAAc,EACdC,OACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,MAAAA,CACvBC,GAAW,EACXH,cAAgC,GAAG,QAAQ,EAC3CC,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,gBAAgB,CAACqB,gBAAgB,CAACC,GAAG,EAAEH,cAAc,EAAEC,OAAO,CAAC;AACxE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,+BAA+B,GAAG,MAAAA,CACtCD,GAAW,EACXJ,SAAiB,EACjBC,cAAgC,GAAG,QAAQ,EAC3CC,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,gBAAgB,CAACuB,+BAA+B,CACrDD,GAAG,EACHJ,SAAS,EACTC,cAAc,EACdC,OACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,sBAAsB,GAAG,MAAAA,CAC7BJ,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,gBAAgB,CAACwB,sBAAsB,CAACJ,OAAO,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,YAAY,GAAG,MAAAA,CACnBC,GAAW,EACXC,iBAAyB,EACzBP,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,gBAAgB,CAACyB,YAAY,CAACC,GAAG,EAAEC,iBAAiB,EAAEP,OAAO,CAAC;AACvE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMQ,WAAW,GAAG,MAAAA,CAAA,KAA2B;EAC7C,OAAO5B,gBAAgB,CAAC4B,WAAW,CAAC,CAAC;AACvC,CAAC;AAED,SACExB,WAAW,EACXK,cAAc,EACdC,kBAAkB,EAClBC,eAAe,EACfa,sBAAsB,EACtBP,2BAA2B,EAC3BI,gBAAgB,EAChBE,+BAA+B,EAC/BE,YAAY,EACZG,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["NativeEventEmitter","IoReactNativeCie","getDefaultIdpUrl","DEFAULT_TIMEOUT","eventEmitter","addListener","event","listener","subscription","remove","removeListener","removeAllListeners","setCustomIdpUrl","url","setAlertMessage","key","value","setCurrentAlertMessage","startInternalAuthentication","challenge","resultEncoding","timeout","startMRTDReading","can","startInternalAuthAndMRTDReading","startReadingAttributes","startReading","pin","authenticationUrl","stopReading"],"sourceRoot":"../../../src","sources":["manager/index.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,cAAc;AACjD,SAASC,gBAAgB,QAAQ,cAAW;AAO5C,SAASC,gBAAgB,QAAQ,YAAS;AAE1C,MAAMC,eAAe,GAAG,KAAK;AAE7B,MAAMC,YAAY,GAAG,IAAIJ,kBAAkB,CAACC,gBAAgB,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,WAAW,GAAGA,CAClBC,KAAQ,EACRC,QAA6B,KAC1B;EACH,MAAMC,YAAY,GAAGJ,YAAY,CAACC,WAAW,CAACC,KAAK,EAAEC,QAAQ,CAAC;EAC9D,OAAOC,YAAY,CAACC,MAAM;AA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,MAAAA,CACvBC,GAAW,EACXH,cAA8B,GAAG,QAAQ,EACzCC,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,gBAAgB,CAACqB,gBAAgB,CAACC,GAAG,EAAEH,cAAc,EAAEC,OAAO,CAAC;AACxE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,+BAA+B,GAAG,MAAAA,CACtCD,GAAW,EACXJ,SAAiB,EACjBC,cAA8B,GAAG,QAAQ,EACzCC,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,gBAAgB,CAACuB,+BAA+B,CACrDD,GAAG,EACHJ,SAAS,EACTC,cAAc,EACdC,OACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,sBAAsB,GAAG,MAAAA,CAC7BJ,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,gBAAgB,CAACwB,sBAAsB,CAACJ,OAAO,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,YAAY,GAAG,MAAAA,CACnBC,GAAW,EACXC,iBAAyB,EACzBP,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,gBAAgB,CAACyB,YAAY,CAACC,GAAG,EAAEC,iBAAiB,EAAEP,OAAO,CAAC;AACvE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMQ,WAAW,GAAG,MAAAA,CAAA,KAA2B;EAC7C,OAAO5B,gBAAgB,CAAC4B,WAAW,CAAC,CAAC;AACvC,CAAC;AAED,SACExB,WAAW,EACXK,cAAc,EACdC,kBAAkB,EAClBC,eAAe,EACfa,sBAAsB,EACtBP,2BAA2B,EAC3BI,gBAAgB,EAChBE,+BAA+B,EAC/BE,YAAY,EACZG,WAAW","ignoreList":[]}
@@ -78,6 +78,10 @@ export const CieAttributes = z.object({
78
78
  base64: z.string()
79
79
  });
80
80
 
81
+ /**
82
+ * Possible encodings for the CIE reading results
83
+ */
84
+
81
85
  /**
82
86
  * Event handler that can be used to handle the CIE events during the reading process
83
87
  */
@@ -1 +1 @@
1
- {"version":3,"names":["z","AlertMessageKey","enum","NfcEvent","object","name","string","progress","coerce","number","NfcErrorName","NfcError","union","exclude","message","optional","extract","attemptsLeft","InternalAuthResponseObject","nis","publicKey","sod","signedChallenge","MrtdResponseObject","dg1","dg11","InternalAuthAndMrtdResponse","nis_data","mrtd_data","CieAttributes","type","base64"],"sourceRoot":"../../../src","sources":["manager/types.ts"],"mappings":";;AAAA,SAASA,CAAC,QAAQ,KAAK;;AAEvB;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAGD,CAAC,CAACE,IAAI,CAAC,CACpC,qBAAqB,EACrB,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,CACf,CAAC;AAIF;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGH,CAAC,CAACI,MAAM,CAAC;EAC/BC,IAAI,EAAEL,CAAC,CAACM,MAAM,CAAC,CAAC;EAChBC,QAAQ,EAAEP,CAAC,CAACQ,MAAM,CAACC,MAAM,C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CAAC,CAAC;EAChBe,GAAG,EAAErB,CAAC,CAACM,MAAM,CAAC;AAChB,CAAC,CAAC;AAIF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMoB,2BAA2B,GAAG1B,CAAC,CAACI,MAAM,CAAC;EAClDuB,QAAQ,EAAE3B,CAAC,CAACI,MAAM,CAAC;IACjBe,GAAG,EAAEnB,CAAC,CAACM,MAAM,CAAC,CAAC;IACfc,SAAS,EAAEpB,CAAC,CAACM,MAAM,CAAC,CAAC;IACrBe,GAAG,EAAErB,CAAC,CAACM,MAAM,CAAC,CAAC;IACfgB,eAAe,EAAEtB,CAAC,CAACM,MAAM,CAAC;EAC5B,CAAC,CAAC;EACFsB,SAAS,EAAE5B,CAAC,CAACI,MAAM,CAAC;IAClBoB,GAAG,EAAExB,CAAC,CAACM,MAAM,CAAC,CAAC;IACfmB,IAAI,EAAEzB,CAAC,CAACM,MAAM,CAAC,CAAC;IAChBe,GAAG,EAAErB,CAAC,CAACM,MAAM,CAAC;EAChB,CAAC;AACH,CAAC,CAAC;AAMF;AACA;AACA;AACA,OAAO,MAAMuB,aAAa,GAAG7B,CAAC,CAACI,MAAM,CAAC;EACpC0B,IAAI,EAAE9B,CAAC,CAACM,MAAM,CAAC,CAAC;EAChByB,MAAM,EAAE/B,CAAC,CAACM,MAAM,CAAC;AACnB,CAAC,CAAC;;AAIF;AACA;AACA;;AAeA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["z","AlertMessageKey","enum","NfcEvent","object","name","string","progress","coerce","number","NfcErrorName","NfcError","union","exclude","message","optional","extract","attemptsLeft","InternalAuthResponseObject","nis","publicKey","sod","signedChallenge","MrtdResponseObject","dg1","dg11","InternalAuthAndMrtdResponse","nis_data","mrtd_data","CieAttributes","type","base64"],"sourceRoot":"../../../src","sources":["manager/types.ts"],"mappings":";;AAAA,SAASA,CAAC,QAAQ,KAAK;;AAEvB;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAGD,CAAC,C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reList":[]}
@@ -1,6 +1,6 @@
1
1
  import * as CieUtils from './utils';
2
2
  import * as CieManager from './manager';
3
3
  export { CieUtils, CieManager };
4
- export type { NfcEvent, NfcError, CieAttributes, CieEventHandlers, CieEvent, InternalAuthResponse, MrtdResponse, InternalAuthAndMrtdResponse, } from './manager/types';
4
+ export type { NfcEvent, NfcError, CieAttributes, CieEventHandlers, CieEvent, InternalAuthResponse, MrtdResponse, InternalAuthAndMrtdResponse, ResultEncoding, } from './manager/types';
5
5
  export type { CieErrorSchema, CieError, CieErrorCodes } from './errors';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,UAAU,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAEhC,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,YAAY,EACZ,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,UAAU,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAEhC,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,YAAY,EACZ,2BAA2B,EAC3B,cAAc,GACf,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
- import { AlertMessageKey, type CieEvent, type CieEventHandlers } from './types';
1
+ import { AlertMessageKey, type CieEvent, type CieEventHandlers, type ResultEncoding } from './types';
2
2
  /**
3
3
  * Adds a listener for a specific CIE event.
4
4
  *
@@ -71,11 +71,11 @@ export declare const setCurrentAlertMessage: (value: string) => void;
71
71
  * Initiates the internal authentication process using the provided challenge and timeout.
72
72
  *
73
73
  * @param challenge - The challenge string to be used for authentication.
74
- * @param resultEncoding - The encoding of the result byte arrays, either 'base64' or 'hex' (default: 'base64')
74
+ * @param resultEncoding - The encoding of the result byte arrays, either 'base64', 'base64url' or 'hex' (default: 'base64')
75
75
  * @param timeout - Optional timeout in milliseconds (default: 10000) (**Note**: Android only)
76
76
  * @returns A promise that resolves when the authentication process has ended.
77
77
  */
78
- declare const startInternalAuthentication: (challenge: string, resultEncoding?: "base64" | "hex", timeout?: number) => Promise<void>;
78
+ declare const startInternalAuthentication: (challenge: string, resultEncoding?: ResultEncoding, timeout?: number) => Promise<void>;
79
79
  /**
80
80
  * Initiates a PACE (Password Authenticated Connection Establishment) reading
81
81
  * session on a CIE (Carta d'Identità Elettronica) using the provided CAN (Card
@@ -120,7 +120,7 @@ declare const startInternalAuthentication: (challenge: string, resultEncoding?:
120
120
  * The `'onError'` event is called if an error occurs during the reading process.
121
121
  * The `'onEvent'` event is called to provide progress updates.
122
122
  */
123
- declare const startMRTDReading: (can: string, resultEncoding?: "base64" | "hex", timeout?: number) => Promise<void>;
123
+ declare const startMRTDReading: (can: string, resultEncoding?: ResultEncoding, timeout?: number) => Promise<void>;
124
124
  /**
125
125
  * Initiates a combined reading session on a CIE (Carta d'Identità Elettronica)
126
126
  * that performs both Internal Authentication and MRTD reading using PACE.
@@ -166,7 +166,7 @@ declare const startMRTDReading: (can: string, resultEncoding?: "base64" | "hex",
166
166
  * The `'onError'` event is called if an error occurs during the reading process.
167
167
  * The `'onEvent'` event is called to provide progress updates.
168
168
  */
169
- declare const startInternalAuthAndMRTDReading: (can: string, challenge: string, resultEncoding?: "base64" | "hex", timeout?: number) => Promise<void>;
169
+ declare const startInternalAuthAndMRTDReading: (can: string, challenge: string, resultEncoding?: ResultEncoding, timeout?: number) => Promise<void>;
170
170
  /**
171
171
  * Starts the process of reading attributes from the CIE card.
172
172
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/manager/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAOhF;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,EACrC,OAAO,CAAC,EACR,UAAU,gBAAgB,CAAC,CAAC,CAAC,eAI9B,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,cAAc,GAAI,OAAO,QAAQ,SAEtC,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,kBAAkB,YAKvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,eAAe,GAAI,KAAK,MAAM,GAAG,SAAS,SAE/C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,eAAe,EAAE,OAAO,MAAM,SAElE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,MAAM,SAEnD,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,2BAA2B,GAC/B,WAAW,MAAM,EACjB,iBAAgB,QAAQ,GAAG,KAAgB,EAC3C,UAAS,MAAwB,KAChC,OAAO,CAAC,IAAI,CAMd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,QAAA,MAAM,gBAAgB,GACpB,KAAK,MAAM,EACX,iBAAgB,QAAQ,GAAG,KAAgB,EAC3C,UAAS,MAAwB,KAChC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"}
@@ -166,6 +166,10 @@ export declare const CieAttributes: z.ZodObject<{
166
166
  base64: string;
167
167
  }>;
168
168
  export type CieAttributes = z.infer<typeof CieAttributes>;
169
+ /**
170
+ * Possible encodings for the CIE reading results
171
+ */
172
+ export type ResultEncoding = 'hex' | 'base64' | 'base64url';
169
173
  /**
170
174
  * Event handler that can be used to handle the CIE events during the reading process
171
175
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,eAAe,+LAW1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;EAGnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,YAAY,uNAYvB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;IAWnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;EAKrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CA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,KAAK,IAAI,CAAC;IACnC,+BAA+B,EAAE,CAC/B,oBAAoB,EAAE,oBAAoB,KACvC,IAAI,CAAC;IACV,qBAAqB,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5D,oCAAoC,EAAE,CACpC,2BAA2B,EAAE,2BAA2B,KACrD,IAAI,CAAC;IACV,mBAAmB,EAAE,CAAC,UAAU,EAAE,aAAa,KAAK,IAAI,CAAC;IACzD,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-cie",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Native support for CIE",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/module/index.js",
package/src/index.ts CHANGED
@@ -12,6 +12,7 @@ export type {
12
12
  InternalAuthResponse,
13
13
  MrtdResponse,
14
14
  InternalAuthAndMrtdResponse,
15
+ ResultEncoding,
15
16
  } from './manager/types';
16
17
 
17
18
  export type { CieErrorSchema, CieError, CieErrorCodes } from './errors';
@@ -1,6 +1,11 @@
1
1
  import { NativeEventEmitter } from 'react-native';
2
2
  import { IoReactNativeCie } from '../native';
3
- import { AlertMessageKey, type CieEvent, type CieEventHandlers } from './types';
3
+ import {
4
+ AlertMessageKey,
5
+ type CieEvent,
6
+ type CieEventHandlers,
7
+ type ResultEncoding,
8
+ } from './types';
4
9
  import { getDefaultIdpUrl } from './utils';
5
10
 
6
11
  const DEFAULT_TIMEOUT = 10000;
@@ -104,13 +109,13 @@ export const setCurrentAlertMessage = (value: string) => {
104
109
  * Initiates the internal authentication process using the provided challenge and timeout.
105
110
  *
106
111
  * @param challenge - The challenge string to be used for authentication.
107
- * @param resultEncoding - The encoding of the result byte arrays, either 'base64' or 'hex' (default: 'base64')
112
+ * @param resultEncoding - The encoding of the result byte arrays, either 'base64', 'base64url' or 'hex' (default: 'base64')
108
113
  * @param timeout - Optional timeout in milliseconds (default: 10000) (**Note**: Android only)
109
114
  * @returns A promise that resolves when the authentication process has ended.
110
115
  */
111
116
  const startInternalAuthentication = async (
112
117
  challenge: string,
113
- resultEncoding: 'base64' | 'hex' = 'base64',
118
+ resultEncoding: ResultEncoding = 'base64',
114
119
  timeout: number = DEFAULT_TIMEOUT
115
120
  ): Promise<void> => {
116
121
  return IoReactNativeCie.startInternalAuthentication(
@@ -166,7 +171,7 @@ const startInternalAuthentication = async (
166
171
  */
167
172
  const startMRTDReading = async (
168
173
  can: string,
169
- resultEncoding: 'base64' | 'hex' = 'base64',
174
+ resultEncoding: ResultEncoding = 'base64',
170
175
  timeout: number = DEFAULT_TIMEOUT
171
176
  ): Promise<void> => {
172
177
  return IoReactNativeCie.startMRTDReading(can, resultEncoding, timeout);
@@ -220,7 +225,7 @@ const startMRTDReading = async (
220
225
  const startInternalAuthAndMRTDReading = async (
221
226
  can: string,
222
227
  challenge: string,
223
- resultEncoding: 'base64' | 'hex' = 'base64',
228
+ resultEncoding: ResultEncoding = 'base64',
224
229
  timeout: number = DEFAULT_TIMEOUT
225
230
  ): Promise<void> => {
226
231
  return IoReactNativeCie.startInternalAuthAndMRTDReading(
@@ -126,6 +126,11 @@ export const CieAttributes = z.object({
126
126
 
127
127
  export type CieAttributes = z.infer<typeof CieAttributes>;
128
128
 
129
+ /**
130
+ * Possible encodings for the CIE reading results
131
+ */
132
+ export type ResultEncoding = 'hex' | 'base64' | 'base64url';
133
+
129
134
  /**
130
135
  * Event handler that can be used to handle the CIE events during the reading process
131
136
  */