Use uuidv4 for serialNumber instead of uvci
This commit is contained in:
parent
98b01068d2
commit
5054e4da54
|
@ -22,6 +22,7 @@
|
|||
"pngjs": "^6.0.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"uuid": "^8.3.2",
|
||||
"webpack": "^5.0.0",
|
||||
"worker-loader": "^3.0.7"
|
||||
},
|
||||
|
@ -4213,6 +4214,14 @@
|
|||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/vm-browserify": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz",
|
||||
|
@ -7725,6 +7734,11 @@
|
|||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
},
|
||||
"vm-browserify": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz",
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
"pngjs": "^6.0.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"uuid": "^8.3.2",
|
||||
"webpack": "^5.0.0",
|
||||
"worker-loader": "^3.0.7"
|
||||
},
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Constants} from "./constants";
|
|||
import {Payload, PayloadBody} from "./payload";
|
||||
import {ValueSets} from "./value_sets";
|
||||
import {toBuffer as createZip} from 'do-not-zip';
|
||||
import {v4 as uuid4} from 'uuid';
|
||||
|
||||
const crypto = require('crypto')
|
||||
|
||||
|
@ -26,7 +27,7 @@ interface Field {
|
|||
textAlignment?: string;
|
||||
}
|
||||
|
||||
interface GenericFields {
|
||||
interface PassStructureDictionary {
|
||||
headerFields: Array<Field>;
|
||||
primaryFields: Array<Field>;
|
||||
secondaryFields: Array<Field>;
|
||||
|
@ -54,7 +55,7 @@ export class PassData {
|
|||
serialNumber: string;
|
||||
barcodes: Array<QrCode>;
|
||||
barcode: QrCode;
|
||||
generic: GenericFields;
|
||||
generic: PassStructureDictionary;
|
||||
|
||||
// Generates a sha1 hash from a given buffer
|
||||
private static getBufferHash(buffer: Buffer | string): string {
|
||||
|
@ -152,7 +153,7 @@ export class PassData {
|
|||
this.labelColor = payload.labelColor;
|
||||
this.foregroundColor = payload.foregroundColor;
|
||||
this.backgroundColor = payload.backgroundColor;
|
||||
this.serialNumber = payload.uvci;
|
||||
this.serialNumber = uuid4(); // Generate random UUID v4
|
||||
this.barcodes = [qrCode];
|
||||
this.barcode = qrCode;
|
||||
this.generic = {
|
||||
|
|
Loading…
Reference in New Issue