@open-charging-cloud/chargy-core 0.11.3 → 0.12.1
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/CHANGELOG.md +158 -0
- package/README.md +228 -202
- package/dist/OCMF.d.ts.map +1 -1
- package/dist/OCPI.d.ts.map +1 -1
- package/dist/browser/index.js +201 -74
- package/dist/browser/index.js.map +1 -1
- package/dist/chargePoint.d.ts.map +1 -1
- package/dist/chargy.d.ts.map +1 -1
- package/dist/interfaces/CryptoUtils.d.ts.map +1 -1
- package/dist/interfaces/chargyInterfaces.d.ts +2 -1
- package/dist/interfaces/chargyInterfaces.d.ts.map +1 -1
- package/dist/interfaces/chargyLib.d.ts +2 -0
- package/dist/interfaces/chargyLib.d.ts.map +1 -1
- package/dist/interfaces/secp224k1.d.ts +2 -0
- package/dist/interfaces/secp224k1.d.ts.map +1 -1
- package/dist/node/index.js +201 -74
- package/dist/node/index.js.map +1 -1
- package/package.json +110 -106
package/dist/OCMF.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OCMF.d.ts","sourceRoot":"","sources":["../src/OCMF.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAA0B,UAAU,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAA+B,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"OCMF.d.ts","sourceRoot":"","sources":["../src/OCMF.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAA0B,UAAU,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAA+B,UAAU,CAAA;AAI1D,OAAO,KAAK,EAAE,eAAe,EAGC,MAAkB,mBAAmB,CAAA;AACnE,OAAO,OAAO,MAAkC,YAAY,CAAC;AAC7D,OAAO,KAAK,KAAK,wBAAwB,MAAO,wCAAwC,CAAA;AACxF,OAAO,KAAK,KAAK,iBAAiB,MAAc,6BAA6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,MAAM,CAAS;gBAEpB,MAAM,EAAG,MAAM;IAOd,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,UAAU,GAE1D,OAAO,CAAC,wBAAwB,CAAC,yBAAyB,GAClD,gBAAgB,CAAS,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"OCPI.d.ts","sourceRoot":"","sources":["../src/OCPI.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAA0B,UAAU,CAAA;AAG1D,OAAY,KAAK,gBAAgB,MAAe,+BAA+B,CAAA;AAC/E,OAAO,KAAK,KAAK,wBAAwB,MAAO,wCAAwC,CAAA;AACxF,OAAY,KAAK,SAAS,MAAsB,wBAAwB,CAAA;AAIxE,qBAAa,IAAI;IAGb,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,MAAM,EAAG,MAAM;IAOd,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,UAAU,GAE1D,OAAO,CAAC,wBAAwB,CAAC,yBAAyB,GAClD,gBAAgB,CAAS,oBAAoB,CAAC;CAosB/D"}
|
package/dist/browser/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { ed448ph, ed448 } from '@noble/curves/ed448.js';
|
|
|
5
5
|
import { p521, p384, p256 } from '@noble/curves/nist.js';
|
|
6
6
|
import { secp256k1 } from '@noble/curves/secp256k1.js';
|
|
7
7
|
import { ml_dsa87, ml_dsa65, ml_dsa44 } from '@noble/post-quantum/ml-dsa.js';
|
|
8
|
+
import { sha256 as sha256$1 } from '@noble/hashes/sha2.js';
|
|
8
9
|
import { fileTypeFromBuffer } from 'file-type';
|
|
9
10
|
import isURL from 'is-url-superb';
|
|
10
11
|
import jsQR from 'jsqr';
|
|
@@ -1849,7 +1850,7 @@ var IECCurves = /* @__PURE__ */ ((IECCurves2) => {
|
|
|
1849
1850
|
IECCurves2["secp256k1"] = "secp256k1";
|
|
1850
1851
|
IECCurves2["secp256r1"] = "secp256r1";
|
|
1851
1852
|
IECCurves2["secp384r1"] = "secp384r1";
|
|
1852
|
-
IECCurves2["
|
|
1853
|
+
IECCurves2["secp521r1"] = "secp521r1";
|
|
1853
1854
|
return IECCurves2;
|
|
1854
1855
|
})(IECCurves || {});
|
|
1855
1856
|
var IEncoding = /* @__PURE__ */ ((IEncoding2) => {
|
|
@@ -2310,12 +2311,45 @@ function SetHex(dv, hex, offset, reverse) {
|
|
|
2310
2311
|
}
|
|
2311
2312
|
return buf2hex(buffer);
|
|
2312
2313
|
}
|
|
2314
|
+
var meterTimeZone = "Europe/Berlin";
|
|
2315
|
+
var statesItsOwnUTCOffset = /[+-]\d{2}:?\d{2}$/;
|
|
2316
|
+
function timeZoneOffsetMinutes(instant, timeZone = meterTimeZone) {
|
|
2317
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
2318
|
+
timeZone,
|
|
2319
|
+
hour12: false,
|
|
2320
|
+
year: "numeric",
|
|
2321
|
+
month: "2-digit",
|
|
2322
|
+
day: "2-digit",
|
|
2323
|
+
hour: "2-digit",
|
|
2324
|
+
minute: "2-digit",
|
|
2325
|
+
second: "2-digit"
|
|
2326
|
+
}).formatToParts(instant);
|
|
2327
|
+
const field = (type) => Number(parts.find((part) => part.type === type)?.value ?? "0");
|
|
2328
|
+
const asUTC = Date.UTC(
|
|
2329
|
+
field("year"),
|
|
2330
|
+
field("month") - 1,
|
|
2331
|
+
field("day"),
|
|
2332
|
+
field("hour") % 24,
|
|
2333
|
+
// Intl may report midnight as hour 24
|
|
2334
|
+
field("minute"),
|
|
2335
|
+
field("second")
|
|
2336
|
+
);
|
|
2337
|
+
return (asUTC - Math.floor(instant.getTime() / 1e3) * 1e3) / 6e4;
|
|
2338
|
+
}
|
|
2339
|
+
function meterLocalTime(timestamp) {
|
|
2340
|
+
if (typeof timestamp !== "string")
|
|
2341
|
+
return { moment: timestamp, offsetMinutes: timestamp.utcOffset() };
|
|
2342
|
+
const parsed = moment.parseZone(timestamp);
|
|
2343
|
+
return {
|
|
2344
|
+
moment: parsed,
|
|
2345
|
+
offsetMinutes: statesItsOwnUTCOffset.test(timestamp.trim()) ? parsed.utcOffset() : timeZoneOffsetMinutes(new Date(parsed.valueOf()))
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2313
2348
|
function SetTimestamp(dv, timestamp, offset, addLocalOffset = true) {
|
|
2314
2349
|
if (timestamp == void 0)
|
|
2315
2350
|
throw new Error("Timestamp is missing!");
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
const unixtime = timestamp.unix() + (addLocalOffset ? 60 * timestamp.utcOffset() : 0);
|
|
2351
|
+
const meterTime = meterLocalTime(timestamp);
|
|
2352
|
+
const unixtime = meterTime.moment.unix() + (addLocalOffset ? 60 * meterTime.offsetMinutes : 0);
|
|
2319
2353
|
const bytes = getInt64Bytes(unixtime);
|
|
2320
2354
|
const buffer = new ArrayBuffer(8);
|
|
2321
2355
|
const tv = new DataView(buffer);
|
|
@@ -2328,9 +2362,8 @@ function SetTimestamp(dv, timestamp, offset, addLocalOffset = true) {
|
|
|
2328
2362
|
function SetTimestamp32(dv, timestamp, offset, addLocalOffset = true) {
|
|
2329
2363
|
if (timestamp == void 0)
|
|
2330
2364
|
throw new Error("Timestamp is missing!");
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
const unixtime = timestamp.unix() + (addLocalOffset ? 60 * timestamp.utcOffset() : 0);
|
|
2365
|
+
const meterTime = meterLocalTime(timestamp);
|
|
2366
|
+
const unixtime = meterTime.moment.unix() + (addLocalOffset ? 60 * meterTime.offsetMinutes : 0);
|
|
2334
2367
|
const bytes = getInt64Bytes(unixtime);
|
|
2335
2368
|
const buffer = new ArrayBuffer(4);
|
|
2336
2369
|
const tv = new DataView(buffer);
|
|
@@ -2740,7 +2773,10 @@ var secp224k1 = class {
|
|
|
2740
2773
|
N = BigInt("0x010000000000000000000000000001DCE8D2EC6184CAF0A971769FB1F7");
|
|
2741
2774
|
// Number of points in the field
|
|
2742
2775
|
Acurve = BigInt(0);
|
|
2743
|
-
// Defined on the elliptic curve. y^2 = x^3 + Acurve * x +
|
|
2776
|
+
// Defined on the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve
|
|
2777
|
+
Bcurve = BigInt(5);
|
|
2778
|
+
// secp224k1 has a = 0 and b = 5, and a cofactor of 1, so every
|
|
2779
|
+
// point on the curve except infinity has order N.
|
|
2744
2780
|
Gx = BigInt("0xA1455B334DF099DF30FC28A169A467E9E47075A90F7E650EB6B7A45C");
|
|
2745
2781
|
Gy = BigInt("0x7E089FED7FBA344282CAFBD6F7E319F7C0B0BD59E2CA4BDB556D61A5");
|
|
2746
2782
|
GPoint = [this.Gx, this.Gy];
|
|
@@ -2754,16 +2790,42 @@ var secp224k1 = class {
|
|
|
2754
2790
|
}
|
|
2755
2791
|
return null;
|
|
2756
2792
|
}
|
|
2793
|
+
// Returns true only for a signature that verifies against a public key which
|
|
2794
|
+
// is a valid point on the curve. Every other outcome is false, including a
|
|
2795
|
+
// point off the curve and any failure while computing, so that a caller
|
|
2796
|
+
// trying several candidate keys is never interrupted by an exception.
|
|
2757
2797
|
validate(hash, signatureR, signatureS, PublicKey) {
|
|
2758
|
-
if (signatureR
|
|
2798
|
+
if (signatureR <= this.Zero || signatureR >= this.N)
|
|
2759
2799
|
throw new Error("Invalid R");
|
|
2760
|
-
if (signatureS
|
|
2800
|
+
if (signatureS <= this.Zero || signatureS >= this.N)
|
|
2761
2801
|
throw new Error("Invalid S");
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2802
|
+
if (!this.isOnCurve(PublicKey))
|
|
2803
|
+
return false;
|
|
2804
|
+
try {
|
|
2805
|
+
const w = this.modInv(signatureS, this.N);
|
|
2806
|
+
const u1 = this.ECmultiply(this.GPoint, this.modulo(w * hash, this.N));
|
|
2807
|
+
const u2 = this.ECmultiply(PublicKey, this.modulo(w * signatureR, this.N));
|
|
2808
|
+
const validation = this.ECadd(u1, u2);
|
|
2809
|
+
const x = validation[0];
|
|
2810
|
+
if (x === void 0)
|
|
2811
|
+
return false;
|
|
2812
|
+
return this.modulo(x, this.N) === signatureR;
|
|
2813
|
+
} catch {
|
|
2814
|
+
return false;
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
// y^2 == x^3 + Acurve * x + Bcurve (mod Pcurve), with both coordinates
|
|
2818
|
+
// reduced. The point at infinity has no [x, y] representation here and is
|
|
2819
|
+
// therefore rejected along with everything else that is malformed.
|
|
2820
|
+
isOnCurve(point) {
|
|
2821
|
+
const x = point[0];
|
|
2822
|
+
const y = point[1];
|
|
2823
|
+
if (x === void 0 || y === void 0)
|
|
2824
|
+
return false;
|
|
2825
|
+
if (x < this.Zero || x >= this.Pcurve || y < this.Zero || y >= this.Pcurve) {
|
|
2826
|
+
return false;
|
|
2827
|
+
}
|
|
2828
|
+
return this.modulo(y * y, this.Pcurve) === this.modulo(x * x * x + this.Acurve * x + this.Bcurve, this.Pcurve);
|
|
2767
2829
|
}
|
|
2768
2830
|
modulo(n, m) {
|
|
2769
2831
|
return (n % m + m) % m;
|
|
@@ -2776,6 +2838,8 @@ var secp224k1 = class {
|
|
|
2776
2838
|
}
|
|
2777
2839
|
modInv(a, n = this.Pcurve) {
|
|
2778
2840
|
let lm = BigInt(1), hm = BigInt(0), high = n, low = this.modulo(a, n);
|
|
2841
|
+
if (low === this.Zero)
|
|
2842
|
+
throw new Error("Value is not invertible!");
|
|
2779
2843
|
while (low > 1) {
|
|
2780
2844
|
const ratio = high / low, nm = hm - ratio * lm, newm = high - ratio * low;
|
|
2781
2845
|
hm = lm;
|
|
@@ -2787,6 +2851,12 @@ var secp224k1 = class {
|
|
|
2787
2851
|
}
|
|
2788
2852
|
ECadd(a, b) {
|
|
2789
2853
|
if (a[0] != void 0 && b[0] != void 0 && a[1] != void 0 && b[1] != void 0) {
|
|
2854
|
+
if (this.modulo(a[0] - b[0], this.Pcurve) === this.Zero) {
|
|
2855
|
+
if (this.modulo(a[1] - b[1], this.Pcurve) === this.Zero && this.modulo(a[1], this.Pcurve) !== this.Zero) {
|
|
2856
|
+
return this.ECdouble(a);
|
|
2857
|
+
}
|
|
2858
|
+
throw new Error("EC point addition results in the point at infinity!");
|
|
2859
|
+
}
|
|
2790
2860
|
const LamAdd = this.modulo((b[1] - a[1]) * this.modInv(b[0] - a[0]), this.Pcurve);
|
|
2791
2861
|
const x = this.modulo(LamAdd * LamAdd - a[0] - b[0], this.Pcurve);
|
|
2792
2862
|
const y = this.modulo(LamAdd * (a[0] - x) - a[1], this.Pcurve);
|
|
@@ -5827,6 +5897,7 @@ async function signJSONMessage(JSONMessage, KeyPairs, options) {
|
|
|
5827
5897
|
return false;
|
|
5828
5898
|
if (JSONMessage.signatures != null && !Array.isArray(JSONMessage.signatures))
|
|
5829
5899
|
return false;
|
|
5900
|
+
let signaturesCreated = 0;
|
|
5830
5901
|
for (const KeyPair of KeyPairs) {
|
|
5831
5902
|
if (KeyPair == null || !isNobleSignatureKeyPair(KeyPair))
|
|
5832
5903
|
continue;
|
|
@@ -5858,8 +5929,6 @@ async function signJSONMessage(JSONMessage, KeyPairs, options) {
|
|
|
5858
5929
|
signatureJSON.context = bytesToBase64(options.context);
|
|
5859
5930
|
signatureJSON.contextHEX = bytesToHex(options.context);
|
|
5860
5931
|
}
|
|
5861
|
-
JSONMessage.signatures ??= [];
|
|
5862
|
-
JSONMessage.signatures.push(signatureJSON);
|
|
5863
5932
|
const signatureIsValid = suite.verify(
|
|
5864
5933
|
plainText,
|
|
5865
5934
|
signatureBytes,
|
|
@@ -5868,8 +5937,11 @@ async function signJSONMessage(JSONMessage, KeyPairs, options) {
|
|
|
5868
5937
|
);
|
|
5869
5938
|
if (!signatureIsValid)
|
|
5870
5939
|
return false;
|
|
5940
|
+
JSONMessage.signatures ??= [];
|
|
5941
|
+
JSONMessage.signatures.push(signatureJSON);
|
|
5942
|
+
signaturesCreated++;
|
|
5871
5943
|
}
|
|
5872
|
-
return
|
|
5944
|
+
return signaturesCreated > 0;
|
|
5873
5945
|
}
|
|
5874
5946
|
async function verifyJSONSignature(JSONMessage, signature, options) {
|
|
5875
5947
|
return isVerificationTrue(await verifyJSONSignatureResult(JSONMessage, signature, options));
|
|
@@ -7687,8 +7759,20 @@ var OCMF = class {
|
|
|
7687
7759
|
message: this.chargy.GetMultilanguageText("Each OCMF data set must have at least one meter reading!"),
|
|
7688
7760
|
certainty: 0
|
|
7689
7761
|
};
|
|
7762
|
+
const sessionId = "OCMF-" + bytesToHex(
|
|
7763
|
+
sha256$1(
|
|
7764
|
+
new TextEncoder().encode(
|
|
7765
|
+
OCMFJSONDocuments.map(
|
|
7766
|
+
(ocmfJSONDocument) => canonicalJSONStringify({
|
|
7767
|
+
payload: ocmfJSONDocument.payload,
|
|
7768
|
+
signature: ocmfJSONDocument.signature
|
|
7769
|
+
})
|
|
7770
|
+
).join("\n")
|
|
7771
|
+
)
|
|
7772
|
+
)
|
|
7773
|
+
);
|
|
7690
7774
|
const CTR = {
|
|
7691
|
-
"@id":
|
|
7775
|
+
"@id": sessionId,
|
|
7692
7776
|
"@context": "https://open.charging.cloud/contexts/CTR+json",
|
|
7693
7777
|
//"@context": [ "https://open.charging.cloud/contexts/CTR+json", "https://open.charging.cloud/contexts/CTR_OCMF+json" ],
|
|
7694
7778
|
"begin": "?",
|
|
@@ -7778,7 +7862,7 @@ var OCMF = class {
|
|
|
7778
7862
|
// }]
|
|
7779
7863
|
// }],
|
|
7780
7864
|
"chargingSessions": [{
|
|
7781
|
-
"@id":
|
|
7865
|
+
"@id": sessionId,
|
|
7782
7866
|
"@context": "https://open.charging.cloud/contexts/SessionSignatureFormats/OCMFv1.0+json",
|
|
7783
7867
|
"begin": "?",
|
|
7784
7868
|
"end": "?",
|
|
@@ -7824,8 +7908,26 @@ var OCMF = class {
|
|
|
7824
7908
|
if (containerEVSE !== void 0 && CTR.chargingSessions?.[0] !== void 0) {
|
|
7825
7909
|
const chargingSession = CTR.chargingSessions[0];
|
|
7826
7910
|
chargingSession.EVSEId ??= containerEVSE["@id"];
|
|
7827
|
-
if (chargingSession.EVSEId === containerEVSE["@id"])
|
|
7828
|
-
|
|
7911
|
+
if (chargingSession.EVSEId === containerEVSE["@id"]) {
|
|
7912
|
+
const containerEnergyMeter = containerEVSE.energyMeters?.[0];
|
|
7913
|
+
const resolvedEnergyMeter = containerEnergyMeter !== void 0 || meterSerial !== void 0 ? {
|
|
7914
|
+
...containerEnergyMeter,
|
|
7915
|
+
"@id": meterSerial ?? containerEnergyMeter?.["@id"] ?? "",
|
|
7916
|
+
manufacturer: {
|
|
7917
|
+
...containerEnergyMeter?.manufacturer,
|
|
7918
|
+
name: meterVendor ?? containerEnergyMeter?.manufacturer?.name
|
|
7919
|
+
},
|
|
7920
|
+
model: {
|
|
7921
|
+
...containerEnergyMeter?.model,
|
|
7922
|
+
name: meterModel ?? containerEnergyMeter?.model?.name
|
|
7923
|
+
},
|
|
7924
|
+
firmware: {
|
|
7925
|
+
...containerEnergyMeter?.firmware,
|
|
7926
|
+
version: meterFirmware ?? containerEnergyMeter?.firmware?.version
|
|
7927
|
+
}
|
|
7928
|
+
} : void 0;
|
|
7929
|
+
chargingSession.EVSE = resolvedEnergyMeter !== void 0 ? { ...containerEVSE, energyMeters: [resolvedEnergyMeter] } : containerEVSE;
|
|
7930
|
+
}
|
|
7829
7931
|
}
|
|
7830
7932
|
const resolvedConnectorId = signedConnectorId ?? containerConnector?.["@id"];
|
|
7831
7933
|
if ((resolvedConnectorId !== void 0 || signedCable !== void 0) && CTR.chargingSessions?.[0] !== void 0) {
|
|
@@ -7984,8 +8086,16 @@ var OCMF = class {
|
|
|
7984
8086
|
CTR.warnings = (CTR.warnings ?? []).concat(ContainerInfos.warnings);
|
|
7985
8087
|
CTR.status = OCMFJSONDocuments.every((ocmfJSONDocument) => ocmfJSONDocument.validationStatus === "ValidSignature" /* ValidSignature */) ? "ValidSignature" /* ValidSignature */ : "InvalidSignature" /* InvalidSignature */;
|
|
7986
8088
|
if (CTR.chargingSessions != null && CTR.chargingSessions.length > 0 && CTR.chargingSessions[0]) {
|
|
7987
|
-
|
|
7988
|
-
|
|
8089
|
+
const firstChargingSession = CTR.chargingSessions[0];
|
|
8090
|
+
const measurementTimestamps = firstChargingSession.measurements.flatMap((measurement) => measurement.values).map((value) => value.timestamp).filter((timestamp) => isMandatoryString(timestamp) && !Number.isNaN(Date.parse(timestamp))).sort((left, right) => Date.parse(left) - Date.parse(right));
|
|
8091
|
+
const firstTimestamp = measurementTimestamps[0];
|
|
8092
|
+
const lastTimestamp = measurementTimestamps[measurementTimestamps.length - 1];
|
|
8093
|
+
if (firstTimestamp !== void 0 && lastTimestamp !== void 0) {
|
|
8094
|
+
firstChargingSession.begin = firstTimestamp;
|
|
8095
|
+
firstChargingSession.end = lastTimestamp;
|
|
8096
|
+
}
|
|
8097
|
+
CTR.begin = firstChargingSession.begin;
|
|
8098
|
+
CTR.end = firstChargingSession.end;
|
|
7989
8099
|
return CTR;
|
|
7990
8100
|
}
|
|
7991
8101
|
}
|
|
@@ -8649,8 +8759,29 @@ var OCPI = class {
|
|
|
8649
8759
|
const address = asJSONObject(placeInfo?.["address"]);
|
|
8650
8760
|
const geoLat = asNumber(geoLocation?.["lat"]);
|
|
8651
8761
|
const geoLon = asNumber(geoLocation?.["lon"]);
|
|
8762
|
+
const meterInfo = asJSONObject(SomeJSON["meterInfo"]);
|
|
8763
|
+
const containerEnergyMeter = meterInfo !== void 0 ? {
|
|
8764
|
+
"@id": asString(meterInfo["meterId"]) ?? "",
|
|
8765
|
+
manufacturer: {
|
|
8766
|
+
name: asString(meterInfo["manufacturer"]),
|
|
8767
|
+
url: asString(meterInfo["manufacturerURL"])
|
|
8768
|
+
},
|
|
8769
|
+
model: {
|
|
8770
|
+
name: asString(meterInfo["model"]),
|
|
8771
|
+
url: asString(meterInfo["modelURL"])
|
|
8772
|
+
},
|
|
8773
|
+
hardware: {
|
|
8774
|
+
revision: asString(meterInfo["hardwareVersion"])
|
|
8775
|
+
},
|
|
8776
|
+
firmware: {
|
|
8777
|
+
version: asString(meterInfo["firmwareVersion"])
|
|
8778
|
+
}
|
|
8779
|
+
} : void 0;
|
|
8652
8780
|
const containerInfos = {
|
|
8653
|
-
|
|
8781
|
+
EVSEs: evseId !== void 0 ? [{
|
|
8782
|
+
"@id": evseId,
|
|
8783
|
+
energyMeters: containerEnergyMeter !== void 0 ? [containerEnergyMeter] : void 0
|
|
8784
|
+
}] : void 0,
|
|
8654
8785
|
chargingStations: [{
|
|
8655
8786
|
"@id": evseIdStr.substring(0, evseIdStr.lastIndexOf("*")),
|
|
8656
8787
|
geoLocation: geoLat !== void 0 && geoLon !== void 0 ? { lat: geoLat, lng: geoLon } : void 0,
|
|
@@ -8661,7 +8792,6 @@ var OCPI = class {
|
|
|
8661
8792
|
country: asString(address["country"]) ?? ""
|
|
8662
8793
|
} : void 0
|
|
8663
8794
|
}]
|
|
8664
|
-
//energyMeter: chargyLib.asJSONObject(SomeJSON["meterInfo"])
|
|
8665
8795
|
};
|
|
8666
8796
|
return new OCMF(this.chargy).TryToParseOCMFDocument(
|
|
8667
8797
|
firstSignedData,
|
|
@@ -11605,7 +11735,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
11605
11735
|
if (plainText !== "" && chargingSession.signature != null && chargingSession.signature !== "") {
|
|
11606
11736
|
let sha225Value = null;
|
|
11607
11737
|
let sha256Value = null;
|
|
11608
|
-
let
|
|
11738
|
+
let sha384Value = null;
|
|
11609
11739
|
let sha512Value = null;
|
|
11610
11740
|
for (const publicKey of publicKeys) {
|
|
11611
11741
|
const algorithm = typeof publicKey.algorithm === "object" ? publicKey.algorithm.name : publicKey.algorithm;
|
|
@@ -11630,9 +11760,9 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
11630
11760
|
) ? "ValidSignature" /* ValidSignature */ : "InvalidSignature" /* InvalidSignature */;
|
|
11631
11761
|
break;
|
|
11632
11762
|
case "secp384r1":
|
|
11633
|
-
|
|
11763
|
+
sha384Value = sha384Value ?? await sha384(plainText);
|
|
11634
11764
|
sessionResult = this.curve384r1.keyFromPublic(publicKey.value, "hex").verify(
|
|
11635
|
-
|
|
11765
|
+
sha384Value,
|
|
11636
11766
|
chargingSession.signature
|
|
11637
11767
|
) ? "ValidSignature" /* ValidSignature */ : "InvalidSignature" /* InvalidSignature */;
|
|
11638
11768
|
break;
|
|
@@ -11654,12 +11784,13 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
11654
11784
|
chargingSession.hashValue = sha256Value ?? "";
|
|
11655
11785
|
break;
|
|
11656
11786
|
case "secp384r1":
|
|
11657
|
-
chargingSession.hashValue =
|
|
11787
|
+
chargingSession.hashValue = sha384Value ?? "";
|
|
11658
11788
|
break;
|
|
11659
11789
|
case "secp521r1":
|
|
11660
11790
|
chargingSession.hashValue = sha512Value ?? "";
|
|
11661
11791
|
break;
|
|
11662
11792
|
}
|
|
11793
|
+
break;
|
|
11663
11794
|
}
|
|
11664
11795
|
}
|
|
11665
11796
|
}
|
|
@@ -11781,7 +11912,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
11781
11912
|
case "secp384r1":
|
|
11782
11913
|
hashInfo = "(SHA384, 384 Bits, hex)";
|
|
11783
11914
|
break;
|
|
11784
|
-
case "
|
|
11915
|
+
case "secp521r1":
|
|
11785
11916
|
hashInfo = "(SHA512, 512 Bits, hex)";
|
|
11786
11917
|
break;
|
|
11787
11918
|
}
|
|
@@ -12177,8 +12308,14 @@ var validationRules_default = {
|
|
|
12177
12308
|
function isPdfAttachment(value) {
|
|
12178
12309
|
if (!isMandatoryJSONObject(value))
|
|
12179
12310
|
return false;
|
|
12180
|
-
return typeof value["filename"] === "string"
|
|
12311
|
+
return typeof value["filename"] === "string";
|
|
12181
12312
|
}
|
|
12313
|
+
var pdfAttachmentTypes = [
|
|
12314
|
+
{ extension: ".chargy", type: "application/chargy", info: "A CHARGY file extracted from a PDF/A-3 or newer attachment" },
|
|
12315
|
+
{ extension: ".xml", type: "application/xml", info: "A XML file extracted from a PDF/A-3 or newer attachment" },
|
|
12316
|
+
{ extension: ".json", type: "application/json", info: "A JSON file extracted from a PDF/A-3 or newer attachment" },
|
|
12317
|
+
{ extension: ".csv", type: "text/csv", info: "A CSV file extracted from a PDF/A-3 or newer attachment" }
|
|
12318
|
+
];
|
|
12182
12319
|
var Chargy = class {
|
|
12183
12320
|
//#region Data
|
|
12184
12321
|
i18n;
|
|
@@ -12277,7 +12414,9 @@ var Chargy = class {
|
|
|
12277
12414
|
case "1.3.101.113":
|
|
12278
12415
|
KeyType = "EdDSA";
|
|
12279
12416
|
break;
|
|
12417
|
+
case "2.16.840.1.101.3.4.3.17":
|
|
12280
12418
|
case "2.16.840.1.101.3.4.3.18":
|
|
12419
|
+
case "2.16.840.1.101.3.4.3.19":
|
|
12281
12420
|
KeyType = "ML-DSA";
|
|
12282
12421
|
break;
|
|
12283
12422
|
}
|
|
@@ -12290,9 +12429,15 @@ var Chargy = class {
|
|
|
12290
12429
|
case "1.3.101.113":
|
|
12291
12430
|
Algorithm = "Ed448";
|
|
12292
12431
|
break;
|
|
12432
|
+
case "2.16.840.1.101.3.4.3.17":
|
|
12433
|
+
Algorithm = "ML-DSA-44";
|
|
12434
|
+
break;
|
|
12293
12435
|
case "2.16.840.1.101.3.4.3.18":
|
|
12294
12436
|
Algorithm = "ML-DSA-65";
|
|
12295
12437
|
break;
|
|
12438
|
+
case "2.16.840.1.101.3.4.3.19":
|
|
12439
|
+
Algorithm = "ML-DSA-87";
|
|
12440
|
+
break;
|
|
12296
12441
|
// Koblitz 224-bit curve
|
|
12297
12442
|
case "1.3.132.0.32":
|
|
12298
12443
|
Algorithm = "secp224k1";
|
|
@@ -12311,7 +12456,7 @@ var Chargy = class {
|
|
|
12311
12456
|
break;
|
|
12312
12457
|
}
|
|
12313
12458
|
const publicKeyData = new Uint8Array(publicKeyDER.publicKey.data);
|
|
12314
|
-
const expectedLength = Algorithm === "Ed25519" ? 32 : Algorithm === "Ed448" ? 57 : Algorithm === "ML-DSA-65" ? 1952 : void 0;
|
|
12459
|
+
const expectedLength = Algorithm === "Ed25519" ? 32 : Algorithm === "Ed448" ? 57 : Algorithm === "ML-DSA-44" ? 1312 : Algorithm === "ML-DSA-65" ? 1952 : Algorithm === "ML-DSA-87" ? 2592 : void 0;
|
|
12315
12460
|
if (publicKeyDER.publicKey.unused !== void 0 && publicKeyDER.publicKey.unused !== 0)
|
|
12316
12461
|
throw new Error("The SubjectPublicKeyInfo public key has unused bits!");
|
|
12317
12462
|
if (expectedLength !== void 0 && publicKeyData.length !== expectedLength)
|
|
@@ -12358,7 +12503,7 @@ var Chargy = class {
|
|
|
12358
12503
|
publicKeyDER
|
|
12359
12504
|
).publicKeys[0];
|
|
12360
12505
|
const algorithm = typeof publicKey?.algorithm === "string" ? publicKey.algorithm : publicKey?.algorithm.name;
|
|
12361
|
-
return algorithm === "Ed25519" || algorithm === "Ed448" || algorithm
|
|
12506
|
+
return algorithm === "Ed25519" || algorithm === "Ed448" || algorithm?.startsWith("ML-DSA-") === true ? publicKey?.value : buf2hex(publicKeyDER);
|
|
12362
12507
|
} catch {
|
|
12363
12508
|
return void 0;
|
|
12364
12509
|
}
|
|
@@ -12371,7 +12516,7 @@ var Chargy = class {
|
|
|
12371
12516
|
publicKeyDER
|
|
12372
12517
|
).publicKeys[0];
|
|
12373
12518
|
const algorithm = typeof publicKey?.algorithm === "string" ? publicKey.algorithm : publicKey?.algorithm.name;
|
|
12374
|
-
return algorithm === "Ed25519" || algorithm === "Ed448" || algorithm
|
|
12519
|
+
return algorithm === "Ed25519" || algorithm === "Ed448" || algorithm?.startsWith("ML-DSA-") === true ? publicKey?.value : buf2hex(publicKeyDER);
|
|
12375
12520
|
} catch {
|
|
12376
12521
|
return void 0;
|
|
12377
12522
|
}
|
|
@@ -12947,45 +13092,27 @@ var Chargy = class {
|
|
|
12947
13092
|
const pdfDocument = fileInfo.data ? await pdfjsLib.getDocument({ data: fileInfo.data }).promise : fileInfo.path != null && fileInfo.path.length > 0 ? await pdfjsLib.getDocument({ url: fileInfo.path }).promise : null;
|
|
12948
13093
|
if (pdfDocument !== null) {
|
|
12949
13094
|
try {
|
|
12950
|
-
const
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
12957
|
-
|
|
12958
|
-
|
|
12959
|
-
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
12968
|
-
|
|
12969
|
-
data: attachment.content,
|
|
12970
|
-
info: "A XML file extracted from a PDF/A-3 or newer attachment"
|
|
12971
|
-
});
|
|
12972
|
-
else if (attachment.filename.endsWith(".json"))
|
|
12973
|
-
expandedFiles.push({
|
|
12974
|
-
name: attachment.filename,
|
|
12975
|
-
path: FileInfos[0]?.path,
|
|
12976
|
-
type: "application/json",
|
|
12977
|
-
data: attachment.content,
|
|
12978
|
-
info: "A JSON file extracted from a PDF/A-3 or newer attachment"
|
|
12979
|
-
});
|
|
12980
|
-
else if (attachment.filename.endsWith(".csv"))
|
|
12981
|
-
expandedFiles.push({
|
|
12982
|
-
name: attachment.filename,
|
|
12983
|
-
path: FileInfos[0]?.path,
|
|
12984
|
-
type: "text/csv",
|
|
12985
|
-
data: attachment.content,
|
|
12986
|
-
info: "A CSV file extracted from a PDF/A-3 or newer attachment"
|
|
12987
|
-
});
|
|
13095
|
+
const attachments = await pdfDocument.getAttachments();
|
|
13096
|
+
for (const [attachmentId, attachmentUnknown] of attachments ?? []) {
|
|
13097
|
+
if (!isPdfAttachment(attachmentUnknown))
|
|
13098
|
+
continue;
|
|
13099
|
+
const attachment = attachmentUnknown;
|
|
13100
|
+
const attachmentType = pdfAttachmentTypes.find(
|
|
13101
|
+
(candidate) => attachment.filename.endsWith(candidate.extension)
|
|
13102
|
+
);
|
|
13103
|
+
if (attachmentType === void 0)
|
|
13104
|
+
continue;
|
|
13105
|
+
const content = attachment.content ?? await pdfDocument.getAttachmentContent(attachmentId);
|
|
13106
|
+
if (content == null)
|
|
13107
|
+
continue;
|
|
13108
|
+
expandedFiles.push({
|
|
13109
|
+
name: attachment.filename,
|
|
13110
|
+
path: FileInfos[0]?.path,
|
|
13111
|
+
type: attachmentType.type,
|
|
13112
|
+
data: content,
|
|
13113
|
+
info: attachmentType.info
|
|
12988
13114
|
});
|
|
13115
|
+
}
|
|
12989
13116
|
} catch (error) {
|
|
12990
13117
|
console.error(`Error extracting PDF/A-3 attachments: ${String(error)}`);
|
|
12991
13118
|
}
|
|
@@ -13596,6 +13723,6 @@ buffer/index.js:
|
|
|
13596
13723
|
*)
|
|
13597
13724
|
*/
|
|
13598
13725
|
|
|
13599
|
-
export { ACrypt, Alfen, AlfenCrypt01, BSMCrypt01, CanonicalJSONError, ChargeIT, ChargePoint, ChargePointCrypt01, IChargeTransparencyLiveLink_exports as ChargeTransparencyLiveLink, ChargeTransparencyLiveLinkContext, IChargeTransparencyRecord_exports as ChargeTransparencyRecord, Chargy, chargyInterfaces_exports as ChargyInterfaces, Clone, CloneCTR, ConcatenateBuffers, CreateDiv, CreateDiv2, CreateError, CreateWarning, CryptoAlgorithms, CryptoHashAlgorithms, DayOfWeek, DisplayPrefixes, EDL40, EDL40Crypt01, EDL40ValidationError, EDL40_OBIS, EDL40_SESSION_CONTEXT, EDL40_SIGNATURE_CONTEXT, EMHCrypt01, ErrorLevel, GDFCrypt01, IECCurves, IEncoding, InformationRelevance, InformationRelevanceToString, IsAChargeTransparencyLiveLink, IsAChargeTransparencyRecord, IsAPublicKey, IsAPublicKeyLookup, IsAPublicKeySignature, IsAPublicKeyXY, IsASessionCryptoResult, IsAURL, IsNullOrEmpty, IsValidURL, JSONSignatureVerificationStatus, MENNEKES_EDL40_OBIS, MENNEKES_EDL40_XMLNS, Mennekes, MennekesCrypt01, OBIS2Hex, OBIS2MeasurementName, OBIS_RegExpr, OCMF, OCMFBonnTariffParseError, OCMFTransactionTypes, OCMF_SIGNATURE_ALGORITHMS, OCMFv1_x, OCPI, OIDInfo, PCDF, PCDFCrypt01, PCDFParseError, PCDFValidationError, PCDF_FIELD_ORDER, PCDF_PREFIX, PTB, ParseJSON_LD, PublicKeyFormats, IPublicKeyInfo_exports as PublicKeyInfo, SAFEXML, SessionVerificationResult, SetHex, SetInt8, SetText, SetText_withLength, SetTimestamp, SetTimestamp32, SetUInt32, SetUInt32_withCode, SetUInt64, SetUInt64D, SignMessage, SignatureFormats, IURL_exports as SimpleURL, TimeStatusTypes, URLContext, UTC2human, VerificationResult, VerifyJSONMessageSignatures, WarningLevel, WhenNullOrEmpty, XMLContainer, asJSONArray, asJSONObject, asNumber, asString, base64ToBytes, buf2hex, buildEDL40Signature, buildIsaSignature, buildMennekesSignatureData, bytesToBase64, bytesToHex, canParseEDL40, canonicalJSONBytes, canonicalJSONStringify, cleanHex, closeFullscreen, createCompatibleCurve, createHexString, createLegacyP192Curve, dateToMennekesLocalEpochSeconds, decodeSmlMessages, extractMennekesChargingProcesses, findEntryByObis, findGetListRes, firstKey, firstValue, generateSignatureKeyPair, getArrayElement, getArrayLikeElement, getDirectChildByLocalName, getDirectChildrenByLocalName, getElementsByLocalName, getFirstArrayElement, getInt16Bytes, getInt32Bytes, getInt64Bytes, getInt8Bytes, getLastArrayElement, getOCMFSignatureDisplay, getSignatureSuite, getTrimmedTextContent, hashFile, hex2bin, hex32, hexToArrayBuffer, hexToBytes, intFromBytes, isEncodedValue, isGeoLocation, isI18NString, isICryptoResult, isIFileInfo, isISessionCryptoResult1, isISessionCryptoResult2, isJSONLDObject, isMandatoryArrayOfStrings, isMandatoryBoolean, isMandatoryDecimal, isMandatoryJSONArray, isMandatoryJSONObject, isMandatoryNumber, isMandatoryString, isMandatoryURL, isOIDInfo, isObject, isOptionalArrayOfStrings, isOptionalDecimal, isOptionalJSONArray, isOptionalJSONArrayError, isOptionalJSONArrayOk, isOptionalJSONObject, isOptionalNumber, isOptionalString, isOptionalStringArray, isOptionalStringOrOIDInfo, isOptionalURL, isPCDFText, isPublicKeySubject, isString, isStringArray, isStringOrOIDInfo, isStringOrStringArray, isaListNameContext, jsonPrettyPrinter, measurementName2human, normalizePCDFPublicKeyHex, normalizeXMLText, ocmfBonnTariffToChargingTariff, openFullscreen, pad, parseAndVerifyJSONSignatures, parseDescription, parseEDL40, parseHexString, parseMennekesXMLDocument, parseNumber, parseOBIS, parseOCMFBonnTariffText, parsePCDFDocument, parsePCDFPublicKey, parsePCDFSignature, parseSmlTime, parseUTC, readQRCodeTextFromImage, readQRCodeTextFromImageData, readTLV, secp224k1, setUILocale, sha256, sha256____, sha384, sha384____, sha512, sha512____, signJSONMessage, signMessage, stripPCDFControlCharacters, stripTransport, time2human, toArrayBuffer, toSessionVerificationResults, toUint8Array, transformEDL40Status, tryParseOCMFBonnTariffText, unquotePCDFText, validatePCDFFields, verifyEDL40Document, verifyJSONMessageSignatureResults, verifyJSONMessageSignatures, verifyJSONSignature, verifyJSONSignatureResult, verifyPCDFDocument };
|
|
13726
|
+
export { ACrypt, Alfen, AlfenCrypt01, BSMCrypt01, CanonicalJSONError, ChargeIT, ChargePoint, ChargePointCrypt01, IChargeTransparencyLiveLink_exports as ChargeTransparencyLiveLink, ChargeTransparencyLiveLinkContext, IChargeTransparencyRecord_exports as ChargeTransparencyRecord, Chargy, chargyInterfaces_exports as ChargyInterfaces, Clone, CloneCTR, ConcatenateBuffers, CreateDiv, CreateDiv2, CreateError, CreateWarning, CryptoAlgorithms, CryptoHashAlgorithms, DayOfWeek, DisplayPrefixes, EDL40, EDL40Crypt01, EDL40ValidationError, EDL40_OBIS, EDL40_SESSION_CONTEXT, EDL40_SIGNATURE_CONTEXT, EMHCrypt01, ErrorLevel, GDFCrypt01, IECCurves, IEncoding, InformationRelevance, InformationRelevanceToString, IsAChargeTransparencyLiveLink, IsAChargeTransparencyRecord, IsAPublicKey, IsAPublicKeyLookup, IsAPublicKeySignature, IsAPublicKeyXY, IsASessionCryptoResult, IsAURL, IsNullOrEmpty, IsValidURL, JSONSignatureVerificationStatus, MENNEKES_EDL40_OBIS, MENNEKES_EDL40_XMLNS, Mennekes, MennekesCrypt01, OBIS2Hex, OBIS2MeasurementName, OBIS_RegExpr, OCMF, OCMFBonnTariffParseError, OCMFTransactionTypes, OCMF_SIGNATURE_ALGORITHMS, OCMFv1_x, OCPI, OIDInfo, PCDF, PCDFCrypt01, PCDFParseError, PCDFValidationError, PCDF_FIELD_ORDER, PCDF_PREFIX, PTB, ParseJSON_LD, PublicKeyFormats, IPublicKeyInfo_exports as PublicKeyInfo, SAFEXML, SessionVerificationResult, SetHex, SetInt8, SetText, SetText_withLength, SetTimestamp, SetTimestamp32, SetUInt32, SetUInt32_withCode, SetUInt64, SetUInt64D, SignMessage, SignatureFormats, IURL_exports as SimpleURL, TimeStatusTypes, URLContext, UTC2human, VerificationResult, VerifyJSONMessageSignatures, WarningLevel, WhenNullOrEmpty, XMLContainer, asJSONArray, asJSONObject, asNumber, asString, base64ToBytes, buf2hex, buildEDL40Signature, buildIsaSignature, buildMennekesSignatureData, bytesToBase64, bytesToHex, canParseEDL40, canonicalJSONBytes, canonicalJSONStringify, cleanHex, closeFullscreen, createCompatibleCurve, createHexString, createLegacyP192Curve, dateToMennekesLocalEpochSeconds, decodeSmlMessages, extractMennekesChargingProcesses, findEntryByObis, findGetListRes, firstKey, firstValue, generateSignatureKeyPair, getArrayElement, getArrayLikeElement, getDirectChildByLocalName, getDirectChildrenByLocalName, getElementsByLocalName, getFirstArrayElement, getInt16Bytes, getInt32Bytes, getInt64Bytes, getInt8Bytes, getLastArrayElement, getOCMFSignatureDisplay, getSignatureSuite, getTrimmedTextContent, hashFile, hex2bin, hex32, hexToArrayBuffer, hexToBytes, intFromBytes, isEncodedValue, isGeoLocation, isI18NString, isICryptoResult, isIFileInfo, isISessionCryptoResult1, isISessionCryptoResult2, isJSONLDObject, isMandatoryArrayOfStrings, isMandatoryBoolean, isMandatoryDecimal, isMandatoryJSONArray, isMandatoryJSONObject, isMandatoryNumber, isMandatoryString, isMandatoryURL, isOIDInfo, isObject, isOptionalArrayOfStrings, isOptionalDecimal, isOptionalJSONArray, isOptionalJSONArrayError, isOptionalJSONArrayOk, isOptionalJSONObject, isOptionalNumber, isOptionalString, isOptionalStringArray, isOptionalStringOrOIDInfo, isOptionalURL, isPCDFText, isPublicKeySubject, isString, isStringArray, isStringOrOIDInfo, isStringOrStringArray, isaListNameContext, jsonPrettyPrinter, measurementName2human, meterTimeZone, normalizePCDFPublicKeyHex, normalizeXMLText, ocmfBonnTariffToChargingTariff, openFullscreen, pad, parseAndVerifyJSONSignatures, parseDescription, parseEDL40, parseHexString, parseMennekesXMLDocument, parseNumber, parseOBIS, parseOCMFBonnTariffText, parsePCDFDocument, parsePCDFPublicKey, parsePCDFSignature, parseSmlTime, parseUTC, readQRCodeTextFromImage, readQRCodeTextFromImageData, readTLV, secp224k1, setUILocale, sha256, sha256____, sha384, sha384____, sha512, sha512____, signJSONMessage, signMessage, stripPCDFControlCharacters, stripTransport, time2human, timeZoneOffsetMinutes, toArrayBuffer, toSessionVerificationResults, toUint8Array, transformEDL40Status, tryParseOCMFBonnTariffText, unquotePCDFText, validatePCDFFields, verifyEDL40Document, verifyJSONMessageSignatureResults, verifyJSONMessageSignatures, verifyJSONSignature, verifyJSONSignatureResult, verifyPCDFDocument };
|
|
13600
13727
|
//# sourceMappingURL=index.js.map
|
|
13601
13728
|
//# sourceMappingURL=index.js.map
|