Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ibankit

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ibankit - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

26

lib/ibanBuilder.js

@@ -113,2 +113,3 @@ "use strict";

}
let needCheckDigit = false;
for (const entry of structure.getParts()) {

@@ -118,3 +119,3 @@ switch (entry.getPartType()) {

if (!this.bankCodeValue) {
this.bankCodeValue = entry.getRandom();
this.bankCodeValue = entry.generate("", structure);
}

@@ -124,3 +125,3 @@ break;

if (!this.branchCodeValue) {
this.branchCodeValue = entry.getRandom();
this.branchCodeValue = entry.generate("", structure);
}

@@ -130,3 +131,3 @@ break;

if (!this.accountNumberValue) {
this.accountNumberValue = entry.getRandom();
this.accountNumberValue = entry.generate("", structure);
}

@@ -136,3 +137,4 @@ break;

if (!this.nationalCheckDigitValue) {
this.nationalCheckDigitValue = entry.getRandom();
needCheckDigit = true;
this.nationalCheckDigitValue = "".padStart(entry.getLength(), "0");
}

@@ -142,3 +144,3 @@ break;

if (!this.accountTypeValue) {
this.accountTypeValue = entry.getRandom();
this.accountTypeValue = entry.generate("", structure);
}

@@ -148,3 +150,3 @@ break;

if (!this.ownerAccountTypeValue) {
this.ownerAccountTypeValue = entry.getRandom();
this.ownerAccountTypeValue = entry.generate("", structure);
}

@@ -154,3 +156,3 @@ break;

if (!this.identificationNumberValue) {
this.identificationNumberValue = entry.getRandom();
this.identificationNumberValue = entry.generate("", structure);
}

@@ -160,5 +162,13 @@ break;

}
if (needCheckDigit) {
for (const entry of structure.getParts()) {
if (entry.getPartType() === structurePart_1.PartType.NATIONAL_CHECK_DIGIT) {
const bban = this.formatBban();
this.nationalCheckDigitValue = entry.generate(bban, structure);
}
}
}
}
}
exports.IBANBuilder = IBANBuilder;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJm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ElBQUksQ0FBQyxnQkFBZ0IsR0FBRyxLQUFLLENBQUMsUUFBUSxDQUFDLEVBQUUsRUFBRSxTQUFTLENBQUMsQ0FBQztxQkFDdkQ7b0JBQ0QsTUFBTTtnQkFDUixLQUFLLHdCQUFRLENBQUMsb0JBQW9CO29CQUNoQyxJQUFJLENBQUMsSUFBSSxDQUFDLHFCQUFxQixFQUFFO3dCQUMvQixJQUFJLENBQUMscUJBQXFCLEdBQUcsS0FBSyxDQUFDLFFBQVEsQ0FBQyxFQUFFLEVBQUUsU0FBUyxDQUFDLENBQUM7cUJBQzVEO29CQUNELE1BQU07Z0JBQ1IsS0FBSyx3QkFBUSxDQUFDLHFCQUFxQjtvQkFDakMsSUFBSSxDQUFDLElBQUksQ0FBQyx5QkFBeUIsRUFBRTt3QkFDbkMsSUFBSSxDQUFDLHlCQUF5QixHQUFHLEtBQUssQ0FBQyxRQUFRLENBQUMsRUFBRSxFQUFFLFNBQVMsQ0FBQyxDQUFDO3FCQUNoRTtvQkFDRCxNQUFNO2FBQ1Q7U0FDRjtRQUVELElBQUksY0FBYyxFQUFFO1lBQ2xCLEtBQUssTUFBTSxLQUFLLElBQUksU0FBUyxDQUFDLFFBQVEsRUFBRSxFQUFFO2dCQUN4QyxJQUFJLEtBQUssQ0FBQyxXQUFXLEVBQUUsS0FBSyx3QkFBUSxDQUFDLG9CQUFvQixFQUFFO29CQUN6RCxNQUFNLElBQUksR0FBRyxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUM7b0JBRS9CLElBQUksQ0FBQyx1QkFBdUIsR0FBRyxLQUFLLENBQUMsUUFBUSxDQUFDLElBQUksRUFBRSxTQUFTLENBQUMsQ0FBQztpQkFDaEU7YUFDRjtTQUNGO0lBQ0gsQ0FBQztDQUNGO0FBMVNELGtDQTBTQyJ9

@@ -18,2 +18,3 @@ import { BbanStructure } from "./bbanStructure";

}
declare type GenerateValue = (bban: string, structure: BbanStructure) => string;
export declare class BbanStructurePart {

@@ -23,3 +24,4 @@ private entryType;

private length;
validateValue?(value: string, bban: string, structure: BbanStructure): void;
generate: GenerateValue;
hasGenerator: boolean;
private constructor();

@@ -29,3 +31,3 @@ static bankCode(length: number, characterType: CharacterType): BbanStructurePart;

static accountNumber(length: number, characterType: CharacterType): BbanStructurePart;
static nationalCheckDigit(length: number, characterType: CharacterType, validate?: (value: string, bban: string, structure: BbanStructure) => void): BbanStructurePart;
static nationalCheckDigit(length: number, characterType: CharacterType, generate?: GenerateValue): BbanStructurePart;
static accountType(length: number, characterType: CharacterType): BbanStructurePart;

@@ -38,4 +40,5 @@ static currencyType(length: number, characterType: CharacterType): BbanStructurePart;

getLength(): number;
getRandom(): string;
validate(value: string): boolean;
private defaultGenerator;
}
export {};

@@ -35,7 +35,8 @@ "use strict";

class BbanStructurePart {
constructor(entryType, characterType, length, validate) {
constructor(entryType, characterType, length, generate) {
this.entryType = entryType;
this.characterType = characterType;
this.length = length;
this.validateValue = validate;
this.generate = generate || this.defaultGenerator;
this.hasGenerator = !!generate;
}

@@ -51,4 +52,4 @@ static bankCode(length, characterType) {

}
static nationalCheckDigit(length, characterType, validate) {
return new BbanStructurePart(PartType.NATIONAL_CHECK_DIGIT, characterType, length, validate);
static nationalCheckDigit(length, characterType, generate) {
return new BbanStructurePart(PartType.NATIONAL_CHECK_DIGIT, characterType, length, generate);
}

@@ -76,3 +77,6 @@ static accountType(length, characterType) {

}
getRandom() {
validate(value) {
return charByCharacterRE[this.characterType].test(value);
}
defaultGenerator(bban, structure) {
const charChoices = charByCharacterType[this.characterType];

@@ -85,7 +89,4 @@ let s = [];

}
validate(value) {
return charByCharacterRE[this.characterType].test(value);
}
}
exports.BbanStructurePart = BbanStructurePart;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RydWN0dXJlUGFydC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9zdHJ1Y3R1cmVQYXJ0LnRzIl0sIm5hbWVzIjpbX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UFDO1NBQ2xEO1FBRUQsT0FBTyxDQUFDLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0lBQ3BCLENBQUM7Q0FDRjtBQTlIRCw4Q0E4SEMifQ==
{
"name": "ibankit",
"version": "1.0.3",
"version": "1.1.0",
"description": "IBAN and BIC utilities",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -39,3 +39,3 @@ # ibankit

const iban = IBAN.random();
const iban = new Iban.Builder()
const iban = new IBAN.Builder()
.countryCode(CountryCode.AT)

@@ -64,4 +64,4 @@ .bankCode("19043")

[ ] For random IBANs the National Check digits is random, rather than "valid"
[ ] Finish writing all national check digit validators (see Oracle spec)
- [ ] Finish writing all national check digit generators (see Oracle spec)
- [x] For random IBANs the National Check digits is random, rather than "valid"

@@ -68,0 +68,0 @@ #### References

@@ -23,3 +23,3 @@ import { CharacterType, BbanStructurePart, PartType } from "./structurePart";

function nationalFactory(weights: number[]) {
return (checkdigit: string, bban: string, structure: BbanStructure) => {
return (bban: string, structure: BbanStructure) => {
const accountNumber = structure.extractValue(bban, PartType.ACCOUNT_NUMBER);

@@ -31,13 +31,3 @@

const actual = structure.extractValue(bban, PartType.NATIONAL_CHECK_DIGIT);
const digit = mod11(accountNumber, weights);
if (actual !== String(digit)) {
throw new FormatException(
FormatViolation.NATIONAL_CHECK_DIGIT,
`national check digit(s) don't match expect=[${digit}] actual=[${actual}]`,
String(digit),
String(actual),
);
}
return String(mod11(accountNumber, weights));
};

@@ -97,3 +87,31 @@ }

BbanStructurePart.accountNumber(7, CharacterType.n),
BbanStructurePart.nationalCheckDigit(2, CharacterType.n),
BbanStructurePart.nationalCheckDigit(
2,
CharacterType.n,
(bban: string, structure: BbanStructure) => {
const accountNumber = structure.extractValue(
bban,
PartType.ACCOUNT_NUMBER,
);
const bankCode = structure.extractValue(bban, PartType.BANK_CODE);
if (accountNumber === null || bankCode === null) {
throw new FormatException(
FormatViolation.NOT_EMPTY,
"account number or bank code missing",
);
}
const value = parseInt(`${bankCode}${accountNumber}`, 10);
const remainder = Math.floor(value / 97);
let expected = value - remainder * 97;
if (expected === 0) {
expected = 97;
}
return String(expected).padStart(2, "0");
},
),
),

@@ -242,3 +260,35 @@

BbanStructurePart.accountNumber(11, CharacterType.c),
BbanStructurePart.nationalCheckDigit(2, CharacterType.n),
BbanStructurePart.nationalCheckDigit(
2,
CharacterType.n,
(bban: string, structure: BbanStructure) => {
const replaceChars = {
["[AJ]"]: "1",
["[BKS]"]: "2",
["[CLT]"]: "3",
["[DMU]"]: "4",
["[ENV]"]: "5",
["[FOW]"]: "6",
["[GPX]"]: "7",
["[HQY]"]: "8",
["[IRZ]"]: "9",
};
let combined =
[PartType.BANK_CODE, PartType.BRANCH_CODE, PartType.ACCOUNT_NUMBER]
.map(p => String(structure.extractValue(bban, p)))
.join("") + "00";
Object.entries(replaceChars).map(
([k, v]) => (combined = combined.replace(new RegExp(k, "g"), v)),
);
// Number is bigger than max integer, take the mod%97 by hand
const expected =
97 -
combined
.split("")
.reduce((acc, v) => (acc * 10 + parseInt(v)) % 97, 0);
return String(expected).padStart(2, "0");
},
),
),

@@ -729,31 +779,41 @@

) {
if (part.validate(entryValue)) {
if (part.validateValue) {
part.validateValue(entryValue, bban, this);
if (!part.validate(entryValue)) {
switch (part.getCharacterType()) {
case CharacterType.a:
throw new FormatException(
FormatViolation.BBAN_ONLY_UPPER_CASE_LETTERS,
`[${entryValue}] must contain only upper case letters.`,
entryValue,
);
case CharacterType.c:
throw new FormatException(
FormatViolation.BBAN_ONLY_DIGITS_OR_LETTERS,
`[${entryValue}] must contain only digits or letters.`,
entryValue,
);
case CharacterType.n:
throw new FormatException(
FormatViolation.BBAN_ONLY_DIGITS,
`[${entryValue}] must contain only digits.`,
entryValue,
);
}
return;
}
switch (part.getCharacterType()) {
case CharacterType.a:
if (
part.getPartType() === PartType.NATIONAL_CHECK_DIGIT &&
part.hasGenerator
) {
const expected = part.generate(bban, this);
if (entryValue !== expected) {
throw new FormatException(
FormatViolation.BBAN_ONLY_UPPER_CASE_LETTERS,
`[${entryValue}] must contain only upper case letters.`,
FormatViolation.NATIONAL_CHECK_DIGIT,
`national check digit(s) don't match expect=[${expected}] actual=[${entryValue}]`,
expected,
entryValue,
);
case CharacterType.c:
throw new FormatException(
FormatViolation.BBAN_ONLY_DIGITS_OR_LETTERS,
`[${entryValue}] must contain only digits or letters.`,
entryValue,
);
case CharacterType.n:
throw new FormatException(
FormatViolation.BBAN_ONLY_DIGITS,
`[${entryValue}] must contain only digits.`,
entryValue,
);
}
}
}
}

@@ -261,2 +261,4 @@ import * as ibanUtil from "./ibanUtil";

let needCheckDigit = false;
for (const entry of structure.getParts()) {

@@ -266,3 +268,3 @@ switch (entry.getPartType()) {

if (!this.bankCodeValue) {
this.bankCodeValue = entry.getRandom();
this.bankCodeValue = entry.generate("", structure);
}

@@ -272,3 +274,3 @@ break;

if (!this.branchCodeValue) {
this.branchCodeValue = entry.getRandom();
this.branchCodeValue = entry.generate("", structure);
}

@@ -278,3 +280,3 @@ break;

if (!this.accountNumberValue) {
this.accountNumberValue = entry.getRandom();
this.accountNumberValue = entry.generate("", structure);
}

@@ -284,3 +286,4 @@ break;

if (!this.nationalCheckDigitValue) {
this.nationalCheckDigitValue = entry.getRandom();
needCheckDigit = true;
this.nationalCheckDigitValue = "".padStart(entry.getLength(), "0");
}

@@ -290,3 +293,3 @@ break;

if (!this.accountTypeValue) {
this.accountTypeValue = entry.getRandom();
this.accountTypeValue = entry.generate("", structure);
}

@@ -296,3 +299,3 @@ break;

if (!this.ownerAccountTypeValue) {
this.ownerAccountTypeValue = entry.getRandom();
this.ownerAccountTypeValue = entry.generate("", structure);
}

@@ -302,3 +305,3 @@ break;

if (!this.identificationNumberValue) {
this.identificationNumberValue = entry.getRandom();
this.identificationNumberValue = entry.generate("", structure);
}

@@ -308,3 +311,13 @@ break;

}
if (needCheckDigit) {
for (const entry of structure.getParts()) {
if (entry.getPartType() === PartType.NATIONAL_CHECK_DIGIT) {
const bban = this.formatBban();
this.nationalCheckDigitValue = entry.generate(bban, structure);
}
}
}
}
}

@@ -53,2 +53,4 @@ import { randInt } from "./randInt";

type GenerateValue = (bban: string, structure: BbanStructure) => string;
export class BbanStructurePart {

@@ -58,5 +60,5 @@ private entryType: PartType;

private length: number;
generate: GenerateValue;
hasGenerator: boolean;
validateValue?(value: string, bban: string, structure: BbanStructure): void;
private constructor(

@@ -66,3 +68,3 @@ entryType: PartType,

length: number,
validate?: (value: string, bban: string, structure: BbanStructure) => void,
generate?: GenerateValue,
) {

@@ -72,3 +74,4 @@ this.entryType = entryType;

this.length = length;
this.validateValue = validate;
this.generate = generate || this.defaultGenerator;
this.hasGenerator = !!generate;
}

@@ -104,3 +107,3 @@

characterType: CharacterType,
validate?: (value: string, bban: string, structure: BbanStructure) => void,
generate?: GenerateValue,
): BbanStructurePart {

@@ -111,3 +114,3 @@ return new BbanStructurePart(

length,
validate,
generate,
);

@@ -164,3 +167,13 @@ }

getRandom(): string {
/**
* Check to see if the string value is valid for the entry
*/
validate(value: string): boolean {
return charByCharacterRE[this.characterType].test(value);
}
/**
* Default generator to use -- just generate random sequence
*/
private defaultGenerator(bban: string, structure: BbanStructure): string {
const charChoices = charByCharacterType[this.characterType];

@@ -175,9 +188,2 @@

}
/**
* Check to see if the string value is valid for the entry
*/
validate(value: string): boolean {
return charByCharacterRE[this.characterType].test(value);
}
}

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc