Socket
Socket
Sign inDemoInstall

swissqrbill

Package Overview
Dependencies
73
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.2.2 to 3.2.3

2

lib/browser/bundle/index.js.LICENSE.txt

@@ -17,2 +17,4 @@ /*!

/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
/** @preserve

@@ -19,0 +21,0 @@ * Counter block mode compatible with Dr Brian Gladman fileenc.c

152

lib/browser/esm/shared/qr-code-generator.js

@@ -46,58 +46,2 @@ /* eslint-disable no-useless-escape */

class QrCode {
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code with the given version number,
// error correction level, data codeword bytes, and mask number.
// This is a low-level API that most users should not use directly.
// A mid-level API is the encodeSegments() function.
constructor(
// The version number of this QR Code, which is between 1 and 40 (inclusive).
// This determines the size of this barcode.
version,
// The error correction level used in this QR Code.
errorCorrectionLevel, dataCodewords, msk) {
this.version = version;
this.errorCorrectionLevel = errorCorrectionLevel;
// The modules of this QR Code (false = light, true = dark).
// Immutable after constructor finishes. Accessed through getModule().
this.modules = [];
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
this.isFunction = [];
// Check scalar arguments
if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION)
throw "Version value out of range";
if (msk < -1 || msk > 7)
throw "Mask value out of range";
this.size = version * 4 + 17;
// Initialize both grids to be size*size arrays of Boolean false
const row = [];
for (let i = 0; i < this.size; i++)
row.push(false);
for (let i = 0; i < this.size; i++) {
this.modules.push(row.slice()); // Initially all light
this.isFunction.push(row.slice());
}
// Compute ECC, draw modules
this.drawFunctionPatterns();
const allCodewords = this.addEccAndInterleave(dataCodewords);
this.drawCodewords(allCodewords);
// Do masking
if (msk == -1) { // Automatically choose best mask
let minPenalty = 1000000000;
for (let i = 0; i < 8; i++) {
this.applyMask(i);
this.drawFormatBits(i);
const penalty = this.getPenaltyScore();
if (penalty < minPenalty) {
msk = i;
minPenalty = penalty;
}
this.applyMask(i); // Undoes the mask due to XOR
}
}
assert(0 <= msk && msk <= 7);
this.mask = msk;
this.applyMask(msk); // Apply the final choice of mask
this.drawFormatBits(msk); // Overwrite old format bits
this.isFunction = [];
}
/*-- Static factory functions (high level) --*/

@@ -179,2 +123,58 @@ // Returns a QR Code representing the given Unicode text string at the given error correction level.

}
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code with the given version number,
// error correction level, data codeword bytes, and mask number.
// This is a low-level API that most users should not use directly.
// A mid-level API is the encodeSegments() function.
constructor(
// The version number of this QR Code, which is between 1 and 40 (inclusive).
// This determines the size of this barcode.
version,
// The error correction level used in this QR Code.
errorCorrectionLevel, dataCodewords, msk) {
this.version = version;
this.errorCorrectionLevel = errorCorrectionLevel;
// The modules of this QR Code (false = light, true = dark).
// Immutable after constructor finishes. Accessed through getModule().
this.modules = [];
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
this.isFunction = [];
// Check scalar arguments
if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION)
throw "Version value out of range";
if (msk < -1 || msk > 7)
throw "Mask value out of range";
this.size = version * 4 + 17;
// Initialize both grids to be size*size arrays of Boolean false
const row = [];
for (let i = 0; i < this.size; i++)
row.push(false);
for (let i = 0; i < this.size; i++) {
this.modules.push(row.slice()); // Initially all light
this.isFunction.push(row.slice());
}
// Compute ECC, draw modules
this.drawFunctionPatterns();
const allCodewords = this.addEccAndInterleave(dataCodewords);
this.drawCodewords(allCodewords);
// Do masking
if (msk == -1) { // Automatically choose best mask
let minPenalty = 1000000000;
for (let i = 0; i < 8; i++) {
this.applyMask(i);
this.drawFormatBits(i);
const penalty = this.getPenaltyScore();
if (penalty < minPenalty) {
msk = i;
minPenalty = penalty;
}
this.applyMask(i); // Undoes the mask due to XOR
}
}
assert(0 <= msk && msk <= 7);
this.mask = msk;
this.applyMask(msk); // Apply the final choice of mask
this.drawFormatBits(msk); // Overwrite old format bits
this.isFunction = [];
}
/*-- Accessor methods --*/

@@ -638,22 +638,2 @@ // Returns the color of the module (pixel) at the given coordinates, which is false

class QrSegment {
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code segment with the given attributes and data.
// The character count (numChars) must agree with the mode and the bit buffer length,
// but the constraint isn't checked. The given bit buffer is cloned and stored.
constructor(
// The mode indicator of this segment.
mode,
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive. Not the same as the data's bit length.
numChars,
// The data bits of this segment. Accessed through getData().
bitData) {
this.mode = mode;
this.numChars = numChars;
this.bitData = bitData;
if (numChars < 0)
throw "Invalid argument";
this.bitData = bitData.slice(); // Make defensive copy
}
/*-- Static factory functions (mid level) --*/

@@ -742,2 +722,22 @@ // Returns a segment representing the given binary data encoded in

}
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code segment with the given attributes and data.
// The character count (numChars) must agree with the mode and the bit buffer length,
// but the constraint isn't checked. The given bit buffer is cloned and stored.
constructor(
// The mode indicator of this segment.
mode,
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive. Not the same as the data's bit length.
numChars,
// The data bits of this segment. Accessed through getData().
bitData) {
this.mode = mode;
this.numChars = numChars;
this.bitData = bitData;
if (numChars < 0)
throw "Invalid argument";
this.bitData = bitData.slice(); // Make defensive copy
}
/*-- Methods --*/

@@ -744,0 +744,0 @@ // Returns a new copy of the data bits of this segment.

export { PDFTable, PDFRow, PDFColumn } from "../pdf/extended-pdf";
export declare type Currency = "CHF" | "EUR";
export declare type Size = "A4" | "A6/5";
export declare type Languages = "DE" | "EN" | "IT" | "FR";
export type Currency = "CHF" | "EUR";
export type Size = "A4" | "A6/5";
export type Languages = "DE" | "EN" | "IT" | "FR";
export interface Data {

@@ -6,0 +6,0 @@ /**

@@ -48,58 +48,2 @@ /* eslint-disable no-useless-escape */

class QrCode {
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code with the given version number,
// error correction level, data codeword bytes, and mask number.
// This is a low-level API that most users should not use directly.
// A mid-level API is the encodeSegments() function.
constructor(
// The version number of this QR Code, which is between 1 and 40 (inclusive).
// This determines the size of this barcode.
version,
// The error correction level used in this QR Code.
errorCorrectionLevel, dataCodewords, msk) {
this.version = version;
this.errorCorrectionLevel = errorCorrectionLevel;
// The modules of this QR Code (false = light, true = dark).
// Immutable after constructor finishes. Accessed through getModule().
this.modules = [];
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
this.isFunction = [];
// Check scalar arguments
if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION)
throw "Version value out of range";
if (msk < -1 || msk > 7)
throw "Mask value out of range";
this.size = version * 4 + 17;
// Initialize both grids to be size*size arrays of Boolean false
const row = [];
for (let i = 0; i < this.size; i++)
row.push(false);
for (let i = 0; i < this.size; i++) {
this.modules.push(row.slice()); // Initially all light
this.isFunction.push(row.slice());
}
// Compute ECC, draw modules
this.drawFunctionPatterns();
const allCodewords = this.addEccAndInterleave(dataCodewords);
this.drawCodewords(allCodewords);
// Do masking
if (msk == -1) { // Automatically choose best mask
let minPenalty = 1000000000;
for (let i = 0; i < 8; i++) {
this.applyMask(i);
this.drawFormatBits(i);
const penalty = this.getPenaltyScore();
if (penalty < minPenalty) {
msk = i;
minPenalty = penalty;
}
this.applyMask(i); // Undoes the mask due to XOR
}
}
assert(0 <= msk && msk <= 7);
this.mask = msk;
this.applyMask(msk); // Apply the final choice of mask
this.drawFormatBits(msk); // Overwrite old format bits
this.isFunction = [];
}
/*-- Static factory functions (high level) --*/

@@ -181,2 +125,58 @@ // Returns a QR Code representing the given Unicode text string at the given error correction level.

}
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code with the given version number,
// error correction level, data codeword bytes, and mask number.
// This is a low-level API that most users should not use directly.
// A mid-level API is the encodeSegments() function.
constructor(
// The version number of this QR Code, which is between 1 and 40 (inclusive).
// This determines the size of this barcode.
version,
// The error correction level used in this QR Code.
errorCorrectionLevel, dataCodewords, msk) {
this.version = version;
this.errorCorrectionLevel = errorCorrectionLevel;
// The modules of this QR Code (false = light, true = dark).
// Immutable after constructor finishes. Accessed through getModule().
this.modules = [];
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
this.isFunction = [];
// Check scalar arguments
if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION)
throw "Version value out of range";
if (msk < -1 || msk > 7)
throw "Mask value out of range";
this.size = version * 4 + 17;
// Initialize both grids to be size*size arrays of Boolean false
const row = [];
for (let i = 0; i < this.size; i++)
row.push(false);
for (let i = 0; i < this.size; i++) {
this.modules.push(row.slice()); // Initially all light
this.isFunction.push(row.slice());
}
// Compute ECC, draw modules
this.drawFunctionPatterns();
const allCodewords = this.addEccAndInterleave(dataCodewords);
this.drawCodewords(allCodewords);
// Do masking
if (msk == -1) { // Automatically choose best mask
let minPenalty = 1000000000;
for (let i = 0; i < 8; i++) {
this.applyMask(i);
this.drawFormatBits(i);
const penalty = this.getPenaltyScore();
if (penalty < minPenalty) {
msk = i;
minPenalty = penalty;
}
this.applyMask(i); // Undoes the mask due to XOR
}
}
assert(0 <= msk && msk <= 7);
this.mask = msk;
this.applyMask(msk); // Apply the final choice of mask
this.drawFormatBits(msk); // Overwrite old format bits
this.isFunction = [];
}
/*-- Accessor methods --*/

@@ -640,22 +640,2 @@ // Returns the color of the module (pixel) at the given coordinates, which is false

class QrSegment {
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code segment with the given attributes and data.
// The character count (numChars) must agree with the mode and the bit buffer length,
// but the constraint isn't checked. The given bit buffer is cloned and stored.
constructor(
// The mode indicator of this segment.
mode,
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive. Not the same as the data's bit length.
numChars,
// The data bits of this segment. Accessed through getData().
bitData) {
this.mode = mode;
this.numChars = numChars;
this.bitData = bitData;
if (numChars < 0)
throw "Invalid argument";
this.bitData = bitData.slice(); // Make defensive copy
}
/*-- Static factory functions (mid level) --*/

@@ -744,2 +724,22 @@ // Returns a segment representing the given binary data encoded in

}
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code segment with the given attributes and data.
// The character count (numChars) must agree with the mode and the bit buffer length,
// but the constraint isn't checked. The given bit buffer is cloned and stored.
constructor(
// The mode indicator of this segment.
mode,
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive. Not the same as the data's bit length.
numChars,
// The data bits of this segment. Accessed through getData().
bitData) {
this.mode = mode;
this.numChars = numChars;
this.bitData = bitData;
if (numChars < 0)
throw "Invalid argument";
this.bitData = bitData.slice(); // Make defensive copy
}
/*-- Methods --*/

@@ -746,0 +746,0 @@ // Returns a new copy of the data bits of this segment.

export { PDFTable, PDFRow, PDFColumn } from "../pdf/extended-pdf";
export declare type Currency = "CHF" | "EUR";
export declare type Size = "A4" | "A6/5";
export declare type Languages = "DE" | "EN" | "IT" | "FR";
export type Currency = "CHF" | "EUR";
export type Size = "A4" | "A6/5";
export type Languages = "DE" | "EN" | "IT" | "FR";
export interface Data {

@@ -6,0 +6,0 @@ /**

@@ -46,58 +46,2 @@ /* eslint-disable no-useless-escape */

class QrCode {
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code with the given version number,
// error correction level, data codeword bytes, and mask number.
// This is a low-level API that most users should not use directly.
// A mid-level API is the encodeSegments() function.
constructor(
// The version number of this QR Code, which is between 1 and 40 (inclusive).
// This determines the size of this barcode.
version,
// The error correction level used in this QR Code.
errorCorrectionLevel, dataCodewords, msk) {
this.version = version;
this.errorCorrectionLevel = errorCorrectionLevel;
// The modules of this QR Code (false = light, true = dark).
// Immutable after constructor finishes. Accessed through getModule().
this.modules = [];
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
this.isFunction = [];
// Check scalar arguments
if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION)
throw "Version value out of range";
if (msk < -1 || msk > 7)
throw "Mask value out of range";
this.size = version * 4 + 17;
// Initialize both grids to be size*size arrays of Boolean false
const row = [];
for (let i = 0; i < this.size; i++)
row.push(false);
for (let i = 0; i < this.size; i++) {
this.modules.push(row.slice()); // Initially all light
this.isFunction.push(row.slice());
}
// Compute ECC, draw modules
this.drawFunctionPatterns();
const allCodewords = this.addEccAndInterleave(dataCodewords);
this.drawCodewords(allCodewords);
// Do masking
if (msk == -1) { // Automatically choose best mask
let minPenalty = 1000000000;
for (let i = 0; i < 8; i++) {
this.applyMask(i);
this.drawFormatBits(i);
const penalty = this.getPenaltyScore();
if (penalty < minPenalty) {
msk = i;
minPenalty = penalty;
}
this.applyMask(i); // Undoes the mask due to XOR
}
}
assert(0 <= msk && msk <= 7);
this.mask = msk;
this.applyMask(msk); // Apply the final choice of mask
this.drawFormatBits(msk); // Overwrite old format bits
this.isFunction = [];
}
/*-- Static factory functions (high level) --*/

@@ -179,2 +123,58 @@ // Returns a QR Code representing the given Unicode text string at the given error correction level.

}
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code with the given version number,
// error correction level, data codeword bytes, and mask number.
// This is a low-level API that most users should not use directly.
// A mid-level API is the encodeSegments() function.
constructor(
// The version number of this QR Code, which is between 1 and 40 (inclusive).
// This determines the size of this barcode.
version,
// The error correction level used in this QR Code.
errorCorrectionLevel, dataCodewords, msk) {
this.version = version;
this.errorCorrectionLevel = errorCorrectionLevel;
// The modules of this QR Code (false = light, true = dark).
// Immutable after constructor finishes. Accessed through getModule().
this.modules = [];
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
this.isFunction = [];
// Check scalar arguments
if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION)
throw "Version value out of range";
if (msk < -1 || msk > 7)
throw "Mask value out of range";
this.size = version * 4 + 17;
// Initialize both grids to be size*size arrays of Boolean false
const row = [];
for (let i = 0; i < this.size; i++)
row.push(false);
for (let i = 0; i < this.size; i++) {
this.modules.push(row.slice()); // Initially all light
this.isFunction.push(row.slice());
}
// Compute ECC, draw modules
this.drawFunctionPatterns();
const allCodewords = this.addEccAndInterleave(dataCodewords);
this.drawCodewords(allCodewords);
// Do masking
if (msk == -1) { // Automatically choose best mask
let minPenalty = 1000000000;
for (let i = 0; i < 8; i++) {
this.applyMask(i);
this.drawFormatBits(i);
const penalty = this.getPenaltyScore();
if (penalty < minPenalty) {
msk = i;
minPenalty = penalty;
}
this.applyMask(i); // Undoes the mask due to XOR
}
}
assert(0 <= msk && msk <= 7);
this.mask = msk;
this.applyMask(msk); // Apply the final choice of mask
this.drawFormatBits(msk); // Overwrite old format bits
this.isFunction = [];
}
/*-- Accessor methods --*/

@@ -638,22 +638,2 @@ // Returns the color of the module (pixel) at the given coordinates, which is false

class QrSegment {
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code segment with the given attributes and data.
// The character count (numChars) must agree with the mode and the bit buffer length,
// but the constraint isn't checked. The given bit buffer is cloned and stored.
constructor(
// The mode indicator of this segment.
mode,
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive. Not the same as the data's bit length.
numChars,
// The data bits of this segment. Accessed through getData().
bitData) {
this.mode = mode;
this.numChars = numChars;
this.bitData = bitData;
if (numChars < 0)
throw "Invalid argument";
this.bitData = bitData.slice(); // Make defensive copy
}
/*-- Static factory functions (mid level) --*/

@@ -742,2 +722,22 @@ // Returns a segment representing the given binary data encoded in

}
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code segment with the given attributes and data.
// The character count (numChars) must agree with the mode and the bit buffer length,
// but the constraint isn't checked. The given bit buffer is cloned and stored.
constructor(
// The mode indicator of this segment.
mode,
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive. Not the same as the data's bit length.
numChars,
// The data bits of this segment. Accessed through getData().
bitData) {
this.mode = mode;
this.numChars = numChars;
this.bitData = bitData;
if (numChars < 0)
throw "Invalid argument";
this.bitData = bitData.slice(); // Make defensive copy
}
/*-- Methods --*/

@@ -744,0 +744,0 @@ // Returns a new copy of the data bits of this segment.

export { PDFTable, PDFRow, PDFColumn } from "../pdf/extended-pdf";
export declare type Currency = "CHF" | "EUR";
export declare type Size = "A4" | "A6/5";
export declare type Languages = "DE" | "EN" | "IT" | "FR";
export type Currency = "CHF" | "EUR";
export type Size = "A4" | "A6/5";
export type Languages = "DE" | "EN" | "IT" | "FR";
export interface Data {

@@ -6,0 +6,0 @@ /**

{
"name": "swissqrbill",
"version": "3.2.2",
"version": "3.2.3",
"description": "Swiss QR Bill generation in Node.js and browsers",

@@ -152,8 +152,8 @@ "main": "./lib/node/cjs/node/index.js",

"devDependencies": {
"@schoero/eslint-config": "^1.6.1",
"@schoero/eslint-config": "^1.38.1",
"@types/blob-stream": "^0.1.30",
"@types/node": "^18.7.14",
"@types/node": "^18.15.11",
"@types/svg-parser": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"assert": "^2.0.0",

@@ -163,19 +163,19 @@ "brfs": "^2.0.2",

"buffer": "^6.0.3",
"eslint": "^8.23.0",
"eslint": "^8.38.0",
"process": "^0.11.10",
"readable-stream": "^3.6.0",
"readable-stream": "^3.6.2",
"transform-loader": "^0.2.4",
"ts-loader": "^9.3.1",
"typescript": "^4.8.2",
"util": "^0.12.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"ts-loader": "^9.4.2",
"typescript": "^5.0.4",
"util": "^0.12.5",
"webpack": "^5.79.0",
"webpack-cli": "^5.0.1"
},
"dependencies": {
"@types/pdfkit": "^0.12.6",
"@types/pdfkit": "^0.12.9",
"blob-stream": "^0.1.3",
"pdfkit": "^0.13.0",
"svg-engine": "^0.2.3",
"svgpath": "^2.5.0"
"svgpath": "^2.6.0"
}
}

@@ -56,3 +56,3 @@ <div align="center">

* [QR bill validator](https://swiss-qr-invoice.org/validator/?lang=de)
* [QR bill specifications](https://www.paymentstandards.ch/dam/downloads/ig-qr-bill-en.pdf)
* [QR bill specifications](https://www.six-group.com/dam/download/banking-services/standardization/qr-bill/ig-qr-bill-v2.2-en.pdf)

@@ -59,0 +59,0 @@ <br/>

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc