@gwydion-id/icao-9303-models 0.1.3 → 0.1.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/package.json +1 -1
- package/src/digitalseal.js +38 -1
- package/src/digitalsealv3.js +13 -1
- package/src/digitalsealv4.js +13 -1
- package/src/mrvadocument.js +17 -2
- package/src/mrvadocumentwithvds3.js +14 -2
- package/src/mrvadocumentwithvds4.js +14 -2
- package/src/mrvbdocument.js +17 -2
- package/src/mrvbdocumentwithvds3.js +14 -2
- package/src/mrvbdocumentwithvds4.js +14 -2
- package/src/td1document.js +13 -2
- package/src/td1documentwithvds3.js +14 -2
- package/src/td1documentwithvds4.js +14 -2
- package/src/td2document.js +13 -2
- package/src/td2documentwithvds3.js +14 -2
- package/src/td2documentwithvds4.js +14 -2
- package/src/td3document.js +13 -2
- package/src/td3documentwithvds3.js +14 -2
- package/src/td3documentwithvds4.js +14 -2
- package/src/traveldocument.js +27 -4
- package/src/visadocument.js +17 -0
package/package.json
CHANGED
package/src/digitalseal.js
CHANGED
|
@@ -195,12 +195,30 @@ export class DigitalSeal {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
#features;
|
|
198
199
|
/**
|
|
199
200
|
* A store of digitally-encoded document features used to create the message
|
|
200
201
|
* zone.
|
|
201
202
|
* @type { Map<number, number[]>}
|
|
202
203
|
*/
|
|
203
|
-
features;
|
|
204
|
+
get features() { return this.#features; }
|
|
205
|
+
/**
|
|
206
|
+
* @param { Map<number, number[]> | [string, number[]][] | {{[key: string]: number[]}} } value - For
|
|
207
|
+
* arrays and objects, the key will be converted from a string into a number.
|
|
208
|
+
*/
|
|
209
|
+
set features(value) {
|
|
210
|
+
if (value instanceof Map) {
|
|
211
|
+
this.#features = value;
|
|
212
|
+
} else if (Array.isArray(value)) {
|
|
213
|
+
this.#features = new Map(value.map(([k, v]) => [Number(k), v]));
|
|
214
|
+
} else if (typeof value === 'object') {
|
|
215
|
+
this.#features = new Map(Object.entries(value).map(([k, v]) => [Number(k), v]));
|
|
216
|
+
} else {
|
|
217
|
+
throw new TypeError(
|
|
218
|
+
'Document features must be a Map<number, number[]>, [string, number[]][], or a {{[key: string]: number[]}} object.'
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
204
222
|
|
|
205
223
|
/**
|
|
206
224
|
* The raw signature data generated by concatenating the header and message
|
|
@@ -230,5 +248,24 @@ export class DigitalSeal {
|
|
|
230
248
|
set signatureZone(value) {
|
|
231
249
|
this.signature = setSignatureZone(0, value);
|
|
232
250
|
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Returns a JSON object representing a DigitalSeal
|
|
254
|
+
* @returns { Object }
|
|
255
|
+
*/
|
|
256
|
+
toJSON() {
|
|
257
|
+
return {
|
|
258
|
+
kind: 'DigitalSeal',
|
|
259
|
+
authorityCode: this.authorityCode,
|
|
260
|
+
identifierCode: this.identifierCode,
|
|
261
|
+
certReference: this.certReference,
|
|
262
|
+
issueDate: this.issueDate.toISOString(),
|
|
263
|
+
signatureDate: this.signatureDate.toISOString(),
|
|
264
|
+
featureDefinition: this.featureDefinition,
|
|
265
|
+
typeCategory: this.typeCategory,
|
|
266
|
+
features: Array.from(this.features.entries()),
|
|
267
|
+
signatureData: this.signatureData
|
|
268
|
+
};
|
|
269
|
+
}
|
|
233
270
|
}
|
|
234
271
|
|
package/src/digitalsealv3.js
CHANGED
|
@@ -177,7 +177,8 @@ export class DigitalSealV3 {
|
|
|
177
177
|
*/
|
|
178
178
|
get features() { return this.#digitalseal.features; }
|
|
179
179
|
/**
|
|
180
|
-
* @param { Map<number, number[]> } value
|
|
180
|
+
* @param { Map<number, number[]> | [string, number[]][] | {{[key: string]: number[]}} } value - For
|
|
181
|
+
* arrays and objects, the key will be converted from a string into a number.
|
|
181
182
|
*/
|
|
182
183
|
set features(value) { this.#digitalseal.features = value; }
|
|
183
184
|
|
|
@@ -367,5 +368,16 @@ export class DigitalSealV3 {
|
|
|
367
368
|
const output = await getHash(this.unsignedSeal, algorithm);
|
|
368
369
|
return output;
|
|
369
370
|
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Returns a JSON object representing a DigitalSealV3
|
|
374
|
+
* @returns { Object }
|
|
375
|
+
*/
|
|
376
|
+
toJSON() {
|
|
377
|
+
return {
|
|
378
|
+
...this.#digitalseal.toJSON(),
|
|
379
|
+
kind: 'DigitalSealV3'
|
|
380
|
+
};
|
|
381
|
+
}
|
|
370
382
|
}
|
|
371
383
|
|
package/src/digitalsealv4.js
CHANGED
|
@@ -170,7 +170,8 @@ export class DigitalSealV4 {
|
|
|
170
170
|
*/
|
|
171
171
|
get features() { return this.#digitalseal.features; }
|
|
172
172
|
/**
|
|
173
|
-
* @param { Map<number, number[]> } value
|
|
173
|
+
* @param { Map<number, number[]> | [string, number[]][] | {{[key: string]: number[]}} } value - For
|
|
174
|
+
* arrays and objects, the key will be converted from a string into a number.
|
|
174
175
|
*/
|
|
175
176
|
set features(value) { this.#digitalseal.features = value; }
|
|
176
177
|
|
|
@@ -377,5 +378,16 @@ export class DigitalSealV4 {
|
|
|
377
378
|
const output = await getHash(this.unsignedSeal, algorithm);
|
|
378
379
|
return output;
|
|
379
380
|
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Returns a JSON object representing a DigitalSealV4
|
|
384
|
+
* @returns { Object }
|
|
385
|
+
*/
|
|
386
|
+
toJSON() {
|
|
387
|
+
return {
|
|
388
|
+
...this.#digitalseal.toJSON(),
|
|
389
|
+
kind: 'DigitalSealV4'
|
|
390
|
+
};
|
|
391
|
+
}
|
|
380
392
|
}
|
|
381
393
|
|
package/src/mrvadocument.js
CHANGED
|
@@ -101,9 +101,9 @@ export class MRVADocument {
|
|
|
101
101
|
this.additionalInfo = opt?.additionalInfo ?? "";
|
|
102
102
|
this.passportNumber = opt?.passportNumber ?? "L8988901C";
|
|
103
103
|
this.usePassportInMRZ = opt?.usePassportInMRZ ?? true;
|
|
104
|
+
this.photo = opt?.photo ?? null;
|
|
105
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
104
106
|
|
|
105
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
106
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
107
107
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
108
108
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
109
109
|
if (opt?.machineReadableZone) {
|
|
@@ -461,5 +461,20 @@ export class MRVADocument {
|
|
|
461
461
|
this.mrzLine1 = value.slice(0, 44);
|
|
462
462
|
this.mrzLine2 = value.slice(44);
|
|
463
463
|
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Returns a JSON object representing a MRVADocument
|
|
467
|
+
* @returns { Object }
|
|
468
|
+
*/
|
|
469
|
+
toJSON() {
|
|
470
|
+
const output = {
|
|
471
|
+
...this.#document.toJSON(),
|
|
472
|
+
...this.#visa.toJSON(),
|
|
473
|
+
validThru: this.validThru.toISOString(),
|
|
474
|
+
kind: 'MRVADocument'
|
|
475
|
+
};
|
|
476
|
+
delete output.expirationDate;
|
|
477
|
+
return output;
|
|
478
|
+
}
|
|
464
479
|
}
|
|
465
480
|
|
|
@@ -130,9 +130,9 @@ export class MRVADocumentWithVDS3 {
|
|
|
130
130
|
this.typeCategory = opt?.typeCategory ?? 0x01;
|
|
131
131
|
this.features = opt?.features ?? new Map();
|
|
132
132
|
this.signatureData = opt?.signatureData ?? Array(64).fill(0);
|
|
133
|
+
this.photo = opt?.photo ?? null;
|
|
134
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
133
135
|
|
|
134
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
135
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
136
136
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
137
137
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
138
138
|
if (opt?.machineReadableZone) {
|
|
@@ -566,5 +566,17 @@ export class MRVADocumentWithVDS3 {
|
|
|
566
566
|
const output = await this.#digitalseal.getHash(algorithm);
|
|
567
567
|
return output;
|
|
568
568
|
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Returns a JSON object representing a MRVADocumentWithVDS3
|
|
572
|
+
* @returns { Object }
|
|
573
|
+
*/
|
|
574
|
+
toJSON() {
|
|
575
|
+
return {
|
|
576
|
+
...this.#document.toJSON(),
|
|
577
|
+
...this.#digitalseal.toJSON(),
|
|
578
|
+
kind: 'MRVADocumentWithVDS3'
|
|
579
|
+
};
|
|
580
|
+
}
|
|
569
581
|
}
|
|
570
582
|
|
|
@@ -130,9 +130,9 @@ export class MRVADocumentWithVDS4 {
|
|
|
130
130
|
this.typeCategory = opt?.typeCategory ?? 0x01;
|
|
131
131
|
this.features = opt?.features ?? new Map();
|
|
132
132
|
this.signatureData = opt?.signatureData ?? Array(64).fill(0);
|
|
133
|
+
this.photo = opt?.photo ?? null;
|
|
134
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
133
135
|
|
|
134
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
135
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
136
136
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
137
137
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
138
138
|
if (opt?.machineReadableZone) {
|
|
@@ -566,5 +566,17 @@ export class MRVADocumentWithVDS4 {
|
|
|
566
566
|
const output = await this.#digitalseal.getHash(algorithm);
|
|
567
567
|
return output;
|
|
568
568
|
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Returns a JSON object representing a MRVADocumentWithVDS4
|
|
572
|
+
* @returns { Object }
|
|
573
|
+
*/
|
|
574
|
+
toJSON() {
|
|
575
|
+
return {
|
|
576
|
+
...this.#document.toJSON(),
|
|
577
|
+
...this.#digitalseal.toJSON(),
|
|
578
|
+
kind: 'MRVADocumentWithVDS4'
|
|
579
|
+
};
|
|
580
|
+
}
|
|
569
581
|
}
|
|
570
582
|
|
package/src/mrvbdocument.js
CHANGED
|
@@ -102,9 +102,9 @@ export class MRVBDocument {
|
|
|
102
102
|
this.additionalInfo = opt?.additionalInfo ?? "";
|
|
103
103
|
this.passportNumber = opt?.passportNumber ?? "L8988901C";
|
|
104
104
|
this.usePassportInMRZ = opt?.usePassportInMRZ ?? true;
|
|
105
|
+
this.photo = opt?.photo ?? null;
|
|
106
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
105
107
|
|
|
106
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
107
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
108
108
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
109
109
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
110
110
|
if (opt?.machineReadableZone) {
|
|
@@ -462,5 +462,20 @@ export class MRVBDocument {
|
|
|
462
462
|
this.mrzLine1 = value.slice(0, 36);
|
|
463
463
|
this.mrzLine2 = value.slice(36);
|
|
464
464
|
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Returns a JSON object representing a MRVBDocument
|
|
468
|
+
* @returns { Object }
|
|
469
|
+
*/
|
|
470
|
+
toJSON() {
|
|
471
|
+
const output = {
|
|
472
|
+
...this.#document.toJSON(),
|
|
473
|
+
...this.#visa.toJSON(),
|
|
474
|
+
validThru: this.validThru.toISOString(),
|
|
475
|
+
kind: 'MRVBDocument'
|
|
476
|
+
};
|
|
477
|
+
delete output.expirationDate;
|
|
478
|
+
return output;
|
|
479
|
+
}
|
|
465
480
|
}
|
|
466
481
|
|
|
@@ -131,9 +131,9 @@ export class MRVBDocumentWithVDS3 {
|
|
|
131
131
|
this.typeCategory = opt?.typeCategory ?? 0x01;
|
|
132
132
|
this.features = opt?.features ?? new Map();
|
|
133
133
|
this.signatureData = opt?.signatureData ?? Array(64).fill(0);
|
|
134
|
+
this.photo = opt?.photo ?? null;
|
|
135
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
134
136
|
|
|
135
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
136
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
137
137
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
138
138
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
139
139
|
if (opt?.machineReadableZone) {
|
|
@@ -567,5 +567,17 @@ export class MRVBDocumentWithVDS3 {
|
|
|
567
567
|
const output = await this.#digitalseal.getHash(algorithm);
|
|
568
568
|
return output;
|
|
569
569
|
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Returns a JSON object representing a MRVBDocumentWithVDS3
|
|
573
|
+
* @returns { Object }
|
|
574
|
+
*/
|
|
575
|
+
toJSON() {
|
|
576
|
+
return {
|
|
577
|
+
...this.#document.toJSON(),
|
|
578
|
+
...this.#digitalseal.toJSON(),
|
|
579
|
+
kind: 'MRVBDocumentWithVDS3'
|
|
580
|
+
};
|
|
581
|
+
}
|
|
570
582
|
}
|
|
571
583
|
|
|
@@ -131,9 +131,9 @@ export class MRVBDocumentWithVDS4 {
|
|
|
131
131
|
this.typeCategory = opt?.typeCategory ?? 0x01;
|
|
132
132
|
this.features = opt?.features ?? new Map();
|
|
133
133
|
this.signatureData = opt?.signatureData ?? Array(64).fill(0);
|
|
134
|
+
this.photo = opt?.photo ?? null;
|
|
135
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
134
136
|
|
|
135
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
136
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
137
137
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
138
138
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
139
139
|
if (opt?.machineReadableZone) {
|
|
@@ -567,5 +567,17 @@ export class MRVBDocumentWithVDS4 {
|
|
|
567
567
|
const output = await this.#digitalseal.getHash(algorithm);
|
|
568
568
|
return output;
|
|
569
569
|
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Returns a JSON object representing a MRVBDocumentWithVDS4
|
|
573
|
+
* @returns { Object }
|
|
574
|
+
*/
|
|
575
|
+
toJSON() {
|
|
576
|
+
return {
|
|
577
|
+
...this.#document.toJSON(),
|
|
578
|
+
...this.#digitalseal.toJSON(),
|
|
579
|
+
kind: 'MRVBDocumentWithVDS4'
|
|
580
|
+
};
|
|
581
|
+
}
|
|
570
582
|
}
|
|
571
583
|
|
package/src/td1document.js
CHANGED
|
@@ -82,9 +82,9 @@ export class TD1Document {
|
|
|
82
82
|
this.secondaryIdentifier = opt?.secondaryIdentifier ?? null;
|
|
83
83
|
this.secondaryIdentifierNative = opt?.secondaryIdentifierNative ?? null;
|
|
84
84
|
this.optionalData = opt?.optionalData ?? "";
|
|
85
|
+
this.photo = opt?.photo ?? null;
|
|
86
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
85
87
|
|
|
86
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
87
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
88
88
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
89
89
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
90
90
|
if (opt?.mrzLine3) { this.mrzLine3 = opt.mrzLine3; }
|
|
@@ -404,5 +404,16 @@ export class TD1Document {
|
|
|
404
404
|
48, 59
|
|
405
405
|
)).replace(/</gi, " ").trimEnd();
|
|
406
406
|
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Returns a JSON object representing a TD1Document
|
|
410
|
+
* @returns { Object }
|
|
411
|
+
*/
|
|
412
|
+
toJSON() {
|
|
413
|
+
return {
|
|
414
|
+
...this.#document.toJSON(),
|
|
415
|
+
kind: 'TD1Document'
|
|
416
|
+
};
|
|
417
|
+
}
|
|
407
418
|
}
|
|
408
419
|
|
|
@@ -113,9 +113,9 @@ export class TD1DocumentWithVDS3 {
|
|
|
113
113
|
this.typeCategory = opt?.typeCategory ?? 0x01;
|
|
114
114
|
this.features = opt?.features ?? new Map();
|
|
115
115
|
this.signatureData = opt?.signatureData ?? Array(64).fill(0);
|
|
116
|
+
this.photo = opt?.photo ?? null;
|
|
117
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
116
118
|
|
|
117
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
118
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
119
119
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
120
120
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
121
121
|
if (opt?.mrzLine3) { this.mrzLine3 = opt.mrzLine3; }
|
|
@@ -486,5 +486,17 @@ export class TD1DocumentWithVDS3 {
|
|
|
486
486
|
const output = await this.#digitalseal.getHash(algorithm);
|
|
487
487
|
return output;
|
|
488
488
|
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Returns a JSON object representing a TD1DocumentWithVDS3
|
|
492
|
+
* @returns { Object }
|
|
493
|
+
*/
|
|
494
|
+
toJSON() {
|
|
495
|
+
return {
|
|
496
|
+
...this.#document.toJSON(),
|
|
497
|
+
...this.#digitalseal.toJSON(),
|
|
498
|
+
kind: 'TD1DocumentWithVDS3'
|
|
499
|
+
};
|
|
500
|
+
}
|
|
489
501
|
}
|
|
490
502
|
|
|
@@ -113,9 +113,9 @@ export class TD1DocumentWithVDS4 {
|
|
|
113
113
|
this.typeCategory = opt?.typeCategory ?? 0x01;
|
|
114
114
|
this.features = opt?.features ?? new Map();
|
|
115
115
|
this.signatureData = opt?.signatureData ?? Array(64).fill(0);
|
|
116
|
+
this.photo = opt?.photo ?? null;
|
|
117
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
116
118
|
|
|
117
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
118
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
119
119
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
120
120
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
121
121
|
if (opt?.mrzLine3) { this.mrzLine3 = opt.mrzLine3; }
|
|
@@ -486,5 +486,17 @@ export class TD1DocumentWithVDS4 {
|
|
|
486
486
|
const output = await this.#digitalseal.getHash(algorithm);
|
|
487
487
|
return output;
|
|
488
488
|
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Returns a JSON object representing a TD1DocumentWithVDS4
|
|
492
|
+
* @returns { Object }
|
|
493
|
+
*/
|
|
494
|
+
toJSON() {
|
|
495
|
+
return {
|
|
496
|
+
...this.#document.toJSON(),
|
|
497
|
+
...this.#digitalseal.toJSON(),
|
|
498
|
+
kind: 'TD1DocumentWithVDS4'
|
|
499
|
+
};
|
|
500
|
+
}
|
|
489
501
|
}
|
|
490
502
|
|
package/src/td2document.js
CHANGED
|
@@ -80,9 +80,9 @@ export class TD2Document {
|
|
|
80
80
|
this.genderMarker = opt?.genderMarker ?? "F";
|
|
81
81
|
this.expirationDate = opt?.expirationDate ?? "2012-04-15";
|
|
82
82
|
this.optionalData = opt?.optionalData ?? "";
|
|
83
|
+
this.photo = opt?.photo ?? null;
|
|
84
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
83
85
|
|
|
84
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
85
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
86
86
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
87
87
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
88
88
|
if (opt?.machineReadableZone) {
|
|
@@ -375,5 +375,16 @@ export class TD2Document {
|
|
|
375
375
|
this.mrzLine1 = value.slice(0, 36);
|
|
376
376
|
this.mrzLine2 = value.slice(36);
|
|
377
377
|
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Returns a JSON object representing a TD2Document
|
|
381
|
+
* @returns { Object }
|
|
382
|
+
*/
|
|
383
|
+
toJSON() {
|
|
384
|
+
return {
|
|
385
|
+
...this.#document.toJSON(),
|
|
386
|
+
kind: 'TD2Document'
|
|
387
|
+
};
|
|
388
|
+
}
|
|
378
389
|
}
|
|
379
390
|
|
|
@@ -111,9 +111,9 @@ export class TD2DocumentWithVDS3 {
|
|
|
111
111
|
this.typeCategory = opt?.typeCategory ?? 0x01;
|
|
112
112
|
this.features = opt?.features ?? new Map();
|
|
113
113
|
this.signatureData = opt?.signatureData ?? Array(64).fill(0);
|
|
114
|
+
this.photo = opt?.photo ?? null;
|
|
115
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
114
116
|
|
|
115
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
116
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
117
117
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
118
118
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
119
119
|
if (opt?.machineReadableZone) {
|
|
@@ -473,5 +473,17 @@ export class TD2DocumentWithVDS3 {
|
|
|
473
473
|
const output = await this.#digitalseal.getHash(algorithm);
|
|
474
474
|
return output;
|
|
475
475
|
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Returns a JSON object representing a TD2DocumentWithVDS3
|
|
479
|
+
* @returns { Object }
|
|
480
|
+
*/
|
|
481
|
+
toJSON() {
|
|
482
|
+
return {
|
|
483
|
+
...this.#document.toJSON(),
|
|
484
|
+
...this.#digitalseal.toJSON(),
|
|
485
|
+
kind: 'TD2DocumentWithVDS3'
|
|
486
|
+
};
|
|
487
|
+
}
|
|
476
488
|
}
|
|
477
489
|
|
|
@@ -111,9 +111,9 @@ export class TD2DocumentWithVDS4 {
|
|
|
111
111
|
this.typeCategory = opt?.typeCategory ?? 0x01;
|
|
112
112
|
this.features = opt?.features ?? new Map();
|
|
113
113
|
this.signatureData = opt?.signatureData ?? Array(64).fill(0);
|
|
114
|
+
this.photo = opt?.photo ?? null;
|
|
115
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
114
116
|
|
|
115
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
116
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
117
117
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
118
118
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
119
119
|
if (opt?.machineReadableZone) {
|
|
@@ -473,5 +473,17 @@ export class TD2DocumentWithVDS4 {
|
|
|
473
473
|
const output = await this.#digitalseal.getHash(algorithm);
|
|
474
474
|
return output;
|
|
475
475
|
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Returns a JSON object representing a TD2DocumentWithVDS4
|
|
479
|
+
* @returns { Object }
|
|
480
|
+
*/
|
|
481
|
+
toJSON() {
|
|
482
|
+
return {
|
|
483
|
+
...this.#document.toJSON(),
|
|
484
|
+
...this.#digitalseal.toJSON(),
|
|
485
|
+
kind: 'TD2DocumentWithVDS4'
|
|
486
|
+
};
|
|
487
|
+
}
|
|
476
488
|
}
|
|
477
489
|
|
package/src/td3document.js
CHANGED
|
@@ -80,9 +80,9 @@ export class TD3Document {
|
|
|
80
80
|
this.genderMarker = opt?.genderMarker ?? "F";
|
|
81
81
|
this.expirationDate = opt?.expirationDate ?? "2034-04-15";
|
|
82
82
|
this.optionalData = opt?.optionalData ?? "ZE184226B";
|
|
83
|
+
this.photo = opt?.photo ?? null;
|
|
84
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
83
85
|
|
|
84
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
85
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
86
86
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
87
87
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
88
88
|
if (opt?.machineReadableZone) {
|
|
@@ -387,5 +387,16 @@ export class TD3Document {
|
|
|
387
387
|
this.mrzLine1 = value.slice(0, 44);
|
|
388
388
|
this.mrzLine2 = value.slice(44);
|
|
389
389
|
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Returns a JSON object representing a TD3Document
|
|
393
|
+
* @returns { Object }
|
|
394
|
+
*/
|
|
395
|
+
toJSON() {
|
|
396
|
+
return {
|
|
397
|
+
...this.#document.toJSON(),
|
|
398
|
+
kind: 'TD3Document'
|
|
399
|
+
};
|
|
400
|
+
}
|
|
390
401
|
}
|
|
391
402
|
|
|
@@ -111,9 +111,9 @@ export class TD3DocumentWithVDS3 {
|
|
|
111
111
|
this.typeCategory = opt?.typeCategory ?? 0x01;
|
|
112
112
|
this.features = opt?.features ?? new Map();
|
|
113
113
|
this.signatureData = opt?.signatureData ?? Array(64).fill(0);
|
|
114
|
+
this.photo = opt?.photo ?? null;
|
|
115
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
114
116
|
|
|
115
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
116
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
117
117
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
118
118
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
119
119
|
if (opt?.machineReadableZone) {
|
|
@@ -473,5 +473,17 @@ export class TD3DocumentWithVDS3 {
|
|
|
473
473
|
const output = await this.#digitalseal.getHash(algorithm);
|
|
474
474
|
return output;
|
|
475
475
|
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Returns a JSON object representing a TD3DocumentWithVDS3
|
|
479
|
+
* @returns { Object }
|
|
480
|
+
*/
|
|
481
|
+
toJSON() {
|
|
482
|
+
return {
|
|
483
|
+
...this.#document.toJSON(),
|
|
484
|
+
...this.#digitalseal.toJSON(),
|
|
485
|
+
kind: 'TD3DocumentWithVDS3'
|
|
486
|
+
};
|
|
487
|
+
}
|
|
476
488
|
}
|
|
477
489
|
|
|
@@ -111,9 +111,9 @@ export class TD3DocumentWithVDS4 {
|
|
|
111
111
|
this.typeCategory = opt?.typeCategory ?? 0x01;
|
|
112
112
|
this.features = opt?.features ?? new Map();
|
|
113
113
|
this.signatureData = opt?.signatureData ?? Array(64).fill(0);
|
|
114
|
+
this.photo = opt?.photo ?? null;
|
|
115
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
114
116
|
|
|
115
|
-
if (opt?.photo) { this.photo = opt.photo; }
|
|
116
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
117
117
|
if (opt?.mrzLine1) { this.mrzLine1 = opt.mrzLine1; }
|
|
118
118
|
if (opt?.mrzLine2) { this.mrzLine2 = opt.mrzLine2; }
|
|
119
119
|
if (opt?.machineReadableZone) {
|
|
@@ -473,5 +473,17 @@ export class TD3DocumentWithVDS4 {
|
|
|
473
473
|
const output = await this.#digitalseal.getHash(algorithm);
|
|
474
474
|
return output;
|
|
475
475
|
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Returns a JSON object representing a TD3DocumentWithVDS4
|
|
479
|
+
* @returns { Object }
|
|
480
|
+
*/
|
|
481
|
+
toJSON() {
|
|
482
|
+
return {
|
|
483
|
+
...this.#document.toJSON(),
|
|
484
|
+
...this.#digitalseal.toJSON(),
|
|
485
|
+
kind: 'TD3DocumentWithVDS4'
|
|
486
|
+
};
|
|
487
|
+
}
|
|
476
488
|
}
|
|
477
489
|
|
package/src/traveldocument.js
CHANGED
|
@@ -56,7 +56,7 @@ export class TravelDocument {
|
|
|
56
56
|
* holder.
|
|
57
57
|
*/
|
|
58
58
|
constructor(opt) {
|
|
59
|
-
this.
|
|
59
|
+
this.typeCode = opt?.typeCode ?? "I";
|
|
60
60
|
this.authorityCode = opt?.authorityCode ?? "UTO";
|
|
61
61
|
this.number = opt?.number ?? "D23145890";
|
|
62
62
|
this.birthDate = opt?.birthDate ?? "1974-08-12";
|
|
@@ -68,9 +68,8 @@ export class TravelDocument {
|
|
|
68
68
|
this.secondaryIdentifier = opt?.secondaryIdentifier ?? null;
|
|
69
69
|
this.secondaryIdentifierNative = opt?.secondaryIdentifierNative ?? null;
|
|
70
70
|
this.optionalData = opt?.optionalData ?? "";
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (opt?.signatureImage) { this.signatureImage = opt.signatureImage; }
|
|
71
|
+
this.photo = opt?.photo ?? null;
|
|
72
|
+
this.signatureImage = opt?.signatureImage ?? null;
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
#typeCode;
|
|
@@ -302,5 +301,29 @@ export class TravelDocument {
|
|
|
302
301
|
set machineReadableZone(value) {
|
|
303
302
|
throw new TypeError("An inherited or composed class must implement abstract property 'machineReadableZone'.");
|
|
304
303
|
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Returns a JSON object representing a TravelDocument
|
|
307
|
+
* @returns { Object }
|
|
308
|
+
*/
|
|
309
|
+
toJSON() {
|
|
310
|
+
return {
|
|
311
|
+
kind: 'TravelDocument',
|
|
312
|
+
typeCode: this.typeCode,
|
|
313
|
+
authorityCode: this.authorityCode,
|
|
314
|
+
number: this.number,
|
|
315
|
+
birthDate: this.birthDate.toISOString(),
|
|
316
|
+
genderMarker: this.genderMarker,
|
|
317
|
+
expirationDate: this.expirationDate.toISOString(),
|
|
318
|
+
nationalityCode: this.nationalityCode,
|
|
319
|
+
primaryIdentifier: this.primaryIdentifier,
|
|
320
|
+
primaryIdentifierNative: this.primaryIdentifierNative,
|
|
321
|
+
secondaryIdentifier: this.secondaryIdentifier,
|
|
322
|
+
secondaryIdentifierNative: this.secondaryIdentifierNative,
|
|
323
|
+
optionalData: this.optionalData,
|
|
324
|
+
photo: this.photo,
|
|
325
|
+
signatureImage: this.signatureImage
|
|
326
|
+
};
|
|
327
|
+
}
|
|
305
328
|
}
|
|
306
329
|
|
package/src/visadocument.js
CHANGED
|
@@ -110,5 +110,22 @@ export class VisaDocument {
|
|
|
110
110
|
* @type { boolean }
|
|
111
111
|
*/
|
|
112
112
|
usePassportInMRZ;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Returns a JSON object representing a VisaDocument
|
|
116
|
+
* @returns { Object }
|
|
117
|
+
*/
|
|
118
|
+
toJSON() {
|
|
119
|
+
return {
|
|
120
|
+
kind: 'VisaDocument',
|
|
121
|
+
placeOfIssue: this.placeOfIssue,
|
|
122
|
+
validFrom: this.validFrom.toISOString(),
|
|
123
|
+
numberOfEntries: this.numberOfEntries,
|
|
124
|
+
visaType: this.visaType,
|
|
125
|
+
additionalInfo: this.additionalInfo,
|
|
126
|
+
passportNumber: this.passportNumber,
|
|
127
|
+
usePassportInMRZ: this.usePassportInMRZ
|
|
128
|
+
};
|
|
129
|
+
}
|
|
113
130
|
}
|
|
114
131
|
|