@pagopa/io-react-native-cie 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/IoReactNativeCie.podspec +1 -1
- package/README.md +16 -3
- package/android/src/main/java/com/pagopa/ioreactnativecie/IoReactNativeCieModule.kt +11 -41
- package/ios/Data/Data+StringRepresentations.swift +48 -0
- package/ios/Data/DataEncoding.swift +15 -0
- package/ios/IoReactNativeCie.mm +6 -0
- package/ios/IoReactNativeCie.swift +48 -32
- package/lib/module/errors.js +50 -0
- package/lib/module/errors.js.map +1 -1
- package/lib/module/manager/index.js +13 -1
- package/lib/module/manager/index.js.map +1 -1
- package/lib/module/manager/types.js +10 -0
- package/lib/module/manager/types.js.map +1 -1
- package/lib/typescript/src/errors.d.ts +66 -18
- package/lib/typescript/src/errors.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/manager/index.d.ts +10 -1
- package/lib/typescript/src/manager/index.d.ts.map +1 -1
- package/lib/typescript/src/manager/types.d.ts +22 -0
- package/lib/typescript/src/manager/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/errors.ts +53 -21
- package/src/index.ts +1 -1
- package/src/manager/index.ts +21 -0
- package/src/manager/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.12"
|
|
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
|
@@ -109,9 +109,10 @@ List of available functions
|
|
|
109
109
|
| `setCustomIdpUrl(url?: string)` | `void` | Updates IDP url, if `undefined` will use the default IDP url |
|
|
110
110
|
| `setAlertMessage(key: AlertMessageKey, value: string)` | `void` | (iOS) Updates iOS NFC modal alert message |
|
|
111
111
|
| `setCurrentAlertMessage(value: string)` | `void` | (iOS) Updates currently displayed iOS NFC modal alert message |
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
112
|
+
| `startInternalAuthentication(challenge: string)` | `Promise<void>` | Start the CIE IAS/NIS Internal Authentication |
|
|
113
|
+
| `startReadingAttributes(timeout: number)` | `Promise<void>` | Start the CIE attributes reading process |
|
|
114
|
+
| `startReading(pin: string, authenticationUrl: string, timeout: number)` | `Promise<void>` | Start the CIE reading process fro authentication |
|
|
115
|
+
| `stopReading()` | `Promise<void>` | (Android) Stops all reading process |
|
|
115
116
|
|
|
116
117
|
## Usage
|
|
117
118
|
|
|
@@ -137,6 +138,18 @@ await CieUtils.isCieAuthenticationSupported();
|
|
|
137
138
|
|
|
138
139
|
### Reading CIE Data
|
|
139
140
|
|
|
141
|
+
#### Internal Authentication
|
|
142
|
+
|
|
143
|
+
Start the CIE Internal Authentication
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
import { CieManager } from '@pagopa/io-react-native-cie';
|
|
147
|
+
|
|
148
|
+
CieManager.startInternalAuthentication('challenge')
|
|
149
|
+
.then(() => console.log('Reading started'))
|
|
150
|
+
.catch((error) => console.error('Error:', error));
|
|
151
|
+
```
|
|
152
|
+
|
|
140
153
|
#### Reading Attributes
|
|
141
154
|
|
|
142
155
|
Read CIE attributes (card type and base64-encoded data) with optional timeout (Android only)
|
|
@@ -19,8 +19,6 @@ import it.pagopa.io.app.cie.network.NetworkError
|
|
|
19
19
|
import it.pagopa.io.app.cie.nfc.NfcEvents
|
|
20
20
|
import java.net.URL
|
|
21
21
|
|
|
22
|
-
typealias ME = IoReactNativeCieModule.Companion.ModuleException
|
|
23
|
-
|
|
24
22
|
class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
25
23
|
ReactContextBaseJavaModule(reactContext) {
|
|
26
24
|
|
|
@@ -54,9 +52,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
54
52
|
promise.resolve(it)
|
|
55
53
|
}
|
|
56
54
|
} catch (e: Exception) {
|
|
57
|
-
|
|
58
|
-
promise, Pair(ERROR_USER_INFO_KEY, e.message.orEmpty())
|
|
59
|
-
)
|
|
55
|
+
promise.reject(ModuleException.UNKNOWN_EXCEPTION, e.message, e)
|
|
60
56
|
}
|
|
61
57
|
}
|
|
62
58
|
|
|
@@ -67,9 +63,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
67
63
|
promise.resolve(it)
|
|
68
64
|
}
|
|
69
65
|
} catch (e: Exception) {
|
|
70
|
-
|
|
71
|
-
promise, Pair(ERROR_USER_INFO_KEY, e.message.orEmpty())
|
|
72
|
-
)
|
|
66
|
+
promise.reject(ModuleException.UNKNOWN_EXCEPTION, e.message, e)
|
|
73
67
|
}
|
|
74
68
|
}
|
|
75
69
|
|
|
@@ -86,9 +80,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
86
80
|
cieSdk.openNfcSettings()
|
|
87
81
|
promise.resolve(null)
|
|
88
82
|
} catch (e: Exception) {
|
|
89
|
-
|
|
90
|
-
promise, Pair(ERROR_USER_INFO_KEY, e.message.orEmpty())
|
|
91
|
-
)
|
|
83
|
+
promise.reject(ModuleException.UNKNOWN_EXCEPTION, e.message, e)
|
|
92
84
|
}
|
|
93
85
|
}
|
|
94
86
|
|
|
@@ -152,9 +144,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
152
144
|
})
|
|
153
145
|
promise.resolve(null)
|
|
154
146
|
} catch (e: Exception) {
|
|
155
|
-
|
|
156
|
-
promise, Pair(ERROR_USER_INFO_KEY, e.message.orEmpty())
|
|
157
|
-
)
|
|
147
|
+
promise.reject(ModuleException.UNKNOWN_EXCEPTION, e.message, e)
|
|
158
148
|
}
|
|
159
149
|
}
|
|
160
150
|
|
|
@@ -168,16 +158,14 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
168
158
|
try {
|
|
169
159
|
cieSdk.setPin(pin)
|
|
170
160
|
} catch (e: Exception) {
|
|
171
|
-
|
|
172
|
-
promise, Pair(ERROR_USER_INFO_KEY, e.message.orEmpty())
|
|
173
|
-
)
|
|
161
|
+
promise.reject(ModuleException.PIN_REGEX_NOT_VALID, e.message, e)
|
|
174
162
|
return;
|
|
175
163
|
}
|
|
176
164
|
|
|
177
165
|
try {
|
|
178
166
|
cieSdk.withUrl(URL(authenticationUrl).toString())
|
|
179
167
|
} catch (e: Exception) {
|
|
180
|
-
|
|
168
|
+
promise.reject(ModuleException.INVALID_AUTH_URL, e.message, e)
|
|
181
169
|
return
|
|
182
170
|
}
|
|
183
171
|
|
|
@@ -218,9 +206,7 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
218
206
|
})
|
|
219
207
|
promise.resolve(null)
|
|
220
208
|
} catch (e: Exception) {
|
|
221
|
-
|
|
222
|
-
promise, Pair(ERROR_USER_INFO_KEY, e.message.orEmpty())
|
|
223
|
-
)
|
|
209
|
+
promise.reject(ModuleException.UNKNOWN_EXCEPTION, e.message, e)
|
|
224
210
|
}
|
|
225
211
|
}
|
|
226
212
|
|
|
@@ -275,26 +261,10 @@ class IoReactNativeCieModule(reactContext: ReactApplicationContext) :
|
|
|
275
261
|
GENERIC_ERROR,
|
|
276
262
|
}
|
|
277
263
|
|
|
278
|
-
|
|
279
|
-
val
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
INVALID_AUTH_URL(Exception("INVALID_AUTH_URL")),
|
|
283
|
-
UNKNOWN_EXCEPTION(Exception("UNKNOWN_EXCEPTION"));
|
|
284
|
-
|
|
285
|
-
fun reject(
|
|
286
|
-
promise: Promise, vararg args: Pair<String, String>
|
|
287
|
-
) {
|
|
288
|
-
exMap(*args).let {
|
|
289
|
-
promise.reject(it.first, ex.message, it.second)
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
private fun exMap(vararg args: Pair<String, String>): Pair<String, WritableMap> {
|
|
294
|
-
val writableMap = WritableNativeMap()
|
|
295
|
-
args.forEach { writableMap.putString(it.first, it.second) }
|
|
296
|
-
return Pair(this.ex.message ?: "UNKNOWN", writableMap)
|
|
297
|
-
}
|
|
264
|
+
private object ModuleException {
|
|
265
|
+
const val PIN_REGEX_NOT_VALID = "PIN_REGEX_NOT_VALID";
|
|
266
|
+
const val INVALID_AUTH_URL = "INVALID_AUTH_URL";
|
|
267
|
+
const val UNKNOWN_EXCEPTION = "UNKNOWN_EXCEPTION";
|
|
298
268
|
}
|
|
299
269
|
}
|
|
300
270
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Data+StringRepresentations.swift
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Fabio Bombardi on 02/10/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
extension Data {
|
|
11
|
+
|
|
12
|
+
/// Converts the data to a lowercase hexadecimal string.
|
|
13
|
+
func toHexString() -> String {
|
|
14
|
+
return self.map { String(format: "%02x", $0) }.joined()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/// Converts the data to a base64url encoded string (RFC 7515), without padding.
|
|
18
|
+
/// - Replaces + with -, / with _, and removes trailing =
|
|
19
|
+
func base64UrlEncodedString() -> String {
|
|
20
|
+
return self.base64EncodedString()
|
|
21
|
+
.replacingOccurrences(of: "+", with: "-")
|
|
22
|
+
.replacingOccurrences(of: "/", with: "_")
|
|
23
|
+
.replacingOccurrences(of: "=", with: "")
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Convenience extension for an array of bytes ([UInt8]).
|
|
28
|
+
extension Array where Element == UInt8 {
|
|
29
|
+
|
|
30
|
+
/// Converts the byte array to a lowercase hexadecimal string.
|
|
31
|
+
func toHexString() -> String {
|
|
32
|
+
return Data(self).toHexString()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/// Converts the byte array to a base64url encoded string.
|
|
36
|
+
func base64UrlEncodedString() -> String {
|
|
37
|
+
return Data(self).base64UrlEncodedString()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
func encodedDataString(encoding: DataEncoding) -> String {
|
|
41
|
+
switch encoding {
|
|
42
|
+
case .HEX:
|
|
43
|
+
return Data(self).toHexString()
|
|
44
|
+
case .BASE64:
|
|
45
|
+
return Data(self).base64UrlEncodedString()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// DataEncoding.swift
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Fabio Bombardi on 02/10/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
enum DataEncoding: String, Sendable {
|
|
9
|
+
case HEX = "HEX"
|
|
10
|
+
case BASE64 = "BASE64"
|
|
11
|
+
|
|
12
|
+
static func from(string: String?) -> DataEncoding {
|
|
13
|
+
return DataEncoding(rawValue: string?.uppercased() ?? "") ?? .BASE64
|
|
14
|
+
}
|
|
15
|
+
}
|
package/ios/IoReactNativeCie.mm
CHANGED
|
@@ -25,6 +25,12 @@ RCT_EXTERN_METHOD(setCurrentAlertMessage: (NSString)value)
|
|
|
25
25
|
|
|
26
26
|
RCT_EXTERN_METHOD(setCustomIdpUrl: (NSString)url)
|
|
27
27
|
|
|
28
|
+
RCT_EXTERN_METHOD(startInternalAuthentication: (NSString)challenge
|
|
29
|
+
withResultEncoding: (NSString)encodingString
|
|
30
|
+
withTimeout: (NSNumber)timeout
|
|
31
|
+
withResolver: (RCTPromiseResolveBlock)resolve
|
|
32
|
+
withRejecter: (RCTPromiseRejectBlock)reject)
|
|
33
|
+
|
|
28
34
|
RCT_EXTERN_METHOD(startReadingAttributes: (NSNumber)timeout
|
|
29
35
|
withResolver: (RCTPromiseResolveBlock)resolve
|
|
30
36
|
withRejecter: (RCTPromiseRejectBlock)reject)
|
|
@@ -3,8 +3,6 @@ import React
|
|
|
3
3
|
|
|
4
4
|
@objc(IoReactNativeCie)
|
|
5
5
|
class IoReactNativeCie: RCTEventEmitter {
|
|
6
|
-
private typealias ME = ModuleException
|
|
7
|
-
|
|
8
6
|
private let cieSdk: CieDigitalId
|
|
9
7
|
|
|
10
8
|
override init() {
|
|
@@ -67,6 +65,47 @@ class IoReactNativeCie: RCTEventEmitter {
|
|
|
67
65
|
cieSdk.idpUrl = url
|
|
68
66
|
}
|
|
69
67
|
|
|
68
|
+
@objc func startInternalAuthentication(
|
|
69
|
+
_ challenge: String,
|
|
70
|
+
withResultEncoding encodingString: String,
|
|
71
|
+
withTimeout timeout: Int,
|
|
72
|
+
withResolver resolve: @escaping RCTPromiseResolveBlock,
|
|
73
|
+
withRejecter reject: @escaping RCTPromiseRejectBlock
|
|
74
|
+
) {
|
|
75
|
+
Task { [weak self] in
|
|
76
|
+
guard let self = self else {
|
|
77
|
+
reject(ModuleException.threadingError.rawValue, "Failed to perform background operation, self was deallocated", nil)
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
do {
|
|
82
|
+
let internalAuthResponse = try await self.cieSdk.performInternalAuthentication(
|
|
83
|
+
challenge: Array(challenge.utf8),
|
|
84
|
+
handleReadEvent
|
|
85
|
+
)
|
|
86
|
+
let encoding = DataEncoding.from(string: encodingString)
|
|
87
|
+
let payload: NSDictionary = [
|
|
88
|
+
"response": [
|
|
89
|
+
"nis": internalAuthResponse.nis.encodedDataString(encoding: encoding),
|
|
90
|
+
"publicKey": internalAuthResponse.publicKey.encodedDataString(encoding: encoding),
|
|
91
|
+
"sod": internalAuthResponse.sod.encodedDataString(encoding: encoding),
|
|
92
|
+
"signedChallenge": internalAuthResponse.signedChallenge.encodedDataString(encoding: encoding)
|
|
93
|
+
]
|
|
94
|
+
]
|
|
95
|
+
self.sendEvent(
|
|
96
|
+
withName: EventType.onInternalAuthenticationSuccess.rawValue, body: payload)
|
|
97
|
+
resolve(nil)
|
|
98
|
+
} catch {
|
|
99
|
+
guard let nfcDigitalIdError = error as? NfcDigitalIdError else {
|
|
100
|
+
reject(ModuleException.unexpected.rawValue, error.localizedDescription, error)
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
handleReadError(nfcDigitalIdError)
|
|
104
|
+
resolve(nil)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
70
109
|
@objc func startReadingAttributes(
|
|
71
110
|
_ timeout: Int,
|
|
72
111
|
withResolver resolve: @escaping RCTPromiseResolveBlock,
|
|
@@ -74,7 +113,7 @@ class IoReactNativeCie: RCTEventEmitter {
|
|
|
74
113
|
) {
|
|
75
114
|
Task { [weak self] in
|
|
76
115
|
guard let self = self else {
|
|
77
|
-
|
|
116
|
+
reject(ModuleException.threadingError.rawValue, "Failed to perform background operation, self was deallocated", nil)
|
|
78
117
|
return
|
|
79
118
|
}
|
|
80
119
|
|
|
@@ -89,8 +128,7 @@ class IoReactNativeCie: RCTEventEmitter {
|
|
|
89
128
|
withName: EventType.onAttributesSuccess.rawValue, body: payload)
|
|
90
129
|
} catch {
|
|
91
130
|
guard let nfcDigitalIdError = error as? NfcDigitalIdError else {
|
|
92
|
-
|
|
93
|
-
reject: reject, ("error", error.localizedDescription))
|
|
131
|
+
reject(ModuleException.unexpected.rawValue, error.localizedDescription, error)
|
|
94
132
|
return
|
|
95
133
|
}
|
|
96
134
|
handleReadError(nfcDigitalIdError)
|
|
@@ -108,17 +146,17 @@ class IoReactNativeCie: RCTEventEmitter {
|
|
|
108
146
|
) {
|
|
109
147
|
Task { [weak self] in
|
|
110
148
|
guard let self = self else {
|
|
111
|
-
|
|
149
|
+
reject(ModuleException.threadingError.rawValue, "Failed to perform background operation, self was deallocated", nil)
|
|
112
150
|
return
|
|
113
151
|
}
|
|
114
152
|
|
|
115
153
|
guard pin.count == 8, pin.allSatisfy(\.isNumber) else {
|
|
116
|
-
|
|
154
|
+
reject(ModuleException.invalidPin.rawValue, "Pin must be exactly 8 digits", nil)
|
|
117
155
|
return
|
|
118
156
|
}
|
|
119
157
|
|
|
120
158
|
guard let url = URL(string: authUrl) else {
|
|
121
|
-
|
|
159
|
+
reject(ModuleException.invalidAuthUrl.rawValue, "Auth URL is invalid", nil)
|
|
122
160
|
return
|
|
123
161
|
}
|
|
124
162
|
|
|
@@ -129,8 +167,7 @@ class IoReactNativeCie: RCTEventEmitter {
|
|
|
129
167
|
withName: EventType.onSuccess.rawValue, body: authenticatedUrl)
|
|
130
168
|
} catch {
|
|
131
169
|
guard let nfcDigitalIdError = error as? NfcDigitalIdError else {
|
|
132
|
-
|
|
133
|
-
reject: reject, ("error", error.localizedDescription))
|
|
170
|
+
reject(ModuleException.unexpected.rawValue, error.localizedDescription, error)
|
|
134
171
|
return
|
|
135
172
|
}
|
|
136
173
|
handleReadError(nfcDigitalIdError)
|
|
@@ -178,6 +215,7 @@ class IoReactNativeCie: RCTEventEmitter {
|
|
|
178
215
|
case onEvent
|
|
179
216
|
case onError
|
|
180
217
|
case onAttributesSuccess
|
|
218
|
+
case onInternalAuthenticationSuccess
|
|
181
219
|
case onSuccess
|
|
182
220
|
}
|
|
183
221
|
|
|
@@ -200,28 +238,6 @@ class IoReactNativeCie: RCTEventEmitter {
|
|
|
200
238
|
case invalidAuthUrl = "INVALID_AUTH_URL"
|
|
201
239
|
case threadingError = "THREADING_ERROR"
|
|
202
240
|
case unexpected = "UNEXPECTED_ERROR"
|
|
203
|
-
|
|
204
|
-
func error(userInfo: [String: Any]? = nil) -> NSError {
|
|
205
|
-
switch self {
|
|
206
|
-
case .invalidPin:
|
|
207
|
-
return NSError(domain: self.rawValue, code: -1, userInfo: userInfo)
|
|
208
|
-
case .invalidAuthUrl:
|
|
209
|
-
return NSError(domain: self.rawValue, code: -1, userInfo: userInfo)
|
|
210
|
-
case .threadingError:
|
|
211
|
-
return NSError(domain: self.rawValue, code: -1, userInfo: userInfo)
|
|
212
|
-
case .unexpected:
|
|
213
|
-
return NSError(domain: self.rawValue, code: -1, userInfo: userInfo)
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
func reject(reject: RCTPromiseRejectBlock, _ moreUserInfo: (String, Any)...)
|
|
218
|
-
{
|
|
219
|
-
var userInfo = [String: Any]()
|
|
220
|
-
moreUserInfo.forEach { userInfo[$0.0] = $0.1 }
|
|
221
|
-
let error = error(userInfo: userInfo)
|
|
222
|
-
reject("\(error.code)", error.domain, error)
|
|
223
|
-
}
|
|
224
241
|
}
|
|
225
|
-
|
|
226
242
|
}
|
|
227
243
|
|
package/lib/module/errors.js
CHANGED
|
@@ -1,2 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema for parsing a nativeStackAndroid object of a rejected promise error in an Android native module.
|
|
7
|
+
*/
|
|
8
|
+
const StackTraceElementSchema = z.object({
|
|
9
|
+
lineNumber: z.number(),
|
|
10
|
+
file: z.string(),
|
|
11
|
+
methodName: z.string(),
|
|
12
|
+
class: z.string()
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Schema for parsing specific parameters of a rejected promise error in an Android native module.
|
|
17
|
+
* It's defined as partial to allow merging with the common schema and it must be checked at runtime.
|
|
18
|
+
*/
|
|
19
|
+
const ModuleErrorAndroidSchema = z.object({
|
|
20
|
+
nativeStackAndroid: z.array(StackTraceElementSchema)
|
|
21
|
+
}).partial();
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Schema for parsing specific parameters of a rejected promise error in an iOS native module.
|
|
25
|
+
* It's defined as partial to allow merging with the common schema and it must be checked at runtime.
|
|
26
|
+
*/
|
|
27
|
+
const ModuleErrorIosSchema = z.object({
|
|
28
|
+
domain: z.string(),
|
|
29
|
+
nativeStackIOS: z.array(z.string())
|
|
30
|
+
}).partial();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Error codes which the module uses to reject a promise.
|
|
34
|
+
*/
|
|
35
|
+
const ModuleErrorCodesSchema = z.enum(['PIN_REGEX_NOT_VALID', 'INVALID_AUTH_URL', 'THREADING_ERROR',
|
|
36
|
+
// iOS only
|
|
37
|
+
'UNKNOWN_EXCEPTION']);
|
|
38
|
+
/**
|
|
39
|
+
* Schema which can be used to parse a rejected promise error the module.
|
|
40
|
+
* This schema contains the common parameters that are shared across both Android and iOS native modules.
|
|
41
|
+
* Parameters which are platform specific are defined as optional and must be checked at runtime.
|
|
42
|
+
* It accepts a generic code schema to allow for different error codes which can be defined in each module.
|
|
43
|
+
* @returns A schema for the common parameters of a rejected promise error in a native module.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
export const CieErrorSchema = z.object({
|
|
47
|
+
code: ModuleErrorCodesSchema,
|
|
48
|
+
message: z.string(),
|
|
49
|
+
name: z.string(),
|
|
50
|
+
userInfo: z.record(z.string(), z.any()).optional().or(z.null())
|
|
51
|
+
}).and(ModuleErrorAndroidSchema).and(ModuleErrorIosSchema);
|
|
2
52
|
//# sourceMappingURL=errors.js.map
|
package/lib/module/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["errors.ts"],"mappings":"","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"],"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,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":[]}
|
|
@@ -96,6 +96,18 @@ export const setCurrentAlertMessage = value => {
|
|
|
96
96
|
IoReactNativeCie.setCurrentAlertMessage(value);
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Initiates the internal authentication process using the provided challenge and timeout.
|
|
101
|
+
*
|
|
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')
|
|
104
|
+
* @param timeout - Optional timeout in milliseconds (default: 10000) (**Note**: Android only)
|
|
105
|
+
* @returns A promise that resolves when the authentication process has ended.
|
|
106
|
+
*/
|
|
107
|
+
const startInternalAuthentication = async (challenge, resultEncoding = 'base64', timeout = DEFAULT_TIMEOUT) => {
|
|
108
|
+
return IoReactNativeCie.startInternalAuthentication(challenge, resultEncoding, timeout);
|
|
109
|
+
};
|
|
110
|
+
|
|
99
111
|
/**
|
|
100
112
|
* Starts the process of reading attributes from the CIE card.
|
|
101
113
|
*
|
|
@@ -147,5 +159,5 @@ const startReading = async (pin, authenticationUrl, timeout = DEFAULT_TIMEOUT) =
|
|
|
147
159
|
const stopReading = async () => {
|
|
148
160
|
return IoReactNativeCie.stopReading();
|
|
149
161
|
};
|
|
150
|
-
export { addListener, removeListener, removeAllListeners, setCustomIdpUrl, startReadingAttributes, startReading, stopReading };
|
|
162
|
+
export { addListener, removeListener, removeAllListeners, setCustomIdpUrl, startReadingAttributes, startInternalAuthentication, startReading, stopReading };
|
|
151
163
|
//# sourceMappingURL=index.js.map
|
|
@@ -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","
|
|
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","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,KAC1B;EACH,MAAMC,YAAY,GAAGJ,YAAY,CAACC,WAAW,CAACC,KAAK,EAAEC,QAAQ,CAAC;EAC9D,OAAOC,YAAY,CAACC,MAAM;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAIJ,KAAe,IAAK;EAC1CF,YAAY,CAACO,kBAAkB,CAACL,KAAK,CAAC;AACxC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,kBAAkB,GAAGA,CAAA,KAAM;EAC/BP,YAAY,CAACO,kBAAkB,CAAC,SAAS,CAAC;EAC1CP,YAAY,CAACO,kBAAkB,CAAC,SAAS,CAAC;EAC1CP,YAAY,CAACO,kBAAkB,CAAC,qBAAqB,CAAC;EACtDP,YAAY,CAACO,kBAAkB,CAAC,WAAW,CAAC;AAC9C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAIC,GAAuB,IAAK;EACnDZ,gBAAgB,CAACW,eAAe,CAACC,GAAG,IAAIX,gBAAgB,CAAC,CAAC,CAAC;AAC7D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMY,eAAe,GAAGA,CAACC,GAAoB,EAAEC,KAAa,KAAK;EACtEf,gBAAgB,CAACa,eAAe,CAACC,GAAG,EAAEC,KAAK,CAAC;AAC9C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAID,KAAa,IAAK;EACvDf,gBAAgB,CAACgB,sBAAsB,CAACD,KAAK,CAAC;AAChD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,2BAA2B,GAAG,MAAAA,CAClCC,SAAiB,EACjBC,cAAgC,GAAG,QAAQ,EAC3CC,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,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,MAAMC,sBAAsB,GAAG,MAAAA,CAC7BD,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,gBAAgB,CAACqB,sBAAsB,CAACD,OAAO,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,YAAY,GAAG,MAAAA,CACnBC,GAAW,EACXC,iBAAyB,EACzBJ,OAAe,GAAGlB,eAAe,KACf;EAClB,OAAOF,gBAAgB,CAACsB,YAAY,CAACC,GAAG,EAAEC,iBAAiB,EAAEJ,OAAO,CAAC;AACvE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,WAAW,GAAG,MAAAA,CAAA,KAA2B;EAC7C,OAAOzB,gBAAgB,CAACyB,WAAW,CAAC,CAAC;AACvC,CAAC;AAED,SACErB,WAAW,EACXK,cAAc,EACdC,kBAAkB,EAClBC,eAAe,EACfU,sBAAsB,EACtBJ,2BAA2B,EAC3BK,YAAY,EACZG,WAAW","ignoreList":[]}
|
|
@@ -33,6 +33,16 @@ z.object({
|
|
|
33
33
|
message: z.string().optional(),
|
|
34
34
|
attemptsLeft: z.number()
|
|
35
35
|
})]);
|
|
36
|
+
/**
|
|
37
|
+
* Represent the CIE attributes containing the CIE type
|
|
38
|
+
* All string value are Hex encoded
|
|
39
|
+
*/
|
|
40
|
+
export const InternalAuthResponseObject = z.object({
|
|
41
|
+
nis: z.string(),
|
|
42
|
+
publicKey: z.string(),
|
|
43
|
+
sod: z.string(),
|
|
44
|
+
signedChallenge: z.string()
|
|
45
|
+
});
|
|
36
46
|
/**
|
|
37
47
|
* Represent the CIE attributes containing the CIE type
|
|
38
48
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["z","AlertMessageKey","enum","NfcEvent","object","name","string","progress","coerce","number","NfcErrorName","NfcError","union","exclude","message","optional","extract","attemptsLeft","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,CAAC;AAC5B,CAAC,CAAC;AAIF;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAGV,CAAC,CAACE,IAAI,CAAC,CACjC,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,CAChB,CAAC;AAIF;AACA;AACA;AACA,OAAO,MAAMS,QAAQ,GAAGX,CAAC,CAACY,KAAK,CAAC,CAC9BZ,CAAC,CAACI,MAAM,CAAC;EACPC,IAAI,EAAEK,YAAY,CAACG,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;EACzCC,OAAO,EAAEd,CAAC,CAACM,MAAM,CAAC,CAAC,CAACS,QAAQ,CAAC;AAC/B,CAAC,CAAC;AACF;AACAf,CAAC,CAACI,MAAM,CAAC;EACPC,IAAI,EAAEK,YAAY,CAACM,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;EACzCF,OAAO,EAAEd,CAAC,CAACM,MAAM,CAAC,CAAC,CAACS,QAAQ,CAAC,CAAC;EAC9BE,YAAY,EAAEjB,CAAC,CAACS,MAAM,CAAC;AACzB,CAAC,CAAC,CACH,CAAC;AAIF;AACA;AACA;AACA,OAAO,MAAMS,
|
|
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","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,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M,CAAC,CAAC;EACrBe,GAAG,EAAErB,CAAC,CAACM,MAAM,CAAC,CAAC;EACfgB,eAAe,EAAEtB,CAAC,CAACM,MAAM,CAAC;AAC5B,CAAC,CAAC;AAIF;AACA;AACA;AACA,OAAO,MAAMiB,aAAa,GAAGvB,CAAC,CAACI,MAAM,CAAC;EACpCoB,IAAI,EAAExB,CAAC,CAACM,MAAM,CAAC,CAAC;EAChBmB,MAAM,EAAEzB,CAAC,CAACM,MAAM,CAAC;AACnB,CAAC,CAAC;;AAIF;AACA;AACA;;AASA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,24 +1,72 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
/**
|
|
2
|
-
* Error codes
|
|
3
|
+
* Error codes which the module uses to reject a promise.
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
+
declare const ModuleErrorCodesSchema: z.ZodEnum<["PIN_REGEX_NOT_VALID", "INVALID_AUTH_URL", "THREADING_ERROR", "UNKNOWN_EXCEPTION"]>;
|
|
6
|
+
export type CieErrorCodes = z.infer<typeof ModuleErrorCodesSchema>;
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
8
|
+
* Schema which can be used to parse a rejected promise error the module.
|
|
9
|
+
* This schema contains the common parameters that are shared across both Android and iOS native modules.
|
|
10
|
+
* Parameters which are platform specific are defined as optional and must be checked at runtime.
|
|
11
|
+
* It accepts a generic code schema to allow for different error codes which can be defined in each module.
|
|
12
|
+
* @returns A schema for the common parameters of a rejected promise error in a native module.
|
|
7
13
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
message:
|
|
21
|
-
|
|
22
|
-
|
|
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"]>;
|
|
16
|
+
message: z.ZodString;
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
userInfo: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
code: "PIN_REGEX_NOT_VALID" | "INVALID_AUTH_URL" | "THREADING_ERROR" | "UNKNOWN_EXCEPTION";
|
|
21
|
+
message: string;
|
|
22
|
+
name: string;
|
|
23
|
+
userInfo?: Record<string, any> | null | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
code: "PIN_REGEX_NOT_VALID" | "INVALID_AUTH_URL" | "THREADING_ERROR" | "UNKNOWN_EXCEPTION";
|
|
26
|
+
message: string;
|
|
27
|
+
name: string;
|
|
28
|
+
userInfo?: Record<string, any> | null | undefined;
|
|
29
|
+
}>, z.ZodObject<{
|
|
30
|
+
nativeStackAndroid: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
31
|
+
lineNumber: z.ZodNumber;
|
|
32
|
+
file: z.ZodString;
|
|
33
|
+
methodName: z.ZodString;
|
|
34
|
+
class: z.ZodString;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
lineNumber: number;
|
|
37
|
+
file: string;
|
|
38
|
+
methodName: string;
|
|
39
|
+
class: string;
|
|
40
|
+
}, {
|
|
41
|
+
lineNumber: number;
|
|
42
|
+
file: string;
|
|
43
|
+
methodName: string;
|
|
44
|
+
class: string;
|
|
45
|
+
}>, "many">>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
nativeStackAndroid?: {
|
|
48
|
+
lineNumber: number;
|
|
49
|
+
file: string;
|
|
50
|
+
methodName: string;
|
|
51
|
+
class: string;
|
|
52
|
+
}[] | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
nativeStackAndroid?: {
|
|
55
|
+
lineNumber: number;
|
|
56
|
+
file: string;
|
|
57
|
+
methodName: string;
|
|
58
|
+
class: string;
|
|
59
|
+
}[] | undefined;
|
|
60
|
+
}>>, z.ZodObject<{
|
|
61
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
62
|
+
nativeStackIOS: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
domain?: string | undefined;
|
|
65
|
+
nativeStackIOS?: string[] | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
domain?: string | undefined;
|
|
68
|
+
nativeStackIOS?: string[] | undefined;
|
|
69
|
+
}>>;
|
|
70
|
+
export type CieError = z.infer<typeof CieErrorSchema>;
|
|
23
71
|
export {};
|
|
24
72
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAAA
|
|
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,gGAK1B,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"}
|
|
@@ -2,5 +2,5 @@ import * as CieUtils from './utils';
|
|
|
2
2
|
import * as CieManager from './manager';
|
|
3
3
|
export { CieUtils, CieManager };
|
|
4
4
|
export type { NfcEvent, NfcError, CieAttributes, CieEventHandlers, CieEvent, } from './manager/types';
|
|
5
|
-
export type { CieError, CieErrorCodes } from './errors';
|
|
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,GACT,MAAM,iBAAiB,CAAC;AAEzB,YAAY,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,GACT,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -67,6 +67,15 @@ export declare const setAlertMessage: (key: AlertMessageKey, value: string) => v
|
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
69
|
export declare const setCurrentAlertMessage: (value: string) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Initiates the internal authentication process using the provided challenge and timeout.
|
|
72
|
+
*
|
|
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')
|
|
75
|
+
* @param timeout - Optional timeout in milliseconds (default: 10000) (**Note**: Android only)
|
|
76
|
+
* @returns A promise that resolves when the authentication process has ended.
|
|
77
|
+
*/
|
|
78
|
+
declare const startInternalAuthentication: (challenge: string, resultEncoding?: "base64" | "hex", timeout?: number) => Promise<void>;
|
|
70
79
|
/**
|
|
71
80
|
* Starts the process of reading attributes from the CIE card.
|
|
72
81
|
*
|
|
@@ -110,5 +119,5 @@ declare const startReading: (pin: string, authenticationUrl: string, timeout?: n
|
|
|
110
119
|
* ```
|
|
111
120
|
*/
|
|
112
121
|
declare const stopReading: () => Promise<void>;
|
|
113
|
-
export { addListener, removeListener, removeAllListeners, setCustomIdpUrl, startReadingAttributes, startReading, stopReading, };
|
|
122
|
+
export { addListener, removeListener, removeAllListeners, setCustomIdpUrl, startReadingAttributes, startInternalAuthentication, startReading, stopReading, };
|
|
114
123
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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;;;;;;;;;;G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ACH,QAAA,MAAM,2BAA2B,GAC/B,WAAW,MAAM,EACjB,iBAAgB,QAAQ,GAAG,KAAgB,EAC3C,UAAS,MAAwB,KAChC,OAAO,CAAC,IAAI,CAMd,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,sBAAsB,GAC1B,UAAS,MAAwB,KAChC,OAAO,CAAC,IAAI,CAEd,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,YAAY,GAChB,KAAK,MAAM,EACX,mBAAmB,MAAM,EACzB,UAAS,MAAwB,KAChC,OAAO,CAAC,IAAI,CAEd,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,WAAW,QAAa,OAAO,CAAC,IAAI,CAEzC,CAAC;AAEF,OAAO,EACL,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,2BAA2B,EAC3B,YAAY,EACZ,WAAW,GACZ,CAAC"}
|
|
@@ -52,6 +52,27 @@ export declare const NfcError: z.ZodUnion<[z.ZodObject<{
|
|
|
52
52
|
message?: string | undefined;
|
|
53
53
|
}>]>;
|
|
54
54
|
export type NfcError = z.infer<typeof NfcError>;
|
|
55
|
+
/**
|
|
56
|
+
* Represent the CIE attributes containing the CIE type
|
|
57
|
+
* All string value are Hex encoded
|
|
58
|
+
*/
|
|
59
|
+
export declare const InternalAuthResponseObject: z.ZodObject<{
|
|
60
|
+
nis: z.ZodString;
|
|
61
|
+
publicKey: z.ZodString;
|
|
62
|
+
sod: z.ZodString;
|
|
63
|
+
signedChallenge: z.ZodString;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
nis: string;
|
|
66
|
+
publicKey: string;
|
|
67
|
+
sod: string;
|
|
68
|
+
signedChallenge: string;
|
|
69
|
+
}, {
|
|
70
|
+
nis: string;
|
|
71
|
+
publicKey: string;
|
|
72
|
+
sod: string;
|
|
73
|
+
signedChallenge: string;
|
|
74
|
+
}>;
|
|
75
|
+
export type InternalAuthResponse = z.infer<typeof InternalAuthResponseObject>;
|
|
55
76
|
/**
|
|
56
77
|
* Represent the CIE attributes containing the CIE type
|
|
57
78
|
*/
|
|
@@ -72,6 +93,7 @@ export type CieAttributes = z.infer<typeof CieAttributes>;
|
|
|
72
93
|
export type CieEventHandlers = {
|
|
73
94
|
onEvent: (event: NfcEvent) => void;
|
|
74
95
|
onError: (error: NfcError) => void;
|
|
96
|
+
onInternalAuthenticationSuccess: (attributes: InternalAuthResponse) => void;
|
|
75
97
|
onAttributesSuccess: (attributes: CieAttributes) => void;
|
|
76
98
|
onSuccess: (uri: string) => void;
|
|
77
99
|
};
|
|
@@ -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;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;EAGxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAA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;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;EAGxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACnC,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACnC,+BAA+B,EAAE,CAAC,UAAU,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC5E,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
package/src/errors.ts
CHANGED
|
@@ -1,32 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
4
|
+
* Schema for parsing a nativeStackAndroid object of a rejected promise error in an Android native module.
|
|
3
5
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const StackTraceElementSchema = z.object({
|
|
7
|
+
lineNumber: z.number(),
|
|
8
|
+
file: z.string(),
|
|
9
|
+
methodName: z.string(),
|
|
10
|
+
class: z.string(),
|
|
11
|
+
});
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
|
-
*
|
|
14
|
+
* Schema for parsing specific parameters of a rejected promise error in an Android native module.
|
|
15
|
+
* It's defined as partial to allow merging with the common schema and it must be checked at runtime.
|
|
12
16
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
const ModuleErrorAndroidSchema = z
|
|
18
|
+
.object({
|
|
19
|
+
nativeStackAndroid: z.array(StackTraceElementSchema),
|
|
20
|
+
})
|
|
21
|
+
.partial();
|
|
17
22
|
|
|
18
23
|
/**
|
|
19
|
-
*
|
|
24
|
+
* Schema for parsing specific parameters of a rejected promise error in an iOS native module.
|
|
25
|
+
* It's defined as partial to allow merging with the common schema and it must be checked at runtime.
|
|
20
26
|
*/
|
|
21
|
-
|
|
27
|
+
const ModuleErrorIosSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
domain: z.string(),
|
|
30
|
+
nativeStackIOS: z.array(z.string()),
|
|
31
|
+
})
|
|
32
|
+
.partial();
|
|
22
33
|
|
|
23
34
|
/**
|
|
24
|
-
* Error
|
|
25
|
-
*
|
|
26
|
-
* If additional error information are available,
|
|
27
|
-
* they are stored in the {@link CieError["userInfo"]} field.
|
|
35
|
+
* Error codes which the module uses to reject a promise.
|
|
28
36
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
const ModuleErrorCodesSchema = z.enum([
|
|
38
|
+
'PIN_REGEX_NOT_VALID',
|
|
39
|
+
'INVALID_AUTH_URL',
|
|
40
|
+
'THREADING_ERROR', // iOS only
|
|
41
|
+
'UNKNOWN_EXCEPTION',
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
export type CieErrorCodes = z.infer<typeof ModuleErrorCodesSchema>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Schema which can be used to parse a rejected promise error the module.
|
|
48
|
+
* This schema contains the common parameters that are shared across both Android and iOS native modules.
|
|
49
|
+
* Parameters which are platform specific are defined as optional and must be checked at runtime.
|
|
50
|
+
* It accepts a generic code schema to allow for different error codes which can be defined in each module.
|
|
51
|
+
* @returns A schema for the common parameters of a rejected promise error in a native module.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
export const CieErrorSchema = z
|
|
55
|
+
.object({
|
|
56
|
+
code: ModuleErrorCodesSchema,
|
|
57
|
+
message: z.string(),
|
|
58
|
+
name: z.string(),
|
|
59
|
+
userInfo: z.record(z.string(), z.any()).optional().or(z.null()),
|
|
60
|
+
})
|
|
61
|
+
.and(ModuleErrorAndroidSchema)
|
|
62
|
+
.and(ModuleErrorIosSchema);
|
|
63
|
+
|
|
64
|
+
export type CieError = z.infer<typeof CieErrorSchema>;
|
package/src/index.ts
CHANGED
package/src/manager/index.ts
CHANGED
|
@@ -100,6 +100,26 @@ export const setCurrentAlertMessage = (value: string) => {
|
|
|
100
100
|
IoReactNativeCie.setCurrentAlertMessage(value);
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Initiates the internal authentication process using the provided challenge and timeout.
|
|
105
|
+
*
|
|
106
|
+
* @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')
|
|
108
|
+
* @param timeout - Optional timeout in milliseconds (default: 10000) (**Note**: Android only)
|
|
109
|
+
* @returns A promise that resolves when the authentication process has ended.
|
|
110
|
+
*/
|
|
111
|
+
const startInternalAuthentication = async (
|
|
112
|
+
challenge: string,
|
|
113
|
+
resultEncoding: 'base64' | 'hex' = 'base64',
|
|
114
|
+
timeout: number = DEFAULT_TIMEOUT
|
|
115
|
+
): Promise<void> => {
|
|
116
|
+
return IoReactNativeCie.startInternalAuthentication(
|
|
117
|
+
challenge,
|
|
118
|
+
resultEncoding,
|
|
119
|
+
timeout
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
103
123
|
/**
|
|
104
124
|
* Starts the process of reading attributes from the CIE card.
|
|
105
125
|
*
|
|
@@ -164,6 +184,7 @@ export {
|
|
|
164
184
|
removeAllListeners,
|
|
165
185
|
setCustomIdpUrl,
|
|
166
186
|
startReadingAttributes,
|
|
187
|
+
startInternalAuthentication,
|
|
167
188
|
startReading,
|
|
168
189
|
stopReading,
|
|
169
190
|
};
|
package/src/manager/types.ts
CHANGED
|
@@ -68,6 +68,19 @@ export const NfcError = z.union([
|
|
|
68
68
|
|
|
69
69
|
export type NfcError = z.infer<typeof NfcError>;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Represent the CIE attributes containing the CIE type
|
|
73
|
+
* All string value are Hex encoded
|
|
74
|
+
*/
|
|
75
|
+
export const InternalAuthResponseObject = z.object({
|
|
76
|
+
nis: z.string(),
|
|
77
|
+
publicKey: z.string(),
|
|
78
|
+
sod: z.string(),
|
|
79
|
+
signedChallenge: z.string(),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export type InternalAuthResponse = z.infer<typeof InternalAuthResponseObject>;
|
|
83
|
+
|
|
71
84
|
/**
|
|
72
85
|
* Represent the CIE attributes containing the CIE type
|
|
73
86
|
*/
|
|
@@ -84,6 +97,7 @@ export type CieAttributes = z.infer<typeof CieAttributes>;
|
|
|
84
97
|
export type CieEventHandlers = {
|
|
85
98
|
onEvent: (event: NfcEvent) => void;
|
|
86
99
|
onError: (error: NfcError) => void;
|
|
100
|
+
onInternalAuthenticationSuccess: (attributes: InternalAuthResponse) => void;
|
|
87
101
|
onAttributesSuccess: (attributes: CieAttributes) => void;
|
|
88
102
|
onSuccess: (uri: string) => void;
|
|
89
103
|
};
|