Skip to content

Commit b24c496

Browse files
committed
feat: add experimental support for ISO/IEC 39794
1 parent 44eac7d commit b24c496

34 files changed

Lines changed: 1160 additions & 571 deletions

bun.lockb

-4 Bytes
Binary file not shown.

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@li0ard/tsemrtd",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"exports": "./src/index.ts",
55
"publish": {
66
"include": [

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@li0ard/tsemrtd",
33
"main": "dist/index.js",
44
"types": "dist/index.d.ts",
5-
"version": "0.3.1",
5+
"version": "0.3.2",
66
"type": "module",
77
"author": "li0ard",
88
"repository": {
@@ -33,9 +33,9 @@
3333
},
3434
"dependencies": {
3535
"@li0ard/tinytlv": "^0.1.1",
36-
"@peculiar/asn1-cms": "^2.3.15",
37-
"@peculiar/asn1-schema": "^2.3.15",
38-
"@peculiar/asn1-x509": "^2.3.15"
36+
"@peculiar/asn1-cms": "^2.6.0",
37+
"@peculiar/asn1-schema": "^2.6.0",
38+
"@peculiar/asn1-x509": "^2.6.0"
3939
},
4040
"keywords": ["emrtd", "mrtd", "icao", "tsemrtd", "9303", "passport"]
4141
}

src/asn1/eac.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ export class SecurityInfo {
2020
export class FileID {
2121
/** File ID */
2222
@AsnProp({ type: AsnPropTypes.OctetString })
23-
fid: ArrayBuffer = new ArrayBuffer(0)
23+
fid: Uint8Array = new Uint8Array()
2424

2525
/** Short file ID */
2626
@AsnProp({ type: AsnPropTypes.OctetString, optional: true })
27-
sfid?: ArrayBuffer;
27+
sfid?: Uint8Array;
2828
}
2929

3030
/** Information on an implementation of Terminal Authentication. Described by BSI TR-03110, section A.1.1.3 */

src/asn1/sbh.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,33 @@ import type { Enums } from "../index.js";
88
export default class SBH {
99
/** ICAO header version - Version of the CBEFF patron header format */
1010
@AsnProp({ type: AsnPropTypes.OctetString, context: 0, implicit: true, optional: true })
11-
version?: ArrayBuffer;
11+
version?: Uint8Array;
1212

1313
/** Biometric type */
1414
@AsnProp({ type: AsnPropTypes.Integer, context: 1, implicit: true, optional: true })
1515
type?: Enums.CBEFFBiometricType;
1616

1717
/** Biometric sub-type. (NIST IR 6529A, Table 6) */
1818
@AsnProp({ type: AsnPropTypes.Integer, context: 2, implicit: true, optional: true })
19-
sutype?: number;
19+
subtype?: number;
2020

2121
/** Creation date and time */
2222
@AsnProp({ type: AsnPropTypes.OctetString, context: 3, implicit: true, optional: true })
23-
issueDate?: ArrayBuffer;
23+
issueDate?: Uint8Array;
2424

2525
/** Validity period (from through) */
2626
@AsnProp({ type: AsnPropTypes.OctetString, context: 5, implicit: true, optional: true })
27-
expireDate?: ArrayBuffer;
27+
expireDate?: Uint8Array;
2828

2929
/** Creator of the biometric reference data (PID) */
3030
@AsnProp({ type: AsnPropTypes.OctetString, context: 6, implicit: true, optional: true })
31-
creator?: ArrayBuffer;
31+
creator?: Uint8Array;
3232

3333
/** Format Owner */
3434
@AsnProp({ type: AsnPropTypes.OctetString, context: 7, implicit: true })
35-
formatOwner: ArrayBuffer = new ArrayBuffer(0);
35+
formatOwner: Uint8Array = new Uint8Array();
3636

3737
/** Format Type */
3838
@AsnProp({ type: AsnPropTypes.OctetString, context: 8, implicit: true })
39-
formatType: ArrayBuffer = new ArrayBuffer(0);
39+
formatType: Uint8Array = new Uint8Array();
4040
}

src/consts/enums.ts

Lines changed: 127 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,18 @@ export enum FaceType {
6666
}
6767

6868
/** ISO/IEC 19794-5. Image type (format) */
69-
export enum ImageType {
69+
export enum ISO19794ImageType {
7070
JPEG = 0,
7171
JPEG2000 = 1
7272
}
7373

74+
/** ISO/IEC 39794-5. Image type (format) */
75+
export enum ISO39794ImageType {
76+
jpeg = 2,
77+
jpeg2000Lossy = 3,
78+
jpeg2000Lossless = 4
79+
}
80+
7481
/** ISO/IEC 19794-5. Image color space */
7582
export enum ImageColorSpace {
7683
UNSPECIFIED = 0x00,
@@ -95,7 +102,7 @@ export enum SourceType {
95102
}
96103

97104
/** ISO/IEC 19794-4. Image compression algorithm */
98-
export enum FingerprintImageType {
105+
export enum ISO19794FingerprintImageType {
99106
UNCOMPRESSED = 0x00,
100107
UNCOMPRESSEDPACKED = 0x01,
101108
WSQ = 0x02,
@@ -104,8 +111,17 @@ export enum FingerprintImageType {
104111
PNG = 0x05
105112
}
106113

114+
/** ISO/IEC 39794-4. Image compression algorithm */
115+
export enum ISO39794FingerprintImageType {
116+
pgm = 0,
117+
wsq = 1,
118+
jpeg2000Lossy = 2,
119+
jpeg2000Lossless = 3,
120+
png = 4
121+
}
122+
107123
/** ISO/IEC 19794-4. Name of finger/part of palm */
108-
export enum FingerType {
124+
export enum ISO19794FingerType {
109125
UNKNOWN = 0x00,
110126
RIGHTTHUMB = 0x01,
111127
RIGHTINDEX = 0x02,
@@ -140,21 +156,119 @@ export enum FingerType {
140156
PALM_LEFT_HYPOTHENAR = 36
141157
}
142158

159+
/** ISO/IEC 39794-4. Name of finger/part of palm */
160+
export enum ISO39794FingerType {
161+
unknownPosition = 0,
162+
rightThumbFinger = 1,
163+
rightIndexFinger = 2,
164+
rightMiddleFinger = 3,
165+
rightRingFinger = 4,
166+
rightLittleFinger = 5,
167+
leftThumbFinger = 6,
168+
leftIndexFinger = 7,
169+
leftMiddleFinger = 8,
170+
leftRingFinger = 9,
171+
leftLittleFinger = 10,
172+
rightFourFingers = 13,
173+
leftFourFingers = 14,
174+
bothThumbFingers = 15,
175+
rightExtraDigitFinger = 16,
176+
leftExtraDigitFinger = 17,
177+
unknownFrictionRidge = 18,
178+
entireJointImage = 19,
179+
unknownPalm = 20,
180+
rightFullPalm = 21,
181+
rightWritersPalm = 22,
182+
rightLowerPalm = 23,
183+
rightUpperPalm = 24,
184+
rightOtherPalm = 25,
185+
rightInterdigital = 26,
186+
rightThenar = 27,
187+
rightHypothenar = 28,
188+
leftFullPalm = 29,
189+
leftWritersPalm = 30,
190+
leftLowerPalm = 31,
191+
leftUpperPalm = 32,
192+
leftOtherPalm = 33,
193+
leftInterdigital = 34,
194+
leftThenar = 35,
195+
leftHypothenar = 36,
196+
rightGrasp = 37,
197+
leftGrasp = 38,
198+
rightIndexMiddleFingers = 40,
199+
rightMiddleRingFingers = 41,
200+
rightRingLittleFingers = 42,
201+
leftIndexMiddleFingers = 43,
202+
leftMiddleRingFingers = 44,
203+
leftRingLittleFingers = 45,
204+
rightIndexLeftIndexFingers = 46,
205+
rightIndexMiddleRingFingers = 47,
206+
rightMiddleRingLittleFingers = 48,
207+
leftIndexMiddleRingFingers = 49,
208+
leftMiddleRingLittleFingers = 50,
209+
rightFourFingertips = 51,
210+
leftFourFingertips = 52,
211+
rightFingertips = 53,
212+
leftFingertips = 54,
213+
leftMiddleIndexRightIndexMiddleFingers = 55,
214+
unknownSole = 60,
215+
rightSole = 61,
216+
leftSole = 62,
217+
unknownToe = 63,
218+
rightBigToe = 64,
219+
rightSecondToe = 65,
220+
rightMiddleToe = 66,
221+
rightFourthToe = 67,
222+
rightLittleToe = 68,
223+
leftBigToe = 69,
224+
leftSecondToe = 70,
225+
leftMiddleToe = 71,
226+
leftFourthToe = 72,
227+
leftLittleToe = 73,
228+
rightFrontBallFoot = 74,
229+
rightBackHeelFoot = 75,
230+
leftFrontBallFoot = 76,
231+
leftBackHeelFoot = 77,
232+
rightMiddleFoot = 78,
233+
leftMiddleFoot = 79,
234+
rightCarpalDelta = 81,
235+
leftCarpalDelta = 82,
236+
rightFullWithWriterPalm = 83,
237+
leftFullWithWriterPalm = 84,
238+
rightBracelet = 85,
239+
leftBracelet = 86,
240+
otherPosition = 999
241+
}
242+
243+
/** ISO/IEC 39794-4. Type of fingerprint and palm image */
244+
export enum ISO39794FingerImageType {
245+
plainContact = 0,
246+
rolledContact = 1,
247+
latentImage = 4,
248+
swipeContact = 8,
249+
stationarySubjectContactlessPlain = 24,
250+
stationarySubjectContactlessRolled = 25,
251+
movingSubjectContactlessPlain = 41,
252+
movingSubjectContactlessRolled = 42,
253+
otherImpression = 28,
254+
unknownImpression = 29
255+
}
256+
143257
/** ISO/IEC 19794-4. Type of fingerprint and palm image */
144-
export enum FingerImageType {
145-
LIVE = 0x00,
146-
LIVESWIPE = 0x01,
147-
NONLIVE = 0x02,
148-
NONLIVESWIPE = 0x02,
149-
FOOTPRINT = 0x03,
150-
BROACHING = 0x04,
151-
LIVECONTACTLESS = 0x09
258+
export enum ISO19794FingerImageType {
259+
LIVE = 0,
260+
LIVESWIPE = 1,
261+
NONLIVE = 2,
262+
NONLIVESWIPE = 2,
263+
FOOTPRINT = 3,
264+
BROACHING = 4,
265+
LIVECONTACTLESS = 9
152266
}
153267

154268
/** ISO/IEC 19794-4. Unit of measurement of resolution */
155269
export enum ImageUnit {
156-
DPI = 0x01,
157-
DPCM = 0x02
270+
DPI = 1,
271+
DPCM = 2
158272
}
159273

160274
/** ISO/IEC 19794-6. Image format */

0 commit comments

Comments
 (0)