@trustchex/react-native-sdk 1.163.7 → 1.163.10
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/TrustchexSDK.podspec +0 -1
- package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin-Bridging-Header.h +9 -0
- package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.swift +173 -157
- package/lib/module/Shared/Components/QrCodeScannerCamera.js +15 -3
- package/lib/module/Shared/EIDReader/constants/eidConstants.js +65 -0
- package/lib/module/Shared/EIDReader/data/country.js +21 -44
- package/lib/module/Shared/EIDReader/data/countryInterface.js +1 -0
- package/lib/module/Shared/EIDReader/data/countryRegistry.js +65 -0
- package/lib/module/Shared/EIDReader/data/isoCountry.js +5 -1
- package/lib/module/Shared/EIDReader/data/unicodeCountry.js +5 -1
- package/lib/module/Shared/EIDReader/defaultFileSystem.js +4 -4
- package/lib/module/Shared/EIDReader/eidService.js +52 -51
- package/lib/module/Shared/EIDReader/lds/cvcaFile.js +2 -2
- package/lib/module/Shared/EIDReader/tlv/tlvCore.js +161 -0
- package/lib/module/Shared/EIDReader/tlv/tlvInputStream.js +4 -4
- package/lib/module/Shared/EIDReader/tlv/tlvOutputState.js +4 -4
- package/lib/module/Shared/EIDReader/tlv/tlvOutputStream.js +13 -11
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/index.js +0 -2
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.js +2 -0
- package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/constants/eidConstants.d.ts +58 -0
- package/lib/typescript/src/Shared/EIDReader/constants/eidConstants.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/data/country.d.ts +4 -5
- package/lib/typescript/src/Shared/EIDReader/data/country.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/data/countryInterface.d.ts +21 -0
- package/lib/typescript/src/Shared/EIDReader/data/countryInterface.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/data/countryRegistry.d.ts +14 -0
- package/lib/typescript/src/Shared/EIDReader/data/countryRegistry.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/data/isoCountry.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/data/unicodeCountry.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/eidService.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvCore.d.ts +22 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvCore.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvOutputStream.d.ts +2 -2
- package/lib/typescript/src/Shared/EIDReader/tlv/tlvOutputStream.d.ts.map +1 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts +0 -2
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts.map +1 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Shared/Components/QrCodeScannerCamera.tsx +15 -2
- package/src/Shared/EIDReader/constants/eidConstants.ts +67 -0
- package/src/Shared/EIDReader/data/country.ts +16 -47
- package/src/Shared/EIDReader/data/countryInterface.ts +21 -0
- package/src/Shared/EIDReader/data/countryRegistry.ts +73 -0
- package/src/Shared/EIDReader/data/isoCountry.ts +4 -0
- package/src/Shared/EIDReader/data/unicodeCountry.ts +4 -0
- package/src/Shared/EIDReader/defaultFileSystem.ts +4 -4
- package/src/Shared/EIDReader/eidService.ts +58 -53
- package/src/Shared/EIDReader/lds/cvcaFile.ts +2 -2
- package/src/Shared/EIDReader/tlv/tlvCore.ts +170 -0
- package/src/Shared/EIDReader/tlv/tlvInputStream.ts +4 -4
- package/src/Shared/EIDReader/tlv/tlvOutputState.ts +4 -4
- package/src/Shared/EIDReader/tlv/tlvOutputStream.ts +13 -12
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/index.ts +0 -4
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.ts +2 -0
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.js +0 -66
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.d.ts +0 -13
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.d.ts.map +0 -1
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/components/BarcodeCamera.tsx +0 -85
|
@@ -6,163 +6,164 @@ import { DefaultFileSystem } from "./defaultFileSystem.js";
|
|
|
6
6
|
import { BACAPDUSender } from "./protocol/bacAPDUSender.js";
|
|
7
7
|
import { ReadBinaryAPDUSender } from "./protocol/readBinaryAPDUSender.js";
|
|
8
8
|
import { BACProtocol } from "./protocol/bacProtocol.js";
|
|
9
|
+
import { EID_CONSTANTS } from "./constants/eidConstants.js";
|
|
9
10
|
export class EIDService extends AbstractMRTDCardService {
|
|
10
11
|
/** Shared secret type for non-PACE key. */
|
|
11
|
-
static NO_PACE_KEY_REFERENCE =
|
|
12
|
+
static NO_PACE_KEY_REFERENCE = EID_CONSTANTS.NO_PACE_KEY_REFERENCE;
|
|
12
13
|
|
|
13
14
|
/** Shared secret type for PACE according to BSI TR-03110 v2.03 B.11.1. */
|
|
14
|
-
static MRZ_PACE_KEY_REFERENCE =
|
|
15
|
+
static MRZ_PACE_KEY_REFERENCE = EID_CONSTANTS.MRZ_PACE_KEY_REFERENCE;
|
|
15
16
|
|
|
16
17
|
/** Shared secret type for PACE according to BSI TR-03110 v2.03 B.11.1. */
|
|
17
|
-
static CAN_PACE_KEY_REFERENCE =
|
|
18
|
+
static CAN_PACE_KEY_REFERENCE = EID_CONSTANTS.CAN_PACE_KEY_REFERENCE;
|
|
18
19
|
|
|
19
20
|
/** Shared secret type for PACE according to BSI TR-03110 v2.03 B.11.1. */
|
|
20
|
-
static PIN_PACE_KEY_REFERENCE =
|
|
21
|
+
static PIN_PACE_KEY_REFERENCE = EID_CONSTANTS.PIN_PACE_KEY_REFERENCE;
|
|
21
22
|
|
|
22
23
|
/** Shared secret type for PACE according to BSI TR-03110 v2.03 B.11.1. */
|
|
23
|
-
static PUK_PACE_KEY_REFERENCE =
|
|
24
|
+
static PUK_PACE_KEY_REFERENCE = EID_CONSTANTS.PUK_PACE_KEY_REFERENCE;
|
|
24
25
|
|
|
25
26
|
/** Card Access. */
|
|
26
|
-
static EF_CARD_ACCESS =
|
|
27
|
+
static EF_CARD_ACCESS = EID_CONSTANTS.EF_CARD_ACCESS;
|
|
27
28
|
|
|
28
29
|
/** Card Security. */
|
|
29
|
-
static EF_CARD_SECURITY =
|
|
30
|
+
static EF_CARD_SECURITY = EID_CONSTANTS.EF_CARD_SECURITY;
|
|
30
31
|
|
|
31
32
|
/** File identifier for data group 1. Data group 1 contains the MRZ. */
|
|
32
|
-
static EF_DG1 =
|
|
33
|
+
static EF_DG1 = EID_CONSTANTS.EF_DG1;
|
|
33
34
|
|
|
34
35
|
/** File identifier for data group 2. Data group 2 contains face image data. */
|
|
35
|
-
static EF_DG2 =
|
|
36
|
+
static EF_DG2 = EID_CONSTANTS.EF_DG2;
|
|
36
37
|
|
|
37
38
|
/** File identifier for data group 3. Data group 3 contains finger print data. */
|
|
38
|
-
static EF_DG3 =
|
|
39
|
+
static EF_DG3 = EID_CONSTANTS.EF_DG3;
|
|
39
40
|
|
|
40
41
|
/** File identifier for data group 4. Data group 4 contains iris data. */
|
|
41
|
-
static EF_DG4 =
|
|
42
|
+
static EF_DG4 = EID_CONSTANTS.EF_DG4;
|
|
42
43
|
|
|
43
44
|
/** File identifier for data group 5. Data group 5 contains displayed portrait. */
|
|
44
|
-
static EF_DG5 =
|
|
45
|
+
static EF_DG5 = EID_CONSTANTS.EF_DG5;
|
|
45
46
|
|
|
46
47
|
/** File identifier for data group 6. Data group 6 is RFU. */
|
|
47
|
-
static EF_DG6 =
|
|
48
|
+
static EF_DG6 = EID_CONSTANTS.EF_DG6;
|
|
48
49
|
|
|
49
50
|
/** File identifier for data group 7. Data group 7 contains displayed signature. */
|
|
50
|
-
static EF_DG7 =
|
|
51
|
+
static EF_DG7 = EID_CONSTANTS.EF_DG7;
|
|
51
52
|
|
|
52
53
|
/** File identifier for data group 8. Data group 8 contains data features. */
|
|
53
|
-
static EF_DG8 =
|
|
54
|
+
static EF_DG8 = EID_CONSTANTS.EF_DG8;
|
|
54
55
|
|
|
55
56
|
/** File identifier for data group 9. Data group 9 contains structure features. */
|
|
56
|
-
static EF_DG9 =
|
|
57
|
+
static EF_DG9 = EID_CONSTANTS.EF_DG9;
|
|
57
58
|
|
|
58
59
|
/** File identifier for data group 10. Data group 10 contains substance features. */
|
|
59
|
-
static EF_DG10 =
|
|
60
|
+
static EF_DG10 = EID_CONSTANTS.EF_DG10;
|
|
60
61
|
|
|
61
62
|
/** File identifier for data group 11. Data group 11 contains additional personal details. */
|
|
62
|
-
static EF_DG11 =
|
|
63
|
+
static EF_DG11 = EID_CONSTANTS.EF_DG11;
|
|
63
64
|
|
|
64
65
|
/** File identifier for data group 12. Data group 12 contains additional document details. */
|
|
65
|
-
static EF_DG12 =
|
|
66
|
+
static EF_DG12 = EID_CONSTANTS.EF_DG12;
|
|
66
67
|
|
|
67
68
|
/** File identifier for data group 13. Data group 13 contains optional details. */
|
|
68
|
-
static EF_DG13 =
|
|
69
|
+
static EF_DG13 = EID_CONSTANTS.EF_DG13;
|
|
69
70
|
|
|
70
71
|
/** File identifier for data group 14. Data group 14 contains security infos. */
|
|
71
|
-
static EF_DG14 =
|
|
72
|
+
static EF_DG14 = EID_CONSTANTS.EF_DG14;
|
|
72
73
|
|
|
73
74
|
/** File identifier for data group 15. Data group 15 contains the public key used for Active Authentication. */
|
|
74
|
-
static EF_DG15 =
|
|
75
|
+
static EF_DG15 = EID_CONSTANTS.EF_DG15;
|
|
75
76
|
|
|
76
77
|
/** File identifier for data group 16. Data group 16 contains person(s) to notify. */
|
|
77
|
-
static EF_DG16 =
|
|
78
|
+
static EF_DG16 = EID_CONSTANTS.EF_DG16;
|
|
78
79
|
|
|
79
80
|
/** The security document. */
|
|
80
|
-
static EF_SOD =
|
|
81
|
+
static EF_SOD = EID_CONSTANTS.EF_SOD;
|
|
81
82
|
|
|
82
83
|
/** The data group presence list. */
|
|
83
|
-
static EF_COM =
|
|
84
|
+
static EF_COM = EID_CONSTANTS.EF_COM;
|
|
84
85
|
|
|
85
86
|
/**
|
|
86
87
|
* Contains EAC CVA references. Note: this can be overridden by a file
|
|
87
88
|
* identifier in the DG14 file (in a TerminalAuthenticationInfo). Check DG14
|
|
88
89
|
* first. Also, this file does not have a header tag, like the others.
|
|
89
90
|
*/
|
|
90
|
-
static EF_CVCA =
|
|
91
|
+
static EF_CVCA = EID_CONSTANTS.EF_CVCA;
|
|
91
92
|
|
|
92
93
|
/** Short file identifier for card access file. */
|
|
93
|
-
static SFI_CARD_ACCESS =
|
|
94
|
+
static SFI_CARD_ACCESS = EID_CONSTANTS.SFI_CARD_ACCESS;
|
|
94
95
|
|
|
95
96
|
/** Short file identifier for card security file. */
|
|
96
|
-
static SFI_CARD_SECURITY =
|
|
97
|
+
static SFI_CARD_SECURITY = EID_CONSTANTS.SFI_CARD_SECURITY;
|
|
97
98
|
|
|
98
99
|
/** Short file identifier for file. */
|
|
99
|
-
static SFI_DG1 =
|
|
100
|
+
static SFI_DG1 = EID_CONSTANTS.SFI_DG1;
|
|
100
101
|
|
|
101
102
|
/** Short file identifier for file. */
|
|
102
|
-
static SFI_DG2 =
|
|
103
|
+
static SFI_DG2 = EID_CONSTANTS.SFI_DG2;
|
|
103
104
|
|
|
104
105
|
/** Short file identifier for file. */
|
|
105
|
-
static SFI_DG3 =
|
|
106
|
+
static SFI_DG3 = EID_CONSTANTS.SFI_DG3;
|
|
106
107
|
|
|
107
108
|
/** Short file identifier for file. */
|
|
108
|
-
static SFI_DG4 =
|
|
109
|
+
static SFI_DG4 = EID_CONSTANTS.SFI_DG4;
|
|
109
110
|
|
|
110
111
|
/** Short file identifier for file. */
|
|
111
|
-
static SFI_DG5 =
|
|
112
|
+
static SFI_DG5 = EID_CONSTANTS.SFI_DG5;
|
|
112
113
|
|
|
113
114
|
/** Short file identifier for file. */
|
|
114
|
-
static SFI_DG6 =
|
|
115
|
+
static SFI_DG6 = EID_CONSTANTS.SFI_DG6;
|
|
115
116
|
|
|
116
117
|
/** Short file identifier for file. */
|
|
117
|
-
static SFI_DG7 =
|
|
118
|
+
static SFI_DG7 = EID_CONSTANTS.SFI_DG7;
|
|
118
119
|
|
|
119
120
|
/** Short file identifier for file. */
|
|
120
|
-
static SFI_DG8 =
|
|
121
|
+
static SFI_DG8 = EID_CONSTANTS.SFI_DG8;
|
|
121
122
|
|
|
122
123
|
/** Short file identifier for file. */
|
|
123
|
-
static SFI_DG9 =
|
|
124
|
+
static SFI_DG9 = EID_CONSTANTS.SFI_DG9;
|
|
124
125
|
|
|
125
126
|
/** Short file identifier for file. */
|
|
126
|
-
static SFI_DG10 =
|
|
127
|
+
static SFI_DG10 = EID_CONSTANTS.SFI_DG10;
|
|
127
128
|
|
|
128
129
|
/** Short file identifier for file. */
|
|
129
|
-
static SFI_DG11 =
|
|
130
|
+
static SFI_DG11 = EID_CONSTANTS.SFI_DG11;
|
|
130
131
|
|
|
131
132
|
/** Short file identifier for file. */
|
|
132
|
-
static SFI_DG12 =
|
|
133
|
+
static SFI_DG12 = EID_CONSTANTS.SFI_DG12;
|
|
133
134
|
|
|
134
135
|
/** Short file identifier for file. */
|
|
135
|
-
static SFI_DG13 =
|
|
136
|
+
static SFI_DG13 = EID_CONSTANTS.SFI_DG13;
|
|
136
137
|
|
|
137
138
|
/** Short file identifier for file. */
|
|
138
|
-
static SFI_DG14 =
|
|
139
|
+
static SFI_DG14 = EID_CONSTANTS.SFI_DG14;
|
|
139
140
|
|
|
140
141
|
/** Short file identifier for file. */
|
|
141
|
-
static SFI_DG15 =
|
|
142
|
+
static SFI_DG15 = EID_CONSTANTS.SFI_DG15;
|
|
142
143
|
|
|
143
144
|
/** Short file identifier for file. */
|
|
144
|
-
static SFI_DG16 =
|
|
145
|
+
static SFI_DG16 = EID_CONSTANTS.SFI_DG16;
|
|
145
146
|
|
|
146
147
|
/** Short file identifier for file. */
|
|
147
|
-
static SFI_COM =
|
|
148
|
+
static SFI_COM = EID_CONSTANTS.SFI_COM;
|
|
148
149
|
|
|
149
150
|
/** Short file identifier for file. */
|
|
150
|
-
static SFI_SOD =
|
|
151
|
+
static SFI_SOD = EID_CONSTANTS.SFI_SOD;
|
|
151
152
|
|
|
152
153
|
/** Short file identifier for file. */
|
|
153
|
-
static SFI_CVCA =
|
|
154
|
+
static SFI_CVCA = EID_CONSTANTS.SFI_CVCA;
|
|
154
155
|
|
|
155
156
|
/** The default maximal blocksize used for unencrypted APDUs. */
|
|
156
|
-
static DEFAULT_MAX_BLOCKSIZE =
|
|
157
|
+
static DEFAULT_MAX_BLOCKSIZE = EID_CONSTANTS.DEFAULT_MAX_BLOCKSIZE;
|
|
157
158
|
|
|
158
159
|
/** The normal maximal transceive length of APDUs. */
|
|
159
|
-
static NORMAL_MAX_TRANSCEIVE_LENGTH =
|
|
160
|
+
static NORMAL_MAX_TRANSCEIVE_LENGTH = EID_CONSTANTS.NORMAL_MAX_TRANSCEIVE_LENGTH;
|
|
160
161
|
|
|
161
162
|
/** The extended maximal transceive length of APDUs. */
|
|
162
|
-
static EXTENDED_MAX_TRANSCEIVE_LENGTH =
|
|
163
|
+
static EXTENDED_MAX_TRANSCEIVE_LENGTH = EID_CONSTANTS.EXTENDED_MAX_TRANSCEIVE_LENGTH;
|
|
163
164
|
|
|
164
165
|
/** The applet we select when we start a session. */
|
|
165
|
-
static APPLET_AID =
|
|
166
|
+
static APPLET_AID = EID_CONSTANTS.APPLET_AID;
|
|
166
167
|
wrapper = null;
|
|
167
168
|
constructor(service, maxTransceiveLengthForSecureMessaging = EIDService.NORMAL_MAX_TRANSCEIVE_LENGTH, maxBlockSize = EIDService.DEFAULT_MAX_BLOCKSIZE, isSFIEnabled = false, shouldCheckMAC = false) {
|
|
168
169
|
super();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { EID_CONSTANTS } from "../constants/eidConstants.js";
|
|
4
4
|
import { CVCPrincipal } from "../cert/cvcPrincipal.js";
|
|
5
5
|
import { DataInputStream } from "../java/dataInputStream.js";
|
|
6
6
|
export class CVCAFile {
|
|
@@ -20,7 +20,7 @@ export class CVCAFile {
|
|
|
20
20
|
this.caReference = caReference;
|
|
21
21
|
this.altCAReference = altCAReference || null;
|
|
22
22
|
} else {
|
|
23
|
-
this.fid =
|
|
23
|
+
this.fid = EID_CONSTANTS.EF_CVCA;
|
|
24
24
|
this.readObject(fidOrInputStream);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { ASN1Constants } from "./asn1Constants.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Core TLV utility functions that don't depend on TLVInputStream/TLVOutputStream
|
|
7
|
+
* to avoid circular dependencies.
|
|
8
|
+
*/
|
|
9
|
+
export class TLVCore extends ASN1Constants {
|
|
10
|
+
// Tag class constants
|
|
11
|
+
static UNIVERSAL_CLASS = 0;
|
|
12
|
+
static APPLICATION_CLASS = 1;
|
|
13
|
+
static CONTEXT_SPECIFIC_CLASS = 2;
|
|
14
|
+
static PRIVATE_CLASS = 3;
|
|
15
|
+
static isPrimitive(tag) {
|
|
16
|
+
let i = 3;
|
|
17
|
+
for (; i >= 0; i--) {
|
|
18
|
+
const mask = 0xff << 8 * i;
|
|
19
|
+
if ((tag & mask) !== 0x00) {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const msByte = (tag & 0xff << 8 * i) >> 8 * i & 0xff;
|
|
24
|
+
return (msByte & 0x20) === 0x00;
|
|
25
|
+
}
|
|
26
|
+
static getTagLength(tag) {
|
|
27
|
+
if (tag < 0x1f) {
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
if (tag < 0x80) {
|
|
31
|
+
return 2;
|
|
32
|
+
}
|
|
33
|
+
if (tag < 0x8000) {
|
|
34
|
+
return 3;
|
|
35
|
+
}
|
|
36
|
+
if (tag < 0x800000) {
|
|
37
|
+
return 4;
|
|
38
|
+
}
|
|
39
|
+
return 5;
|
|
40
|
+
}
|
|
41
|
+
static isValidTag(tag) {
|
|
42
|
+
return tag >= 0x00 && tag <= 0xffffffff;
|
|
43
|
+
}
|
|
44
|
+
static getLengthLength(length) {
|
|
45
|
+
if (length < 0x80) {
|
|
46
|
+
return 1;
|
|
47
|
+
}
|
|
48
|
+
if (length < 0x100) {
|
|
49
|
+
return 2;
|
|
50
|
+
}
|
|
51
|
+
if (length < 0x10000) {
|
|
52
|
+
return 3;
|
|
53
|
+
}
|
|
54
|
+
if (length < 0x1000000) {
|
|
55
|
+
return 4;
|
|
56
|
+
}
|
|
57
|
+
return 5;
|
|
58
|
+
}
|
|
59
|
+
static getTagAsBytes(tag) {
|
|
60
|
+
const out = [];
|
|
61
|
+
const byteCount = Math.floor(Math.log(tag) / Math.log(256)) + 1;
|
|
62
|
+
for (let i = 0; i < byteCount; i++) {
|
|
63
|
+
const pos = 8 * (byteCount - i - 1);
|
|
64
|
+
out.push((tag & 0xff << pos) >> pos);
|
|
65
|
+
}
|
|
66
|
+
const tagBytes = out;
|
|
67
|
+
switch (TLVCore.getTagClass(tag)) {
|
|
68
|
+
case TLVCore.APPLICATION_CLASS:
|
|
69
|
+
tagBytes[0] |= 0x40;
|
|
70
|
+
break;
|
|
71
|
+
case TLVCore.CONTEXT_SPECIFIC_CLASS:
|
|
72
|
+
tagBytes[0] |= 0x80;
|
|
73
|
+
break;
|
|
74
|
+
case TLVCore.PRIVATE_CLASS:
|
|
75
|
+
tagBytes[0] |= 0xc0;
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
/* NOTE: Unsupported tag class. Now what? */
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
if (!TLVCore.isPrimitive(tag)) {
|
|
82
|
+
tagBytes[0] |= 0x20;
|
|
83
|
+
}
|
|
84
|
+
return tagBytes;
|
|
85
|
+
}
|
|
86
|
+
static getLengthAsBytes(length) {
|
|
87
|
+
const out = [];
|
|
88
|
+
if (length < 0x80) {
|
|
89
|
+
/* short form */
|
|
90
|
+
out.push(length);
|
|
91
|
+
} else {
|
|
92
|
+
const byteCount = TLVCore.log(length, 256);
|
|
93
|
+
out.push(0x80 | byteCount);
|
|
94
|
+
for (let i = 0; i < byteCount; i++) {
|
|
95
|
+
const pos = 8 * (byteCount - i - 1);
|
|
96
|
+
out.push((length & 0xff << pos) >> pos);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
static getTagClass(tag) {
|
|
102
|
+
let i = 3;
|
|
103
|
+
for (; i >= 0; i--) {
|
|
104
|
+
const mask = 0xff << 8 * i;
|
|
105
|
+
if ((tag & mask) !== 0x00) {
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const msByte = (tag & 0xff << 8 * i) >> 8 * i & 0xff;
|
|
110
|
+
switch (msByte & 0xc0) {
|
|
111
|
+
case 0x00:
|
|
112
|
+
return TLVCore.UNIVERSAL_CLASS;
|
|
113
|
+
case 0x40:
|
|
114
|
+
return TLVCore.APPLICATION_CLASS;
|
|
115
|
+
case 0x80:
|
|
116
|
+
return TLVCore.CONTEXT_SPECIFIC_CLASS;
|
|
117
|
+
case 0xc0:
|
|
118
|
+
default:
|
|
119
|
+
return TLVCore.PRIVATE_CLASS;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
static log(n, base) {
|
|
123
|
+
let result = 0;
|
|
124
|
+
while (n > 0) {
|
|
125
|
+
n = n / base;
|
|
126
|
+
result++;
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
static writeTagLength(tag, length) {
|
|
131
|
+
const tagLength = TLVCore.getTagLength(tag);
|
|
132
|
+
const lengthLength = TLVCore.getLengthLength(length);
|
|
133
|
+
const result = new Uint8Array(tagLength + lengthLength);
|
|
134
|
+
let offset = 0;
|
|
135
|
+
|
|
136
|
+
// Write tag
|
|
137
|
+
if (tagLength === 1) {
|
|
138
|
+
result[offset++] = tag & 0xff;
|
|
139
|
+
} else if (tagLength === 2) {
|
|
140
|
+
result[offset++] = 0x1f;
|
|
141
|
+
result[offset++] = tag & 0xff;
|
|
142
|
+
} else {
|
|
143
|
+
result[offset++] = 0x1f;
|
|
144
|
+
for (let i = tagLength - 2; i >= 0; i--) {
|
|
145
|
+
result[offset++] = tag >> i * 8 & 0xff;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Write length
|
|
150
|
+
if (lengthLength === 1) {
|
|
151
|
+
result[offset++] = length & 0xff;
|
|
152
|
+
} else {
|
|
153
|
+
result[offset++] = 0x80 | lengthLength - 1;
|
|
154
|
+
for (let i = lengthLength - 2; i >= 0; i--) {
|
|
155
|
+
result[offset++] = length >> i * 8 & 0xff;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
export default TLVCore;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { ByteArrayInputStream } from "../java/byteArrayInputStream.js";
|
|
4
4
|
import { DataInputStream } from "../java/dataInputStream.js";
|
|
5
5
|
import { InputStream } from "../java/inputStream.js";
|
|
6
|
-
import
|
|
6
|
+
import TLVCore from "./tlvCore.js";
|
|
7
7
|
import { TLVInputState } from "./tlvInputState.js";
|
|
8
8
|
export class TLVInputStream extends InputStream {
|
|
9
9
|
static MAX_BUFFER_LENGTH = 65535;
|
|
@@ -117,11 +117,11 @@ export class TLVInputStream extends InputStream {
|
|
|
117
117
|
let tag = -1;
|
|
118
118
|
if (this.state.getIsAtStartOfTag()) {} else if (this.state.getIsAtStartOfLength()) {
|
|
119
119
|
await this.readLength();
|
|
120
|
-
if (
|
|
120
|
+
if (TLVCore.isPrimitive(this.state.getTag())) {
|
|
121
121
|
await this.skipValue();
|
|
122
122
|
}
|
|
123
123
|
} else {
|
|
124
|
-
if (
|
|
124
|
+
if (TLVCore.isPrimitive(this.state.getTag())) {
|
|
125
125
|
await this.skipValue();
|
|
126
126
|
}
|
|
127
127
|
}
|
|
@@ -129,7 +129,7 @@ export class TLVInputStream extends InputStream {
|
|
|
129
129
|
if (tag === searchTag) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
-
if (
|
|
132
|
+
if (TLVCore.isPrimitive(tag)) {
|
|
133
133
|
const length = await this.readLength();
|
|
134
134
|
const skippedBytes = await this.skipValue();
|
|
135
135
|
if (skippedBytes >= length) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TLVCore from "./tlvCore.js";
|
|
4
4
|
export class TLVOutputState {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.state = [];
|
|
@@ -56,7 +56,7 @@ export class TLVOutputState {
|
|
|
56
56
|
const obj = new TLVStruct(tag);
|
|
57
57
|
if (this.state.length !== 0) {
|
|
58
58
|
const parent = this.state[this.state.length - 1];
|
|
59
|
-
const tagBytes =
|
|
59
|
+
const tagBytes = TLVCore.getTagAsBytes(tag);
|
|
60
60
|
parent.write(tagBytes, 0, tagBytes.length);
|
|
61
61
|
}
|
|
62
62
|
this.state.push(obj);
|
|
@@ -83,7 +83,7 @@ export class TLVOutputState {
|
|
|
83
83
|
const obj = this.state.pop();
|
|
84
84
|
if (this.state.length !== 0) {
|
|
85
85
|
const parent = this.state[this.state.length - 1];
|
|
86
|
-
const lengthBytes =
|
|
86
|
+
const lengthBytes = TLVCore.getLengthAsBytes(length);
|
|
87
87
|
parent.write(lengthBytes, 0, lengthBytes.length);
|
|
88
88
|
}
|
|
89
89
|
if (obj) {
|
|
@@ -102,7 +102,7 @@ export class TLVOutputState {
|
|
|
102
102
|
currentObject.setLength(byteCount);
|
|
103
103
|
if (currentObject.getValueBytesProcessed() === currentObject.getLength()) {
|
|
104
104
|
this.state.pop();
|
|
105
|
-
const lengthBytes =
|
|
105
|
+
const lengthBytes = TLVCore.getLengthAsBytes(byteCount);
|
|
106
106
|
const value = currentObject.getValue();
|
|
107
107
|
this.updateValueBytesProcessed(lengthBytes, 0, lengthBytes.length);
|
|
108
108
|
this.updateValueBytesProcessed(value, 0, value.length);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { DataOutputStream } from "../java/dataOutputStream.js";
|
|
4
4
|
import { OutputStream } from "../java/outputStream.js";
|
|
5
|
-
import
|
|
5
|
+
import TLVCore from "./tlvCore.js";
|
|
6
6
|
import { TLVOutputState } from "./tlvOutputState.js";
|
|
7
7
|
export class TLVOutputStream extends OutputStream {
|
|
8
8
|
constructor(outputStream) {
|
|
@@ -10,19 +10,21 @@ export class TLVOutputStream extends OutputStream {
|
|
|
10
10
|
this.outputStream = outputStream instanceof DataOutputStream ? outputStream : new DataOutputStream(outputStream);
|
|
11
11
|
this.state = new TLVOutputState();
|
|
12
12
|
}
|
|
13
|
-
writeTag(tag) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.outputStream.writeBytes(Uint8Array.from(tagAsBytes));
|
|
13
|
+
async writeTag(tag) {
|
|
14
|
+
if (!this.state.getIsAtStartOfTag()) {
|
|
15
|
+
throw new Error('Cannot write tag, still need length');
|
|
17
16
|
}
|
|
17
|
+
const tagAsBytes = TLVCore.getTagAsBytes(tag);
|
|
18
|
+
await this.outputStream.writeBytes(Uint8Array.from(tagAsBytes));
|
|
18
19
|
this.state.setTagProcessed(tag);
|
|
19
20
|
}
|
|
20
|
-
writeLength(length) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (this.state.canBeWritten()) {
|
|
24
|
-
this.outputStream.writeBytes(Uint8Array.from(lengthAsBytes));
|
|
21
|
+
async writeLength(length) {
|
|
22
|
+
if (!this.state.getIsAtStartOfLength()) {
|
|
23
|
+
throw new Error('Cannot write length');
|
|
25
24
|
}
|
|
25
|
+
const lengthAsBytes = TLVCore.getLengthAsBytes(length);
|
|
26
|
+
await this.outputStream.writeBytes(Uint8Array.from(lengthAsBytes));
|
|
27
|
+
this.state.setLengthProcessed(length);
|
|
26
28
|
}
|
|
27
29
|
writeValue(value) {
|
|
28
30
|
if (value == null) {
|
|
@@ -66,7 +68,7 @@ export class TLVOutputStream extends OutputStream {
|
|
|
66
68
|
const length = bufferedValueBytes.length;
|
|
67
69
|
this.state.updatePreviousLength(length);
|
|
68
70
|
if (this.state.canBeWritten()) {
|
|
69
|
-
const lengthAsBytes =
|
|
71
|
+
const lengthAsBytes = TLVCore.getLengthAsBytes(length);
|
|
70
72
|
this.outputStream.writeBytes(Uint8Array.from(lengthAsBytes));
|
|
71
73
|
this.outputStream.writeBytes(Uint8Array.from(bufferedValueBytes));
|
|
72
74
|
}
|
|
@@ -13,8 +13,6 @@ export const scanCodes = defaultPlugin.scanCodes;
|
|
|
13
13
|
// Hooks
|
|
14
14
|
export { useBarcodeScanner } from "./hooks/useBarcodeScanner.js";
|
|
15
15
|
export { useCameraPermissions } from "./hooks/useCameraPermissions.js";
|
|
16
|
-
// Components
|
|
17
|
-
export { BarcodeCamera } from "./components/BarcodeCamera.js";
|
|
18
16
|
// Utilities
|
|
19
17
|
export { convertFrameToScreen, convertScreenToFrame, convertBarcodeToScreen, getRectCenter, getCornerPointsCenter, getBoundsFromCornerPoints } from "./utils/geometry.js";
|
|
20
18
|
export { boundingBoxToHighlight, barcodesToHighlights, getHighlightStyle, cornerPointsToPath, cornerPointsToPolygonPoints } from "./utils/highlights.js";
|
|
@@ -14,6 +14,8 @@ export function createBarcodeScannerPlugin() {
|
|
|
14
14
|
try {
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
const result = plugin.call(frame, options);
|
|
17
|
+
|
|
18
|
+
// iOS now handles coordinate conversion, so return results directly
|
|
17
19
|
return result || [];
|
|
18
20
|
} catch (error) {
|
|
19
21
|
console.warn('scanCodes: Plugin call failed:', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QrCodeScannerCamera.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Components/QrCodeScannerCamera.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QrCodeScannerCamera.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Components/QrCodeScannerCamera.tsx"],"names":[],"mappings":"AA0BA,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,QAAA,MAAM,mBAAmB,GAAI,qBAAqB,wBAAwB,4CA2MzE,CAAC;AAqFF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants used throughout the EID Reader module.
|
|
3
|
+
* This file helps avoid circular dependencies by centralizing shared constants.
|
|
4
|
+
*/
|
|
5
|
+
export declare const EID_CONSTANTS: {
|
|
6
|
+
readonly EXTENDED_MAX_TRANSCEIVE_LENGTH: 65536;
|
|
7
|
+
readonly NORMAL_MAX_TRANSCEIVE_LENGTH: 256;
|
|
8
|
+
readonly DEFAULT_MAX_BLOCKSIZE: 223;
|
|
9
|
+
readonly EF_CARD_ACCESS: 284;
|
|
10
|
+
readonly EF_CARD_SECURITY: 285;
|
|
11
|
+
readonly EF_DG1: 257;
|
|
12
|
+
readonly EF_DG2: 258;
|
|
13
|
+
readonly EF_DG3: 259;
|
|
14
|
+
readonly EF_DG4: 260;
|
|
15
|
+
readonly EF_DG5: 261;
|
|
16
|
+
readonly EF_DG6: 262;
|
|
17
|
+
readonly EF_DG7: 263;
|
|
18
|
+
readonly EF_DG8: 264;
|
|
19
|
+
readonly EF_DG9: 265;
|
|
20
|
+
readonly EF_DG10: 266;
|
|
21
|
+
readonly EF_DG11: 267;
|
|
22
|
+
readonly EF_DG12: 268;
|
|
23
|
+
readonly EF_DG13: 269;
|
|
24
|
+
readonly EF_DG14: 270;
|
|
25
|
+
readonly EF_DG15: 271;
|
|
26
|
+
readonly EF_DG16: 272;
|
|
27
|
+
readonly EF_SOD: 285;
|
|
28
|
+
readonly EF_COM: 286;
|
|
29
|
+
readonly EF_CVCA: 284;
|
|
30
|
+
readonly SFI_CARD_ACCESS: 28;
|
|
31
|
+
readonly SFI_CARD_SECURITY: 29;
|
|
32
|
+
readonly SFI_DG1: 1;
|
|
33
|
+
readonly SFI_DG2: 2;
|
|
34
|
+
readonly SFI_DG3: 3;
|
|
35
|
+
readonly SFI_DG4: 4;
|
|
36
|
+
readonly SFI_DG5: 5;
|
|
37
|
+
readonly SFI_DG6: 6;
|
|
38
|
+
readonly SFI_DG7: 7;
|
|
39
|
+
readonly SFI_DG8: 8;
|
|
40
|
+
readonly SFI_DG9: 9;
|
|
41
|
+
readonly SFI_DG10: 10;
|
|
42
|
+
readonly SFI_DG11: 11;
|
|
43
|
+
readonly SFI_DG12: 12;
|
|
44
|
+
readonly SFI_DG13: 13;
|
|
45
|
+
readonly SFI_DG14: 14;
|
|
46
|
+
readonly SFI_DG15: 15;
|
|
47
|
+
readonly SFI_DG16: 16;
|
|
48
|
+
readonly SFI_COM: 30;
|
|
49
|
+
readonly SFI_SOD: 29;
|
|
50
|
+
readonly SFI_CVCA: 28;
|
|
51
|
+
readonly NO_PACE_KEY_REFERENCE: 0;
|
|
52
|
+
readonly MRZ_PACE_KEY_REFERENCE: 1;
|
|
53
|
+
readonly CAN_PACE_KEY_REFERENCE: 2;
|
|
54
|
+
readonly PIN_PACE_KEY_REFERENCE: 3;
|
|
55
|
+
readonly PUK_PACE_KEY_REFERENCE: 4;
|
|
56
|
+
readonly APPLET_AID: Uint8Array<ArrayBuffer>;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=eidConstants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eidConstants.d.ts","sourceRoot":"","sources":["../../../../../../src/Shared/EIDReader/constants/eidConstants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DhB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { ICountry } from './countryInterface';
|
|
2
|
+
export declare abstract class Country implements ICountry {
|
|
3
3
|
abstract valueOf(): number;
|
|
4
4
|
abstract getName(): string;
|
|
5
5
|
abstract getNationality(): string;
|
|
@@ -7,8 +7,7 @@ export declare abstract class Country {
|
|
|
7
7
|
abstract toAlpha3Code(): string;
|
|
8
8
|
static getInstance(code: number | string): Country;
|
|
9
9
|
static values(): Country[];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
private static isAssignable;
|
|
10
|
+
static fromAlpha2(alpha2Code: string): Country;
|
|
11
|
+
static fromAlpha3(alpha3Code: string): Country;
|
|
13
12
|
}
|
|
14
13
|
//# sourceMappingURL=country.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"country.d.ts","sourceRoot":"","sources":["../../../../../../src/Shared/EIDReader/data/country.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"country.d.ts","sourceRoot":"","sources":["../../../../../../src/Shared/EIDReader/data/country.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,8BAAsB,OAAQ,YAAW,QAAQ;aAC/B,OAAO,IAAI,MAAM;aACjB,OAAO,IAAI,MAAM;aACjB,cAAc,IAAI,MAAM;aACxB,YAAY,IAAI,MAAM;aACtB,YAAY,IAAI,MAAM;WAExB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;WAqB3C,MAAM,IAAI,OAAO,EAAE;WAKnB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;WAKvC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAItD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for country instances to avoid circular dependencies.
|
|
3
|
+
*/
|
|
4
|
+
export interface ICountry {
|
|
5
|
+
valueOf(): number;
|
|
6
|
+
getName(): string;
|
|
7
|
+
getNationality(): string;
|
|
8
|
+
toAlpha2Code(): string;
|
|
9
|
+
toAlpha3Code(): string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interface for country classes with static methods.
|
|
13
|
+
*/
|
|
14
|
+
export interface CountryConstructor {
|
|
15
|
+
values?(): ICountry[];
|
|
16
|
+
fromAlpha2?(alpha2Code: string): ICountry | null;
|
|
17
|
+
fromAlpha3?(alpha3Code: string): ICountry | null;
|
|
18
|
+
fromNumericCode?(numericCode: number): ICountry | null;
|
|
19
|
+
new (...args: any[]): ICountry;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=countryInterface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countryInterface.d.ts","sourceRoot":"","sources":["../../../../../../src/Shared/EIDReader/data/countryInterface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,OAAO,IAAI,MAAM,CAAC;IAClB,OAAO,IAAI,MAAM,CAAC;IAClB,cAAc,IAAI,MAAM,CAAC;IACzB,YAAY,IAAI,MAAM,CAAC;IACvB,YAAY,IAAI,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;IACtB,UAAU,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACjD,UAAU,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACjD,eAAe,CAAC,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACvD,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC;CAChC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ICountry, CountryConstructor } from './countryInterface';
|
|
2
|
+
/**
|
|
3
|
+
* Registry for country implementations to avoid circular dependencies.
|
|
4
|
+
*/
|
|
5
|
+
export declare class CountryRegistry {
|
|
6
|
+
private static countryTypes;
|
|
7
|
+
static register(countryType: CountryConstructor): void;
|
|
8
|
+
static getRegisteredTypes(): Array<CountryConstructor>;
|
|
9
|
+
static values(): ICountry[];
|
|
10
|
+
static fromAlpha2(alpha2Code: string): ICountry;
|
|
11
|
+
static fromAlpha3(alpha3Code: string): ICountry;
|
|
12
|
+
static fromNumericCode(numericCode: number): ICountry;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=countryRegistry.d.ts.map
|