@pagopa/io-react-native-iso18013 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/IoReactNativeIso18013.podspec +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/AndroidManifestNew.xml +1 -0
- package/android/src/main/java/com/ioreactnativeiso18013/IoReactNativeIso18013Module.kt +19 -18
- package/android/src/main/res/values/strings.xml +1 -1
- package/ios/IoReactNativeIso18013.swift +5 -2
- package/lib/module/iso18013/iso18013-5/proximity.js +4 -4
- package/lib/module/iso18013/iso18013-5/proximity.js.map +1 -1
- package/lib/module/iso18013/iso18013-5/request.js +23 -2
- package/lib/module/iso18013/iso18013-5/request.js.map +1 -1
- package/lib/typescript/src/iso18013/iso18013-5/proximity.d.ts +2 -2
- package/lib/typescript/src/iso18013/iso18013-5/request.d.ts +23 -1
- package/lib/typescript/src/iso18013/iso18013-5/request.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/iso18013/iso18013-5/proximity.ts +4 -4
- package/src/iso18013/iso18013-5/request.ts +24 -1
|
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
|
|
18
18
|
# Module dependencies
|
|
19
19
|
s.dependency "IOWalletCBOR", "0.2.1"
|
|
20
|
-
s.dependency "IOWalletProximity", "1.
|
|
20
|
+
s.dependency "IOWalletProximity", "1.5.0"
|
|
21
21
|
|
|
22
22
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
23
23
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/android/build.gradle
CHANGED
|
@@ -83,8 +83,8 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
83
83
|
dependencies {
|
|
84
84
|
implementation "com.facebook.react:react-android"
|
|
85
85
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
86
|
-
implementation "it.pagopa.io.wallet.proximity:proximity:2.
|
|
87
|
-
implementation "it.pagopa.io.wallet.cbor:cbor:1.4.
|
|
86
|
+
implementation "it.pagopa.io.wallet.proximity:proximity:2.5.0"
|
|
87
|
+
implementation "it.pagopa.io.wallet.cbor:cbor:1.4.2"
|
|
88
88
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
|
|
89
89
|
testImplementation('junit:junit:4.13.2')
|
|
90
90
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<service
|
|
8
8
|
android:name="com.ioreactnativeiso18013.IoNfcEngagementService"
|
|
9
9
|
android:exported="true"
|
|
10
|
+
android:enabled="false"
|
|
10
11
|
android:permission="android.permission.BIND_NFC_SERVICE">
|
|
11
12
|
<intent-filter>
|
|
12
13
|
<action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE" />
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
<service
|
|
7
7
|
android:name="com.ioreactnativeiso18013.IoNfcEngagementService"
|
|
8
8
|
android:exported="true"
|
|
9
|
+
android:enabled="false"
|
|
9
10
|
android:permission="android.permission.BIND_NFC_SERVICE">
|
|
10
11
|
<intent-filter>
|
|
11
12
|
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
|
@@ -52,11 +52,8 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
override fun invalidate() {
|
|
55
|
+
this.dispose()
|
|
55
56
|
super.invalidate()
|
|
56
|
-
nfcEventJob?.cancel()
|
|
57
|
-
nfcEventJob = null
|
|
58
|
-
nfcScope.coroutineContext[Job]?.cancel()
|
|
59
|
-
reactApplicationContext.currentActivity?.let { NfcEngagementService.disable(it) }
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
/**
|
|
@@ -106,8 +103,7 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
|
|
|
106
103
|
// NFC engagement
|
|
107
104
|
|
|
108
105
|
if (parsedEngagementModes.any { it == EngagementMode.NFC }) {
|
|
109
|
-
val readerTrustStore = certificatesList.
|
|
110
|
-
?.map { chain -> chain.map<ByteArray, Any> { it } }
|
|
106
|
+
val readerTrustStore = certificatesList.map { chain -> chain.map<ByteArray, Any> { it } }
|
|
111
107
|
|
|
112
108
|
check(
|
|
113
109
|
NfcEngagementEventBus.setupNfcService(
|
|
@@ -127,9 +123,7 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
|
|
|
127
123
|
|
|
128
124
|
if (parsedEngagementModes.any { it == EngagementMode.QR_CODE }) {
|
|
129
125
|
qrEngagement = QrEngagement.build(reactApplicationContext, methods).apply {
|
|
130
|
-
|
|
131
|
-
withReaderTrustStore(certificatesList)
|
|
132
|
-
}
|
|
126
|
+
withReaderTrustStore(certificatesList)
|
|
133
127
|
}
|
|
134
128
|
qrEngagement?.configure()
|
|
135
129
|
setupProximityHandler()
|
|
@@ -164,15 +158,7 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
|
|
|
164
158
|
@ReactMethod
|
|
165
159
|
fun close(promise: Promise) {
|
|
166
160
|
try {
|
|
167
|
-
|
|
168
|
-
qrEngagement = null
|
|
169
|
-
deviceRetrievalHelper?.disconnect()
|
|
170
|
-
deviceRetrievalHelper = null
|
|
171
|
-
sessionRetrievalMethod = null
|
|
172
|
-
sessionTranscript = null
|
|
173
|
-
nfcEventJob?.cancel()
|
|
174
|
-
nfcEventJob = null
|
|
175
|
-
reactApplicationContext.currentActivity?.let { NfcEngagementService.disable(it) }
|
|
161
|
+
this.dispose()
|
|
176
162
|
promise.resolve(true)
|
|
177
163
|
} catch (e: Exception) {
|
|
178
164
|
promise.reject(ModuleErrorCodes.CLOSE_ERROR, message = e.message, e)
|
|
@@ -529,6 +515,21 @@ class IoReactNativeIso18013Module(reactContext: ReactApplicationContext) :
|
|
|
529
515
|
.emit(eventName, data)
|
|
530
516
|
}
|
|
531
517
|
|
|
518
|
+
/**
|
|
519
|
+
* Disposes the resources
|
|
520
|
+
*/
|
|
521
|
+
private fun dispose() {
|
|
522
|
+
qrEngagement?.close()
|
|
523
|
+
qrEngagement = null
|
|
524
|
+
deviceRetrievalHelper?.disconnect()
|
|
525
|
+
deviceRetrievalHelper = null
|
|
526
|
+
sessionRetrievalMethod = null
|
|
527
|
+
sessionTranscript = null
|
|
528
|
+
nfcEventJob?.cancel()
|
|
529
|
+
nfcEventJob = null
|
|
530
|
+
reactApplicationContext.currentActivity?.let { NfcEngagementService.disable(it) }
|
|
531
|
+
}
|
|
532
|
+
|
|
532
533
|
/**
|
|
533
534
|
* Keep: Required for RN built in Event Emitter Calls.
|
|
534
535
|
* This fixes the warning: `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<resources>
|
|
3
|
-
<string name="nfc_engagement_service_desc">
|
|
3
|
+
<string name="nfc_engagement_service_desc">IT-Wallet Proximity</string>
|
|
4
4
|
<string name="nfc_engagement_aid_group_desc">ISO 18013-5 NFC Engagement</string>
|
|
5
5
|
</resources>
|
|
@@ -398,10 +398,10 @@ class IoReactNativeIso18013: RCTEventEmitter, ISO18013Delegate {
|
|
|
398
398
|
/**
|
|
399
399
|
Converts a device requested from the `onDocumentRequestReceived` callback into a serializable JSON.
|
|
400
400
|
- Parameters:
|
|
401
|
-
- request: The request returned from `onDocumentRequestReceived` which contains an array of tuples consists of a doctype, namespaces
|
|
401
|
+
- request: The request returned from `onDocumentRequestReceived` which contains an array of tuples consists of a doctype, namespaces, the requested claims with a boolean value indicating wether or not the device which is making the request has an intent to retain the data, and optional certificate data from the verifier X.509 certificate.
|
|
402
402
|
- Returns: A JSON string representing the device request or nil if an error occurs.
|
|
403
403
|
*/
|
|
404
|
-
private func deviceRequestToJson(request: [(docType: String, nameSpaces: [String: [String: Bool]], isAuthenticated: Bool)]?) -> String? {
|
|
404
|
+
private func deviceRequestToJson(request: [(docType: String, nameSpaces: [String: [String: Bool]], isAuthenticated: Bool, certificateData: [String: String]?)]?) -> String? {
|
|
405
405
|
var jsonRequest : [String: AnyHashable] = [:]
|
|
406
406
|
request?.forEach({
|
|
407
407
|
item in
|
|
@@ -412,6 +412,9 @@ class IoReactNativeIso18013: RCTEventEmitter, ISO18013Delegate {
|
|
|
412
412
|
})
|
|
413
413
|
|
|
414
414
|
subReq["isAuthenticated"] = item.isAuthenticated
|
|
415
|
+
if let certData = item.certificateData {
|
|
416
|
+
subReq["certificateData"] = certData
|
|
417
|
+
}
|
|
415
418
|
|
|
416
419
|
jsonRequest[item.docType] = subReq
|
|
417
420
|
})
|
|
@@ -51,8 +51,8 @@ export let ErrorCode = /*#__PURE__*/function (ErrorCode) {
|
|
|
51
51
|
* @param config.centralClientMode (Android only) - Whether the device is in central client mode. Defaults to false
|
|
52
52
|
* @param config.clearBleCache (Android only) - Whether the BLE cache should be cleared. Defaults to true
|
|
53
53
|
* @param config.certificates - Two-dimensional array of base64 strings representing DER encoded X.509 certificate which are used to authenticate the verifier app
|
|
54
|
-
* @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr'
|
|
55
|
-
* @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble'
|
|
54
|
+
* @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr']
|
|
55
|
+
* @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble']
|
|
56
56
|
* @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
|
|
57
57
|
*/
|
|
58
58
|
export function startEngagement(config = {}) {
|
|
@@ -61,8 +61,8 @@ export function startEngagement(config = {}) {
|
|
|
61
61
|
centralClientMode = false,
|
|
62
62
|
clearBleCache = true,
|
|
63
63
|
certificates = [],
|
|
64
|
-
engagementModes = ['qrcode'
|
|
65
|
-
retrievalMethods = ['ble'
|
|
64
|
+
engagementModes = ['qrcode'],
|
|
65
|
+
retrievalMethods = ['ble']
|
|
66
66
|
} = config;
|
|
67
67
|
if (Platform.OS === 'ios') {
|
|
68
68
|
return IoReactNativeIso18013.startEngagement(certificates, engagementModes, retrievalMethods);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","Platform","IoReactNativeIso18013","eventEmitter","ErrorCode","startEngagement","config","peripheralMode","centralClientMode","clearBleCache","certificates","engagementModes","retrievalMethods","OS","close","sendErrorResponse","code","generateResponse","documents","acceptedFields","sendResponse","response","addListener","event","callback","setHceModalMessage","message"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/proximity.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAC3D,SAASC,qBAAqB,QAAQ,aAAI;AAG1C,MAAMC,YAAY,GAAG,IAAIH,kBAAkB,CAACE,qBAAqB,CAAC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,WAAYE,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;;AAMrB;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,MAOC,GAAG,CAAC,CAAC,EACY;EAClB,MAAM;IACJC,cAAc,GAAG,IAAI;IACrBC,iBAAiB,GAAG,KAAK;IACzBC,aAAa,GAAG,IAAI;IACpBC,YAAY,GAAG,EAAE;IACjBC,eAAe,GAAG,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","Platform","IoReactNativeIso18013","eventEmitter","ErrorCode","startEngagement","config","peripheralMode","centralClientMode","clearBleCache","certificates","engagementModes","retrievalMethods","OS","close","sendErrorResponse","code","generateResponse","documents","acceptedFields","sendResponse","response","addListener","event","callback","setHceModalMessage","message"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/proximity.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAC3D,SAASC,qBAAqB,QAAQ,aAAI;AAG1C,MAAMC,YAAY,GAAG,IAAIH,kBAAkB,CAACE,qBAAqB,CAAC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,WAAYE,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;;AAMrB;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,MAOC,GAAG,CAAC,CAAC,EACY;EAClB,MAAM;IACJC,cAAc,GAAG,IAAI;IACrBC,iBAAiB,GAAG,KAAK;IACzBC,aAAa,GAAG,IAAI;IACpBC,YAAY,GAAG,EAAE;IACjBC,eAAe,GAAG,CAAC,QAAQ,CAAC;IAC5BC,gBAAgB,GAAG,CAAC,KAAK;EAC3B,CAAC,GAAGN,MAAM;EAEV,IAAIL,QAAQ,CAACY,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOX,qBAAqB,CAACG,eAAe,CAC1CK,YAAY,EACZC,eAAe,EACfC,gBACF,CAAC;EACH,CAAC,MAAM;IACL,OAAOV,qBAAqB,CAACG,eAAe,CAC1CE,cAAc,EACdC,iBAAiB,EACjBC,aAAa,EACbC,YAAY,EACZC,eAAe,EACfC,gBACF,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,KAAKA,CAAA,EAAqB;EACxC,OAAOZ,qBAAqB,CAACY,KAAK,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,IAAe,EAAoB;EACnE,OAAOd,qBAAqB,CAACa,iBAAiB,CAACC,IAAI,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,SAAmC,EACnCC,cAA8B,EACb;EACjB,OAAOjB,qBAAqB,CAACe,gBAAgB,CAACC,SAAS,EAAEC,cAAc,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,QAAgB,EAAoB;EAC/D,OAAOnB,qBAAqB,CAACkB,YAAY,CAACC,QAAQ,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CACzBC,KAAQ,EACRC,QAA0C,EAC1C;EACA,OAAOrB,YAAY,CAACmB,WAAW,CAACC,KAAK,EAAEC,QAAQ,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,OAAe,EAAQ;EACxDxB,qBAAqB,CAACuB,kBAAkB,CAACC,OAAO,CAAC;AACnD","ignoreList":[]}
|
|
@@ -4,8 +4,23 @@ import { z } from 'zod';
|
|
|
4
4
|
|
|
5
5
|
// Inner data: a record of booleans with the attributes and the intent to retain flag
|
|
6
6
|
const booleanFieldGroup = z.record(z.string(), z.boolean());
|
|
7
|
+
|
|
8
|
+
// Parses raw X.509 subject fields from the verifier certificate
|
|
9
|
+
// and maps them to readable internal names.
|
|
10
|
+
const certificateDataSchema = z.object({
|
|
11
|
+
C: z.string().optional(),
|
|
12
|
+
O: z.string().optional(),
|
|
13
|
+
SERIALNUMBER: z.string().optional(),
|
|
14
|
+
CN: z.string().optional()
|
|
15
|
+
}).transform(certificate => ({
|
|
16
|
+
country: certificate.C,
|
|
17
|
+
organization: certificate.O,
|
|
18
|
+
serialNumber: certificate.SERIALNUMBER,
|
|
19
|
+
commonName: certificate.CN
|
|
20
|
+
}));
|
|
7
21
|
const credentialEntrySchema = z.object({
|
|
8
|
-
isAuthenticated: z.boolean()
|
|
22
|
+
isAuthenticated: z.boolean(),
|
|
23
|
+
certificateData: certificateDataSchema.optional()
|
|
9
24
|
}).catchall(booleanFieldGroup);
|
|
10
25
|
const VerifierRequest = z.object({
|
|
11
26
|
request: z.record(z.string(), credentialEntrySchema)
|
|
@@ -18,12 +33,18 @@ const VerifierRequest = z.object({
|
|
|
18
33
|
* Example:
|
|
19
34
|
* `{
|
|
20
35
|
* "org.iso.18013.5.1.mDL": {
|
|
21
|
-
* "isAuthenticated": true,
|
|
22
36
|
* "org.iso.18013.5.1": {
|
|
23
37
|
* "hair_colour": true,
|
|
24
38
|
* "given_name_national_character": true,
|
|
25
39
|
* "family_name_national_character": true,
|
|
26
40
|
* "given_name": true,
|
|
41
|
+
* },
|
|
42
|
+
* "isAuthenticated": true,
|
|
43
|
+
* "certificateData": {
|
|
44
|
+
* "country": "UT",
|
|
45
|
+
* "organization": "EUDI Wallet Reference Implementation",
|
|
46
|
+
* "serialNumber": "001",
|
|
47
|
+
* "commonName": "EUDI Proximity Verifier"
|
|
27
48
|
* }
|
|
28
49
|
* }
|
|
29
50
|
* }`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["z","booleanFieldGroup","record","string","boolean","
|
|
1
|
+
{"version":3,"names":["z","booleanFieldGroup","record","string","boolean","certificateDataSchema","object","C","optional","O","SERIALNUMBER","CN","transform","certificate","country","organization","serialNumber","commonName","credentialEntrySchema","isAuthenticated","certificateData","catchall","VerifierRequest","request","parseVerifierRequest","input","parse"],"sourceRoot":"../../../../src","sources":["iso18013/iso18013-5/request.ts"],"mappings":";;AAAA,SAASA,CAAC,QAAQ,KAAK;;AAEvB;AACA,MAAMC,iBAAiB,GAAGD,CAAC,CAACE,MAAM,CAACF,CAAC,CAACG,MAAM,CAAC,CAAC,EAAEH,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC;;AAE3D;AACA;AACA,MAAMC,qBAAqB,GAAGL,CAAC,CAC5BM,MAAM,CAAC;EACNC,CAAC,EAAEP,CAAC,CAACG,MAAM,CAAC,CAAC,CAACK,QAAQ,CAAC,CAAC;EACxBC,CAAC,EAAET,CAAC,CAACG,MAAM,CAAC,CAAC,CAACK,QAAQ,CAAC,CAAC;EACxBE,YAAY,EAAEV,CAAC,CAACG,MAAM,CAAC,CAAC,CAACK,QAAQ,CAAC,CAAC;EACnCG,EAAE,EAAEX,CAAC,CAACG,MAAM,CAAC,CAAC,CAACK,QAAQ,CAAC;AAC1B,CAAC,CAAC,CACDI,SAAS,CAAEC,WAAW,KAAM;EAC3BC,OAAO,EAAED,WAAW,CAACN,CAAC;EACtBQ,YAAY,EAAEF,WAAW,CAACJ,CAAC;EAC3BO,YAAY,EAAEH,WAAW,CAACH,YAAY;EACtCO,UAAU,EAAEJ,WAAW,CAACF;AAC1B,CAAC,CAAC,CAAC;AAEL,MAAMO,qBAAqB,GAAGlB,CAAC,CAC5BM,MAAM,CAAC;EACNa,eAAe,EAAEnB,CAAC,CAACI,OAAO,CAAC,CAAC;EAC5BgB,eAAe,EAAEf,qBAAqB,CAACG,QAAQ,CAAC;AAClD,CAAC,CAAC,CACDa,QAAQ,CAACpB,iBAAiB,CAAC;AAE9B,MAAMqB,eAAe,GAAGtB,CAAC,CAACM,MAAM,CAAC;EAC/BiB,OAAO,EAAEvB,CAAC,CAACE,MAAM,CAACF,CAAC,CAACG,MAAM,CAAC,CAAC,EAAEe,qBAAqB;AACrD,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,oBAAoB,GAAIC,KAAc,IAAsB;EACvE,OAAOH,eAAe,CAACI,KAAK,CAACD,KAAK,CAAC;AACrC,CAAC","ignoreList":[]}
|
|
@@ -60,8 +60,8 @@ export type RetrievalMethod = 'ble' | 'nfc';
|
|
|
60
60
|
* @param config.centralClientMode (Android only) - Whether the device is in central client mode. Defaults to false
|
|
61
61
|
* @param config.clearBleCache (Android only) - Whether the BLE cache should be cleared. Defaults to true
|
|
62
62
|
* @param config.certificates - Two-dimensional array of base64 strings representing DER encoded X.509 certificate which are used to authenticate the verifier app
|
|
63
|
-
* @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr'
|
|
64
|
-
* @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble'
|
|
63
|
+
* @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr']
|
|
64
|
+
* @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble']
|
|
65
65
|
* @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
|
|
66
66
|
*/
|
|
67
67
|
export declare function startEngagement(config?: {
|
|
@@ -2,6 +2,22 @@ import { z } from 'zod';
|
|
|
2
2
|
declare const VerifierRequest: z.ZodObject<{
|
|
3
3
|
request: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
4
4
|
isAuthenticated: z.ZodBoolean;
|
|
5
|
+
certificateData: z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
6
|
+
C: z.ZodOptional<z.ZodString>;
|
|
7
|
+
O: z.ZodOptional<z.ZodString>;
|
|
8
|
+
SERIALNUMBER: z.ZodOptional<z.ZodString>;
|
|
9
|
+
CN: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
11
|
+
country: string | undefined;
|
|
12
|
+
organization: string | undefined;
|
|
13
|
+
serialNumber: string | undefined;
|
|
14
|
+
commonName: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
C?: string | undefined;
|
|
17
|
+
O?: string | undefined;
|
|
18
|
+
SERIALNUMBER?: string | undefined;
|
|
19
|
+
CN?: string | undefined;
|
|
20
|
+
}>>>;
|
|
5
21
|
}, z.core.$catchall<z.ZodRecord<z.ZodString, z.ZodBoolean>>>>;
|
|
6
22
|
}, z.core.$strip>;
|
|
7
23
|
/**
|
|
@@ -11,12 +27,18 @@ declare const VerifierRequest: z.ZodObject<{
|
|
|
11
27
|
* Example:
|
|
12
28
|
* `{
|
|
13
29
|
* "org.iso.18013.5.1.mDL": {
|
|
14
|
-
* "isAuthenticated": true,
|
|
15
30
|
* "org.iso.18013.5.1": {
|
|
16
31
|
* "hair_colour": true,
|
|
17
32
|
* "given_name_national_character": true,
|
|
18
33
|
* "family_name_national_character": true,
|
|
19
34
|
* "given_name": true,
|
|
35
|
+
* },
|
|
36
|
+
* "isAuthenticated": true,
|
|
37
|
+
* "certificateData": {
|
|
38
|
+
* "country": "UT",
|
|
39
|
+
* "organization": "EUDI Wallet Reference Implementation",
|
|
40
|
+
* "serialNumber": "001",
|
|
41
|
+
* "commonName": "EUDI Proximity Verifier"
|
|
20
42
|
* }
|
|
21
43
|
* }
|
|
22
44
|
* }`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../../src/iso18013/iso18013-5/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4BxB,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;iBAEnB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,KAAG,eAErD,CAAC"}
|
package/package.json
CHANGED
|
@@ -65,8 +65,8 @@ export type RetrievalMethod = 'ble' | 'nfc';
|
|
|
65
65
|
* @param config.centralClientMode (Android only) - Whether the device is in central client mode. Defaults to false
|
|
66
66
|
* @param config.clearBleCache (Android only) - Whether the BLE cache should be cleared. Defaults to true
|
|
67
67
|
* @param config.certificates - Two-dimensional array of base64 strings representing DER encoded X.509 certificate which are used to authenticate the verifier app
|
|
68
|
-
* @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr'
|
|
69
|
-
* @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble'
|
|
68
|
+
* @param config.engagementMethods - Array of engagements methods initiated. Defaults to ['qr']
|
|
69
|
+
* @param config.retrievalMethods - Array of supported retrieval methods. Defaults to ['ble']
|
|
70
70
|
* @throws {ModuleError} in case of error which can be parsed with {@link ModuleErrorSchema}
|
|
71
71
|
*/
|
|
72
72
|
export function startEngagement(
|
|
@@ -84,8 +84,8 @@ export function startEngagement(
|
|
|
84
84
|
centralClientMode = false,
|
|
85
85
|
clearBleCache = true,
|
|
86
86
|
certificates = [],
|
|
87
|
-
engagementModes = ['qrcode'
|
|
88
|
-
retrievalMethods = ['ble'
|
|
87
|
+
engagementModes = ['qrcode'],
|
|
88
|
+
retrievalMethods = ['ble'],
|
|
89
89
|
} = config;
|
|
90
90
|
|
|
91
91
|
if (Platform.OS === 'ios') {
|
|
@@ -3,9 +3,26 @@ import { z } from 'zod';
|
|
|
3
3
|
// Inner data: a record of booleans with the attributes and the intent to retain flag
|
|
4
4
|
const booleanFieldGroup = z.record(z.string(), z.boolean());
|
|
5
5
|
|
|
6
|
+
// Parses raw X.509 subject fields from the verifier certificate
|
|
7
|
+
// and maps them to readable internal names.
|
|
8
|
+
const certificateDataSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
C: z.string().optional(),
|
|
11
|
+
O: z.string().optional(),
|
|
12
|
+
SERIALNUMBER: z.string().optional(),
|
|
13
|
+
CN: z.string().optional(),
|
|
14
|
+
})
|
|
15
|
+
.transform((certificate) => ({
|
|
16
|
+
country: certificate.C,
|
|
17
|
+
organization: certificate.O,
|
|
18
|
+
serialNumber: certificate.SERIALNUMBER,
|
|
19
|
+
commonName: certificate.CN,
|
|
20
|
+
}));
|
|
21
|
+
|
|
6
22
|
const credentialEntrySchema = z
|
|
7
23
|
.object({
|
|
8
24
|
isAuthenticated: z.boolean(),
|
|
25
|
+
certificateData: certificateDataSchema.optional(),
|
|
9
26
|
})
|
|
10
27
|
.catchall(booleanFieldGroup);
|
|
11
28
|
|
|
@@ -20,12 +37,18 @@ const VerifierRequest = z.object({
|
|
|
20
37
|
* Example:
|
|
21
38
|
* `{
|
|
22
39
|
* "org.iso.18013.5.1.mDL": {
|
|
23
|
-
* "isAuthenticated": true,
|
|
24
40
|
* "org.iso.18013.5.1": {
|
|
25
41
|
* "hair_colour": true,
|
|
26
42
|
* "given_name_national_character": true,
|
|
27
43
|
* "family_name_national_character": true,
|
|
28
44
|
* "given_name": true,
|
|
45
|
+
* },
|
|
46
|
+
* "isAuthenticated": true,
|
|
47
|
+
* "certificateData": {
|
|
48
|
+
* "country": "UT",
|
|
49
|
+
* "organization": "EUDI Wallet Reference Implementation",
|
|
50
|
+
* "serialNumber": "001",
|
|
51
|
+
* "commonName": "EUDI Proximity Verifier"
|
|
29
52
|
* }
|
|
30
53
|
* }
|
|
31
54
|
* }`
|