@pagopa/io-react-native-cie 1.3.1 → 1.3.3
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/IoReactNativeCie.podspec +1 -1
- package/README.md +57 -7
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/pagopa/ioreactnativecie/IoReactNativeCieModule.kt +52 -10
- package/ios/IoReactNativeCie.mm +8 -0
- package/ios/IoReactNativeCie.swift +27 -4
- package/lib/module/errors.js +1 -1
- package/lib/module/errors.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/logger/index.js +37 -0
- package/lib/module/logger/index.js.map +1 -0
- package/lib/module/logger/types.js +15 -0
- package/lib/module/logger/types.js.map +1 -0
- package/lib/typescript/src/errors.d.ts +4 -4
- package/lib/typescript/src/errors.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/logger/index.d.ts +27 -0
- package/lib/typescript/src/logger/index.d.ts.map +1 -0
- package/lib/typescript/src/logger/types.d.ts +13 -0
- package/lib/typescript/src/logger/types.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/errors.ts +1 -0
- package/src/index.ts +5 -1
- package/src/logger/index.ts +37 -0
- package/src/logger/types.ts +14 -0
package/IoReactNativeCie.podspec
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
17
|
|
|
18
18
|
# CieSDK dependency
|
|
19
|
-
s.dependency "CieSDK", "~> 0.1.
|
|
19
|
+
s.dependency "CieSDK", "~> 0.1.19"
|
|
20
20
|
|
|
21
21
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
22
22
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ Module to handle CIE (Electronic Identity Card) operations natively in React Nat
|
|
|
15
15
|
- [API](#api)
|
|
16
16
|
- [Usage](#usage)
|
|
17
17
|
- [Check NFC Status](#check-nfc-status)
|
|
18
|
+
- [Logs](#logs)
|
|
18
19
|
- [Reading CIE Data](#reading-cie-data)
|
|
19
20
|
- [Reading Attributes](#reading-attributes)
|
|
20
21
|
- [Authentication](#authentication)
|
|
@@ -116,13 +117,17 @@ List of available functions
|
|
|
116
117
|
| `startReadingAttributes(timeout: number)` | `Promise<void>` | Start the CIE attributes reading process |
|
|
117
118
|
| `startReading(pin: string, authenticationUrl: string, timeout: number)` | `Promise<void>` | Start the CIE reading process fro authentication |
|
|
118
119
|
| `stopReading()` | `Promise<void>` | (Android) Stops all reading process |
|
|
120
|
+
| `setLogMode(mode: LogMode)` | `void` | (iOS) Sets the log mode for the CIE SDK |
|
|
121
|
+
| `getLogsFilePath()` | `Promise<string>` | (iOS) Returns file path of CIE SDK logs |
|
|
122
|
+
| `getLogs()` | `Promise<string>` | (iOS) Returns content of CIE SDK logs |
|
|
119
123
|
|
|
120
124
|
## Usage
|
|
121
125
|
|
|
122
|
-
The package is split into
|
|
126
|
+
The package is split into three modules:
|
|
123
127
|
|
|
124
128
|
- [CieUtils](/src/utils): Provides functions to check the NFC status of the device.
|
|
125
129
|
- [CieManager](/src/manager): Provides CIE read and authentication capabilities.
|
|
130
|
+
- [CieLogger](/src/logger): Provides logging utils
|
|
126
131
|
|
|
127
132
|
### Check NFC Status
|
|
128
133
|
|
|
@@ -139,6 +144,29 @@ await CieUtils.isNfcEnabled();
|
|
|
139
144
|
await CieUtils.isCieAuthenticationSupported();
|
|
140
145
|
```
|
|
141
146
|
|
|
147
|
+
### Logs
|
|
148
|
+
|
|
149
|
+
**Note:** Logging is only supported on iOS. On Android, these methods will throw an error.
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
import { CieLogger } from '@pagopa/io-react-native-cie';
|
|
153
|
+
|
|
154
|
+
// Enable logging to local file
|
|
155
|
+
CieLogger.setLogMode('localFile');
|
|
156
|
+
|
|
157
|
+
// Enable logging to console
|
|
158
|
+
CieLogger.setLogMode('console');
|
|
159
|
+
|
|
160
|
+
// Disable logging
|
|
161
|
+
CieLogger.setLogMode('disabled');
|
|
162
|
+
|
|
163
|
+
// Get logs file path
|
|
164
|
+
const path = await CieLogger.getLogsFilePath();
|
|
165
|
+
|
|
166
|
+
// Get logs content
|
|
167
|
+
const logs = await CieLogger.getLogs();
|
|
168
|
+
```
|
|
169
|
+
|
|
142
170
|
### Reading CIE Data
|
|
143
171
|
|
|
144
172
|
#### Internal Authentication
|
|
@@ -447,17 +475,39 @@ type ResultEncoding = 'hex' | 'base64' | 'base64url';
|
|
|
447
475
|
|
|
448
476
|
Supported types of encoding for Internal Auth and Mrtd reponse payloads.
|
|
449
477
|
|
|
478
|
+
```typescript
|
|
479
|
+
type LogMode = 'localFile' | 'console' | 'disabled';
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
Log mode for the CIE SDK:
|
|
483
|
+
|
|
484
|
+
- `localFile`: Logs saved to device for later retrieval
|
|
485
|
+
- `console`: Logs output to console for real-time monitoring
|
|
486
|
+
- `disabled`: Disables all logging
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
type CertificateData = {
|
|
490
|
+
name?: string;
|
|
491
|
+
surname?: string;
|
|
492
|
+
fiscalCode?: string;
|
|
493
|
+
docSerialNumber?: string;
|
|
494
|
+
};
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
Contains CIE certificate data read from the card.
|
|
498
|
+
|
|
450
499
|
## Errors
|
|
451
500
|
|
|
452
501
|
The CIE reading function may throw exceptions if the reading process cannot be initiated. These exceptions indicate issues with input validation or system compatibility.
|
|
453
502
|
Below is a comprehensive list of possible exceptions that may be thrown during initialization:
|
|
454
503
|
|
|
455
|
-
| Error Code | Platform | Description
|
|
456
|
-
| --------------------- | ----------- |
|
|
457
|
-
| `PIN_REGEX_NOT_VALID` |
|
|
458
|
-
| `INVALID_AUTH_URL` |
|
|
459
|
-
| `THREADING_ERROR` | iOS | Unexpected error
|
|
460
|
-
| `
|
|
504
|
+
| Error Code | Platform | Description |
|
|
505
|
+
| --------------------- | ----------- | --------------------------------- |
|
|
506
|
+
| `PIN_REGEX_NOT_VALID` | iOS/Android | Invalid PIN format |
|
|
507
|
+
| `INVALID_AUTH_URL` | iOS/Android | Invalid auth url format |
|
|
508
|
+
| `THREADING_ERROR` | iOS | Unexpected error |
|
|
509
|
+
| `UNSUPPORTED` | Android | Feature not supported on platform |
|
|
510
|
+
| `UNKNOWN_EXCEPTION` | iOS/Android | Unexpected error |
|
|
461
511
|
|
|
462
512
|
## Contributing
|
|
463
513
|
|
package/android/build.gradle
CHANGED
|
@@ -78,6 +78,6 @@ dependencies {
|
|
|
78
78
|
implementation "com.facebook.react:react-android"
|
|
79
79
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
80
80
|
// CIE SDK
|
|
81
|
-
implementation "it.pagopa.io.app.cie:cie:0.1.
|
|
81
|
+
implementation "it.pagopa.io.app.cie:cie:0.1.10"
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.pagopa.ioreactnativecie
|
|
2
2
|
|
|
3
3
|
import android.util.Base64
|
|
4
|
+
import android.app.Activity
|
|
4
5
|
import com.facebook.react.bridge.Promise
|
|
5
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
7
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
@@ -26,10 +27,15 @@ import it.pagopa.io.app.cie.pace.PaceCallback
|
|
|
26
27
|
import it.pagopa.io.app.cie.toHex
|
|
27
28
|
import it.pagopa.io.app.cie.cie.CieCertificateDataCallback
|
|
28
29
|
import java.net.URL
|
|
30
|
+
import java.lang.ref.WeakReference
|
|
29
31
|
|
|
30
32
|
class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
31
33
|
ReactContextBaseJavaModule(reactContext) {
|
|
32
34
|
|
|
35
|
+
private var _cieSdk: CieSDK? = null
|
|
36
|
+
private var _sdkActivityRef: WeakReference<Activity>? = null
|
|
37
|
+
private var _customIdpUrl: String? = null
|
|
38
|
+
|
|
33
39
|
init {
|
|
34
40
|
CieLogger.enabled = BuildConfig.DEBUG
|
|
35
41
|
}
|
|
@@ -39,11 +45,27 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
/**
|
|
42
|
-
*
|
|
48
|
+
* Getter for a valid Cie SDK instance. Because the SDK is initialized with an activity,
|
|
49
|
+
* the instance must be recreated if the original activity has changed.
|
|
43
50
|
*/
|
|
44
|
-
val cieSdk: CieSDK
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
val cieSdk: CieSDK
|
|
52
|
+
get() {
|
|
53
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
54
|
+
?: throw Exception("Can not initialize Cie SDK with a null activity")
|
|
55
|
+
|
|
56
|
+
val hasActivityChanged = _sdkActivityRef?.get() != currentActivity
|
|
57
|
+
|
|
58
|
+
if (_cieSdk == null || hasActivityChanged) {
|
|
59
|
+
val newSdk = CieSDK.withContext(currentActivity)
|
|
60
|
+
// Re-apply saved configurations
|
|
61
|
+
_customIdpUrl?.let { newSdk.withCustomIdpUrl(it) }
|
|
62
|
+
// Update references
|
|
63
|
+
_cieSdk = newSdk
|
|
64
|
+
_sdkActivityRef = WeakReference(currentActivity)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return _cieSdk!!
|
|
68
|
+
}
|
|
47
69
|
|
|
48
70
|
@Suppress("unused")
|
|
49
71
|
@ReactMethod
|
|
@@ -113,6 +135,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
113
135
|
@Suppress("unused")
|
|
114
136
|
@ReactMethod
|
|
115
137
|
fun setCustomIdpUrl(url: String) {
|
|
138
|
+
_customIdpUrl = url
|
|
116
139
|
cieSdk.withCustomIdpUrl(url)
|
|
117
140
|
}
|
|
118
141
|
|
|
@@ -126,7 +149,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
126
149
|
) {
|
|
127
150
|
val encoding: ResultEncoding = ResultEncoding.fromString(resultEncoding)
|
|
128
151
|
try {
|
|
129
|
-
cieSdk.startReadingNis(challenge, timeout, object : NfcEvents {
|
|
152
|
+
cieSdk.startReadingNis(challenge, timeout, true, object : NfcEvents {
|
|
130
153
|
override fun event(event: NfcEvent) {
|
|
131
154
|
this@IoReactNativeCieModule.reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
132
155
|
.emit(EventType.EVENT.value, WritableNativeMap().apply {
|
|
@@ -181,7 +204,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
181
204
|
) {
|
|
182
205
|
val encoding: ResultEncoding = ResultEncoding.fromString(resultEncoding)
|
|
183
206
|
try {
|
|
184
|
-
cieSdk.startDoPace(can, timeout, object : NfcEvents {
|
|
207
|
+
cieSdk.startDoPace(can, timeout, true, object : NfcEvents {
|
|
185
208
|
override fun event(event: NfcEvent) {
|
|
186
209
|
this@IoReactNativeCieModule.reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
187
210
|
.emit(EventType.EVENT.value, WritableNativeMap().apply {
|
|
@@ -236,7 +259,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
236
259
|
) {
|
|
237
260
|
val encoding: ResultEncoding = ResultEncoding.fromString(resultEncoding)
|
|
238
261
|
try {
|
|
239
|
-
cieSdk.startNisAndPace(challenge, can, timeout, object : NfcEvents {
|
|
262
|
+
cieSdk.startNisAndPace(challenge, can, timeout, true, object : NfcEvents {
|
|
240
263
|
override fun event(event: NfcEvent) {
|
|
241
264
|
this@IoReactNativeCieModule.reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
242
265
|
.emit(EventType.EVENT.value, WritableNativeMap().apply {
|
|
@@ -303,7 +326,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
303
326
|
promise: Promise,
|
|
304
327
|
) {
|
|
305
328
|
try {
|
|
306
|
-
cieSdk.startReadingCieAtr(timeout, object : NfcEvents {
|
|
329
|
+
cieSdk.startReadingCieAtr(timeout, true, object : NfcEvents {
|
|
307
330
|
override fun event(event: NfcEvent) {
|
|
308
331
|
this@IoReactNativeCieModule.reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
309
332
|
.emit(EventType.EVENT.value, WritableNativeMap().apply {
|
|
@@ -369,7 +392,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
369
392
|
}
|
|
370
393
|
|
|
371
394
|
try {
|
|
372
|
-
cieSdk.startReading(timeout, object : NfcEvents {
|
|
395
|
+
cieSdk.startReading(timeout, true, object : NfcEvents {
|
|
373
396
|
override fun event(event: NfcEvent) {
|
|
374
397
|
this@IoReactNativeCieModule.reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
375
398
|
.emit(EventType.EVENT.value, WritableNativeMap().apply {
|
|
@@ -424,7 +447,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
424
447
|
}
|
|
425
448
|
|
|
426
449
|
try {
|
|
427
|
-
cieSdk.startReadingCertificate(timeout, object : NfcEvents {
|
|
450
|
+
cieSdk.startReadingCertificate(timeout, true, object : NfcEvents {
|
|
428
451
|
override fun event(event: NfcEvent) {
|
|
429
452
|
this@IoReactNativeCieModule.reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
430
453
|
.emit(EventType.EVENT.value, WritableNativeMap().apply {
|
|
@@ -469,6 +492,24 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
469
492
|
}
|
|
470
493
|
}
|
|
471
494
|
|
|
495
|
+
@Suppress("unused")
|
|
496
|
+
@ReactMethod
|
|
497
|
+
fun setLogMode(mode: String, promise: Promise) {
|
|
498
|
+
promise.reject(ModuleException.UNSUPPORTED, "Logging is not supported on Android", null)
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
@Suppress("unused")
|
|
502
|
+
@ReactMethod
|
|
503
|
+
fun getLogsFilePath(promise: Promise) {
|
|
504
|
+
promise.reject(ModuleException.UNSUPPORTED, "Logging is not supported on Android", null)
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
@Suppress("unused")
|
|
508
|
+
@ReactMethod
|
|
509
|
+
fun getLogs(promise: Promise) {
|
|
510
|
+
promise.reject(ModuleException.UNSUPPORTED, "Logging is not supported on Android", null)
|
|
511
|
+
}
|
|
512
|
+
|
|
472
513
|
@Suppress("unused")
|
|
473
514
|
@ReactMethod
|
|
474
515
|
fun stopReading() {
|
|
@@ -553,6 +594,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
553
594
|
const val PIN_REGEX_NOT_VALID = "PIN_REGEX_NOT_VALID"
|
|
554
595
|
const val INVALID_AUTH_URL = "INVALID_AUTH_URL"
|
|
555
596
|
const val UNKNOWN_EXCEPTION = "UNKNOWN_EXCEPTION"
|
|
597
|
+
const val UNSUPPORTED = "UNSUPPORTED"
|
|
556
598
|
}
|
|
557
599
|
}
|
|
558
600
|
}
|
package/ios/IoReactNativeCie.mm
CHANGED
|
@@ -59,6 +59,14 @@ RCT_EXTERN_METHOD(startReadingCertificate: (NSString)pin
|
|
|
59
59
|
withResolver: (RCTPromiseResolveBlock)resolve
|
|
60
60
|
withRejecter: (RCTPromiseRejectBlock)reject)
|
|
61
61
|
|
|
62
|
+
RCT_EXTERN_METHOD(setLogMode: (NSString)mode)
|
|
63
|
+
|
|
64
|
+
RCT_EXTERN_METHOD(getLogsFilePath: (RCTPromiseResolveBlock)resolve
|
|
65
|
+
withRejecter: (RCTPromiseRejectBlock)reject)
|
|
66
|
+
|
|
67
|
+
RCT_EXTERN_METHOD(getLogs: (RCTPromiseResolveBlock)resolve
|
|
68
|
+
withRejecter: (RCTPromiseRejectBlock)reject)
|
|
69
|
+
|
|
62
70
|
+ (BOOL)requiresMainQueueSetup
|
|
63
71
|
{
|
|
64
72
|
return NO;
|
|
@@ -6,11 +6,7 @@ class IoReactNativeCie: RCTEventEmitter {
|
|
|
6
6
|
private let cieSdk: CieDigitalId
|
|
7
7
|
|
|
8
8
|
override init() {
|
|
9
|
-
#if DEBUG
|
|
10
|
-
self.cieSdk = CieDigitalId.init(.console)
|
|
11
|
-
#else
|
|
12
9
|
self.cieSdk = CieDigitalId.init()
|
|
13
|
-
#endif
|
|
14
10
|
super.init()
|
|
15
11
|
}
|
|
16
12
|
|
|
@@ -292,6 +288,33 @@ class IoReactNativeCie: RCTEventEmitter {
|
|
|
292
288
|
}
|
|
293
289
|
}
|
|
294
290
|
|
|
291
|
+
@objc func setLogMode(_ mode: NSString) {
|
|
292
|
+
let logMode = CieDigitalId.LogMode(rawValue: mode as String) ?? .disabled
|
|
293
|
+
cieSdk.setLogMode(logMode)
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
@objc func getLogsFilePath(
|
|
297
|
+
_ resolve: RCTPromiseResolveBlock,
|
|
298
|
+
withRejecter reject: RCTPromiseRejectBlock
|
|
299
|
+
) {
|
|
300
|
+
if let fileUrl = CieDigitalId.retriveLastLogFilePath() {
|
|
301
|
+
resolve(fileUrl)
|
|
302
|
+
} else {
|
|
303
|
+
reject(ModuleException.unexpected.rawValue, "Failed to retrieve last log file path", nil)
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
@objc func getLogs(
|
|
308
|
+
_ resolve: RCTPromiseResolveBlock,
|
|
309
|
+
withRejecter reject: RCTPromiseRejectBlock
|
|
310
|
+
) {
|
|
311
|
+
if let logs = CieDigitalId.retriveLastLogFile() {
|
|
312
|
+
resolve(logs)
|
|
313
|
+
} else {
|
|
314
|
+
reject(ModuleException.unexpected.rawValue, "Failed to retrieve last log", nil)
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
295
318
|
func handleReadEvent(event: CieSDK.CieDigitalIdEvent, progress: Float) {
|
|
296
319
|
let payload: NSDictionary = ["name": "\(event)", "progress": progress]
|
|
297
320
|
self.sendEvent(withName: EventType.onEvent.rawValue, body: payload)
|
package/lib/module/errors.js
CHANGED
|
@@ -34,7 +34,7 @@ const ModuleErrorIosSchema = z.object({
|
|
|
34
34
|
*/
|
|
35
35
|
const ModuleErrorCodesSchema = z.enum(['PIN_REGEX_NOT_VALID', 'INVALID_AUTH_URL', 'THREADING_ERROR',
|
|
36
36
|
// iOS only
|
|
37
|
-
'UNKNOWN_EXCEPTION']);
|
|
37
|
+
'UNSUPPORTED', 'UNKNOWN_EXCEPTION']);
|
|
38
38
|
/**
|
|
39
39
|
* Schema which can be used to parse a rejected promise error the module.
|
|
40
40
|
* This schema contains the common parameters that are shared across both Android and iOS native modules.
|
package/lib/module/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["z","StackTraceElementSchema","object","lineNumber","number","file","string","methodName","class","ModuleErrorAndroidSchema","nativeStackAndroid","array","partial","ModuleErrorIosSchema","domain","nativeStackIOS","ModuleErrorCodesSchema","enum","CieErrorSchema","code","message","name","userInfo","record","any","optional","or","null","and"],"sourceRoot":"../../src","sources":["errors.ts"],"mappings":";;AAAA,SAASA,CAAC,QAAQ,KAAK;;AAEvB;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGD,CAAC,CAACE,MAAM,CAAC;EACvCC,UAAU,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACtBC,IAAI,EAAEL,CAAC,CAACM,MAAM,CAAC,CAAC;EAChBC,UAAU,EAAEP,CAAC,CAACM,MAAM,CAAC,CAAC;EACtBE,KAAK,EAAER,CAAC,CAACM,MAAM,CAAC;AAClB,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA,MAAMG,wBAAwB,GAAGT,CAAC,CAC/BE,MAAM,CAAC;EACNQ,kBAAkB,EAAEV,CAAC,CAACW,KAAK,CAACV,uBAAuB;AACrD,CAAC,CAAC,CACDW,OAAO,CAAC,CAAC;;AAEZ;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAGb,CAAC,CAC3BE,MAAM,CAAC;EACNY,MAAM,EAAEd,CAAC,CAACM,MAAM,CAAC,CAAC;EAClBS,cAAc,EAAEf,CAAC,CAACW,KAAK,CAACX,CAAC,CAACM,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC,CACDM,OAAO,CAAC,CAAC;;AAEZ;AACA;AACA;AACA,MAAMI,sBAAsB,GAAGhB,CAAC,CAACiB,IAAI,CAAC,CACpC,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB;AAAE;AACnB,mBAAmB,CACpB,CAAC;AAIF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,cAAc,GAAGlB,CAAC,CAC5BE,MAAM,CAAC;EACNiB,IAAI,EAAEH,sBAAsB;EAC5BI,OAAO,EAAEpB,CAAC,CAACM,MAAM,CAAC,CAAC;EACnBe,IAAI,EAAErB,CAAC,CAACM,MAAM,CAAC,CAAC;EAChBgB,QAAQ,EAAEtB,CAAC,CAACuB,MAAM,CAACvB,CAAC,CAACM,MAAM,CAAC,CAAC,EAAEN,CAAC,CAACwB,GAAG,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,EAAE,CAAC1B,CAAC,CAAC2B,IAAI,CAAC,CAAC;AAChE,CAAC,CAAC,CACDC,GAAG,CAACnB,wBAAwB,CAAC,CAC7BmB,GAAG,CAACf,oBAAoB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["z","StackTraceElementSchema","object","lineNumber","number","file","string","methodName","class","ModuleErrorAndroidSchema","nativeStackAndroid","array","partial","ModuleErrorIosSchema","domain","nativeStackIOS","ModuleErrorCodesSchema","enum","CieErrorSchema","code","message","name","userInfo","record","any","optional","or","null","and"],"sourceRoot":"../../src","sources":["errors.ts"],"mappings":";;AAAA,SAASA,CAAC,QAAQ,KAAK;;AAEvB;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGD,CAAC,CAACE,MAAM,CAAC;EACvCC,UAAU,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EACtBC,IAAI,EAAEL,CAAC,CAACM,MAAM,CAAC,CAAC;EAChBC,UAAU,EAAEP,CAAC,CAACM,MAAM,CAAC,CAAC;EACtBE,KAAK,EAAER,CAAC,CAACM,MAAM,CAAC;AAClB,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA,MAAMG,wBAAwB,GAAGT,CAAC,CAC/BE,MAAM,CAAC;EACNQ,kBAAkB,EAAEV,CAAC,CAACW,KAAK,CAACV,uBAAuB;AACrD,CAAC,CAAC,CACDW,OAAO,CAAC,CAAC;;AAEZ;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAGb,CAAC,CAC3BE,MAAM,CAAC;EACNY,MAAM,EAAEd,CAAC,CAACM,MAAM,CAAC,CAAC;EAClBS,cAAc,EAAEf,CAAC,CAACW,KAAK,CAACX,CAAC,CAACM,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC,CACDM,OAAO,CAAC,CAAC;;AAEZ;AACA;AACA;AACA,MAAMI,sBAAsB,GAAGhB,CAAC,CAACiB,IAAI,CAAC,CACpC,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB;AAAE;AACnB,aAAa,EACb,mBAAmB,CACpB,CAAC;AAIF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,cAAc,GAAGlB,CAAC,CAC5BE,MAAM,CAAC;EACNiB,IAAI,EAAEH,sBAAsB;EAC5BI,OAAO,EAAEpB,CAAC,CAACM,MAAM,CAAC,CAAC;EACnBe,IAAI,EAAErB,CAAC,CAACM,MAAM,CAAC,CAAC;EAChBgB,QAAQ,EAAEtB,CAAC,CAACuB,MAAM,CAACvB,CAAC,CAACM,MAAM,CAAC,CAAC,EAAEN,CAAC,CAACwB,GAAG,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,EAAE,CAAC1B,CAAC,CAAC2B,IAAI,CAAC,CAAC;AAChE,CAAC,CAAC,CACDC,GAAG,CAACnB,wBAAwB,CAAC,CAC7BmB,GAAG,CAACf,oBAAoB,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CieUtils","CieManager"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAO,KAAKA,QAAQ,MAAM,kBAAS;AACnC,OAAO,KAAKC,UAAU,MAAM,oBAAW;
|
|
1
|
+
{"version":3,"names":["CieUtils","CieManager","CieLogger"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAO,KAAKA,QAAQ,MAAM,kBAAS;AACnC,OAAO,KAAKC,UAAU,MAAM,oBAAW;AACvC,OAAO,KAAKC,SAAS,MAAM,mBAAU;AAErC,SAASF,QAAQ,EAAEC,UAAU,EAAEC,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { IoReactNativeCie } from "../native.js";
|
|
4
|
+
/**
|
|
5
|
+
* Sets the log mode for the CIE SDK.
|
|
6
|
+
*
|
|
7
|
+
* **Note**: Logging is only supported on iOS. On Android, this method will throw an error.
|
|
8
|
+
*
|
|
9
|
+
* @param mode - The log mode to set ('console', 'localFile', or 'disabled').
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* CieManager.setLogMode('console');
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
const setLogMode = mode => {
|
|
16
|
+
IoReactNativeCie.setLogMode(mode);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the file path of the latest logs generated by the CIE SDK.
|
|
21
|
+
* @returns A promise that resolves to a string representing the file path of the latest logs.
|
|
22
|
+
* @throws {CieError} If cannot retrieve the logs path.
|
|
23
|
+
*/
|
|
24
|
+
const getLogsFilePath = async () => {
|
|
25
|
+
return IoReactNativeCie.getLogsFilePath();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves the contetent of the latest logs generated by the CIE SDK.
|
|
30
|
+
* @returns A promise that resolves to a string representing the content of the latest logs.
|
|
31
|
+
* @throws {CieError} If cannot retrieve the logs content.
|
|
32
|
+
*/
|
|
33
|
+
const getLogs = async () => {
|
|
34
|
+
return IoReactNativeCie.getLogs();
|
|
35
|
+
};
|
|
36
|
+
export { setLogMode, getLogsFilePath, getLogs };
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["IoReactNativeCie","setLogMode","mode","getLogsFilePath","getLogs"],"sourceRoot":"../../../src","sources":["logger/index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,cAAW;AAG5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAIC,IAAa,IAAK;EACpCF,gBAAgB,CAACC,UAAU,CAACC,IAAI,CAAC;AACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAG,MAAAA,CAAA,KAA6B;EACnD,OAAOH,gBAAgB,CAACG,eAAe,CAAC,CAAC;AAC3C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,OAAO,GAAG,MAAAA,CAAA,KAA6B;EAC3C,OAAOJ,gBAAgB,CAACI,OAAO,CAAC,CAAC;AACnC,CAAC;AAED,SAASH,UAAU,EAAEE,eAAe,EAAEC,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represent the log mode for the CIE SDK
|
|
7
|
+
*
|
|
8
|
+
* - `localFile`: Logs are saved to a local file on the device for later retrieval.
|
|
9
|
+
* - `console`: Logs are output to the console for real-time monitoring.
|
|
10
|
+
* - `disabled`: Disables all logging
|
|
11
|
+
*
|
|
12
|
+
* **Note**: Logging is only supported on iOS. On Android, setting the log mode will throw an error.
|
|
13
|
+
*/
|
|
14
|
+
export const LogMode = z.enum(['localFile', 'console', 'disabled']);
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["z","LogMode","enum"],"sourceRoot":"../../../src","sources":["logger/types.ts"],"mappings":";;AAAA,SAASA,CAAC,QAAQ,KAAK;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAGD,CAAC,CAACE,IAAI,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
/**
|
|
3
3
|
* Error codes which the module uses to reject a promise.
|
|
4
4
|
*/
|
|
5
|
-
declare const ModuleErrorCodesSchema: z.ZodEnum<["PIN_REGEX_NOT_VALID", "INVALID_AUTH_URL", "THREADING_ERROR", "UNKNOWN_EXCEPTION"]>;
|
|
5
|
+
declare const ModuleErrorCodesSchema: z.ZodEnum<["PIN_REGEX_NOT_VALID", "INVALID_AUTH_URL", "THREADING_ERROR", "UNSUPPORTED", "UNKNOWN_EXCEPTION"]>;
|
|
6
6
|
export type CieErrorCodes = z.infer<typeof ModuleErrorCodesSchema>;
|
|
7
7
|
/**
|
|
8
8
|
* Schema which can be used to parse a rejected promise error the module.
|
|
@@ -12,17 +12,17 @@ export type CieErrorCodes = z.infer<typeof ModuleErrorCodesSchema>;
|
|
|
12
12
|
* @returns A schema for the common parameters of a rejected promise error in a native module.
|
|
13
13
|
*/
|
|
14
14
|
export declare const CieErrorSchema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
|
|
15
|
-
code: z.ZodEnum<["PIN_REGEX_NOT_VALID", "INVALID_AUTH_URL", "THREADING_ERROR", "UNKNOWN_EXCEPTION"]>;
|
|
15
|
+
code: z.ZodEnum<["PIN_REGEX_NOT_VALID", "INVALID_AUTH_URL", "THREADING_ERROR", "UNSUPPORTED", "UNKNOWN_EXCEPTION"]>;
|
|
16
16
|
message: z.ZodString;
|
|
17
17
|
name: z.ZodString;
|
|
18
18
|
userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
|
-
code: "PIN_REGEX_NOT_VALID" | "INVALID_AUTH_URL" | "THREADING_ERROR" | "UNKNOWN_EXCEPTION";
|
|
20
|
+
code: "PIN_REGEX_NOT_VALID" | "INVALID_AUTH_URL" | "THREADING_ERROR" | "UNSUPPORTED" | "UNKNOWN_EXCEPTION";
|
|
21
21
|
message: string;
|
|
22
22
|
name: string;
|
|
23
23
|
userInfo?: Record<string, any> | null | undefined;
|
|
24
24
|
}, {
|
|
25
|
-
code: "PIN_REGEX_NOT_VALID" | "INVALID_AUTH_URL" | "THREADING_ERROR" | "UNKNOWN_EXCEPTION";
|
|
25
|
+
code: "PIN_REGEX_NOT_VALID" | "INVALID_AUTH_URL" | "THREADING_ERROR" | "UNSUPPORTED" | "UNKNOWN_EXCEPTION";
|
|
26
26
|
message: string;
|
|
27
27
|
name: string;
|
|
28
28
|
userInfo?: Record<string, any> | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiCxB;;GAEG;AACH,QAAA,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiCxB;;GAEG;AACH,QAAA,MAAM,sBAAsB,+GAM1B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEnE;;;;;;GAMG;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQC,CAAC;AAE7B,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as CieUtils from './utils';
|
|
2
2
|
import * as CieManager from './manager';
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
import * as CieLogger from './logger';
|
|
4
|
+
export { CieUtils, CieManager, CieLogger };
|
|
5
|
+
export type { NfcEvent, NfcError, CieAttributes, CieEventHandlers, CieEvent, InternalAuthResponse, MrtdResponse, InternalAuthAndMrtdResponse, ResultEncoding, CertificateData, } from './manager/types';
|
|
6
|
+
export type { LogMode } from './logger/types';
|
|
5
7
|
export type { CieErrorSchema, CieError, CieErrorCodes } from './errors';
|
|
6
8
|
//# 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;
|
|
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;AACxC,OAAO,KAAK,SAAS,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAE3C,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,YAAY,EACZ,2BAA2B,EAC3B,cAAc,EACd,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type LogMode } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Sets the log mode for the CIE SDK.
|
|
4
|
+
*
|
|
5
|
+
* **Note**: Logging is only supported on iOS. On Android, this method will throw an error.
|
|
6
|
+
*
|
|
7
|
+
* @param mode - The log mode to set ('console', 'localFile', or 'disabled').
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* CieManager.setLogMode('console');
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const setLogMode: (mode: LogMode) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves the file path of the latest logs generated by the CIE SDK.
|
|
16
|
+
* @returns A promise that resolves to a string representing the file path of the latest logs.
|
|
17
|
+
* @throws {CieError} If cannot retrieve the logs path.
|
|
18
|
+
*/
|
|
19
|
+
declare const getLogsFilePath: () => Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the contetent of the latest logs generated by the CIE SDK.
|
|
22
|
+
* @returns A promise that resolves to a string representing the content of the latest logs.
|
|
23
|
+
* @throws {CieError} If cannot retrieve the logs content.
|
|
24
|
+
*/
|
|
25
|
+
declare const getLogs: () => Promise<string>;
|
|
26
|
+
export { setLogMode, getLogsFilePath, getLogs };
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/logger/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,QAAA,MAAM,UAAU,GAAI,MAAM,OAAO,SAEhC,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,eAAe,QAAa,OAAO,CAAC,MAAM,CAE/C,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,OAAO,QAAa,OAAO,CAAC,MAAM,CAEvC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Represent the log mode for the CIE SDK
|
|
4
|
+
*
|
|
5
|
+
* - `localFile`: Logs are saved to a local file on the device for later retrieval.
|
|
6
|
+
* - `console`: Logs are output to the console for real-time monitoring.
|
|
7
|
+
* - `disabled`: Disables all logging
|
|
8
|
+
*
|
|
9
|
+
* **Note**: Logging is only supported on iOS. On Android, setting the log mode will throw an error.
|
|
10
|
+
*/
|
|
11
|
+
export declare const LogMode: z.ZodEnum<["localFile", "console", "disabled"]>;
|
|
12
|
+
export type LogMode = z.infer<typeof LogMode>;
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/logger/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,iDAA+C,CAAC;AAEpE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/errors.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as CieUtils from './utils';
|
|
2
2
|
import * as CieManager from './manager';
|
|
3
|
+
import * as CieLogger from './logger';
|
|
3
4
|
|
|
4
|
-
export { CieUtils, CieManager };
|
|
5
|
+
export { CieUtils, CieManager, CieLogger };
|
|
5
6
|
|
|
6
7
|
export type {
|
|
7
8
|
NfcEvent,
|
|
@@ -13,6 +14,9 @@ export type {
|
|
|
13
14
|
MrtdResponse,
|
|
14
15
|
InternalAuthAndMrtdResponse,
|
|
15
16
|
ResultEncoding,
|
|
17
|
+
CertificateData,
|
|
16
18
|
} from './manager/types';
|
|
17
19
|
|
|
20
|
+
export type { LogMode } from './logger/types';
|
|
21
|
+
|
|
18
22
|
export type { CieErrorSchema, CieError, CieErrorCodes } from './errors';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IoReactNativeCie } from '../native';
|
|
2
|
+
import { type LogMode } from './types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sets the log mode for the CIE SDK.
|
|
6
|
+
*
|
|
7
|
+
* **Note**: Logging is only supported on iOS. On Android, this method will throw an error.
|
|
8
|
+
*
|
|
9
|
+
* @param mode - The log mode to set ('console', 'localFile', or 'disabled').
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* CieManager.setLogMode('console');
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
const setLogMode = (mode: LogMode) => {
|
|
16
|
+
IoReactNativeCie.setLogMode(mode);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the file path of the latest logs generated by the CIE SDK.
|
|
21
|
+
* @returns A promise that resolves to a string representing the file path of the latest logs.
|
|
22
|
+
* @throws {CieError} If cannot retrieve the logs path.
|
|
23
|
+
*/
|
|
24
|
+
const getLogsFilePath = async (): Promise<string> => {
|
|
25
|
+
return IoReactNativeCie.getLogsFilePath();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves the contetent of the latest logs generated by the CIE SDK.
|
|
30
|
+
* @returns A promise that resolves to a string representing the content of the latest logs.
|
|
31
|
+
* @throws {CieError} If cannot retrieve the logs content.
|
|
32
|
+
*/
|
|
33
|
+
const getLogs = async (): Promise<string> => {
|
|
34
|
+
return IoReactNativeCie.getLogs();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { setLogMode, getLogsFilePath, getLogs };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represent the log mode for the CIE SDK
|
|
5
|
+
*
|
|
6
|
+
* - `localFile`: Logs are saved to a local file on the device for later retrieval.
|
|
7
|
+
* - `console`: Logs are output to the console for real-time monitoring.
|
|
8
|
+
* - `disabled`: Disables all logging
|
|
9
|
+
*
|
|
10
|
+
* **Note**: Logging is only supported on iOS. On Android, setting the log mode will throw an error.
|
|
11
|
+
*/
|
|
12
|
+
export const LogMode = z.enum(['localFile', 'console', 'disabled']);
|
|
13
|
+
|
|
14
|
+
export type LogMode = z.infer<typeof LogMode>;
|