@open-charging-cloud/chargy-core 0.11.2 → 0.12.0
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 +8 -0
- package/dist/OCMF.d.ts.map +1 -1
- package/dist/OCPI.d.ts.map +1 -1
- package/dist/browser/index.js +235 -76
- 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 +235 -76
- package/dist/node/index.js.map +1 -1
- package/package.json +108 -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,K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,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;
|
|
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));
|
|
@@ -7292,6 +7364,33 @@ function decodeRawOCMFBytes(value, encoding) {
|
|
|
7292
7364
|
return new Uint8Array(Buffer.from(value, "base64"));
|
|
7293
7365
|
throw new TypeError(`Unsupported raw key encoding '${encoding ?? ""}'.`);
|
|
7294
7366
|
}
|
|
7367
|
+
function getOCMFSignatureDisplay(signature, signatureBytes, signatureRS) {
|
|
7368
|
+
const encodedSignature = signatureBytes !== void 0 && signatureBytes.length > 0 ? signatureBytes : decodeRawOCMFBytes(signature.SD, signature.SE);
|
|
7369
|
+
const rawHex = buf2hex(encodedSignature).toUpperCase();
|
|
7370
|
+
if (signature.SA === "EdDSA-Ed25519" || signature.SA === "EdDSA-Ed448") {
|
|
7371
|
+
const componentHexLength = signature.SA === "EdDSA-Ed25519" ? 64 : 114;
|
|
7372
|
+
if (rawHex.length !== componentHexLength * 2)
|
|
7373
|
+
return { format: "RS, hex", valueLabel: "raw", value: rawHex };
|
|
7374
|
+
return {
|
|
7375
|
+
format: "RS, hex",
|
|
7376
|
+
valueLabel: "raw",
|
|
7377
|
+
value: rawHex,
|
|
7378
|
+
r: rawHex.substring(0, componentHexLength),
|
|
7379
|
+
s: rawHex.substring(componentHexLength)
|
|
7380
|
+
};
|
|
7381
|
+
}
|
|
7382
|
+
if (signature.SA === "ML-DSA-44" || signature.SA === "ML-DSA-65" || signature.SA === "ML-DSA-87")
|
|
7383
|
+
return { format: "raw, hex", valueLabel: "raw", value: rawHex };
|
|
7384
|
+
return {
|
|
7385
|
+
format: "rs, hex",
|
|
7386
|
+
valueLabel: "der",
|
|
7387
|
+
value: rawHex,
|
|
7388
|
+
...signatureRS === void 0 ? {} : {
|
|
7389
|
+
r: signatureRS.r.toLowerCase().padStart(56, "0"),
|
|
7390
|
+
s: signatureRS.s.toLowerCase().padStart(56, "0")
|
|
7391
|
+
}
|
|
7392
|
+
};
|
|
7393
|
+
}
|
|
7295
7394
|
var OCMFv1_x = class extends ACrypt {
|
|
7296
7395
|
curve;
|
|
7297
7396
|
constructor(chargy) {
|
|
@@ -7523,10 +7622,15 @@ var OCMFv1_x = class extends ACrypt {
|
|
|
7523
7622
|
}
|
|
7524
7623
|
}
|
|
7525
7624
|
if (measurementValue.ocmfDocument.signature.SD) {
|
|
7625
|
+
const signatureDisplay = getOCMFSignatureDisplay(
|
|
7626
|
+
measurementValue.ocmfDocument.signature,
|
|
7627
|
+
measurementValue.ocmfDocument.signatureBytes,
|
|
7628
|
+
measurementValue.ocmfDocument.signatureRS
|
|
7629
|
+
);
|
|
7526
7630
|
if (SignatureExpectedDiv.parentElement) {
|
|
7527
|
-
getArrayLikeElement(SignatureExpectedDiv.parentElement.children, 0, "Missing expected signature header").innerHTML = this.chargy.GetLocalizedMessage("Expected signature") + " (
|
|
7631
|
+
getArrayLikeElement(SignatureExpectedDiv.parentElement.children, 0, "Missing expected signature header").innerHTML = this.chargy.GetLocalizedMessage("Expected signature") + " (" + signatureDisplay.format + ")";
|
|
7528
7632
|
}
|
|
7529
|
-
SignatureExpectedDiv.innerHTML = "
|
|
7633
|
+
SignatureExpectedDiv.innerHTML = signatureDisplay.valueLabel + ": " + (signatureDisplay.value.match(/.{1,8}/g)?.join(" ") ?? "-") + (signatureDisplay.r === void 0 || signatureDisplay.s === void 0 ? "" : "<br /><br />R: " + (signatureDisplay.r.match(/.{1,8}/g)?.join(" ") ?? "-") + "<br />S: " + (signatureDisplay.s.match(/.{1,8}/g)?.join(" ") ?? "-"));
|
|
7530
7634
|
}
|
|
7531
7635
|
if (measurementValue.measurement.chargingSession.verificationResult) {
|
|
7532
7636
|
switch (measurementValue.measurement.chargingSession.verificationResult.status) {
|
|
@@ -7655,8 +7759,20 @@ var OCMF = class {
|
|
|
7655
7759
|
message: this.chargy.GetMultilanguageText("Each OCMF data set must have at least one meter reading!"),
|
|
7656
7760
|
certainty: 0
|
|
7657
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
|
+
);
|
|
7658
7774
|
const CTR = {
|
|
7659
|
-
"@id":
|
|
7775
|
+
"@id": sessionId,
|
|
7660
7776
|
"@context": "https://open.charging.cloud/contexts/CTR+json",
|
|
7661
7777
|
//"@context": [ "https://open.charging.cloud/contexts/CTR+json", "https://open.charging.cloud/contexts/CTR_OCMF+json" ],
|
|
7662
7778
|
"begin": "?",
|
|
@@ -7746,7 +7862,7 @@ var OCMF = class {
|
|
|
7746
7862
|
// }]
|
|
7747
7863
|
// }],
|
|
7748
7864
|
"chargingSessions": [{
|
|
7749
|
-
"@id":
|
|
7865
|
+
"@id": sessionId,
|
|
7750
7866
|
"@context": "https://open.charging.cloud/contexts/SessionSignatureFormats/OCMFv1.0+json",
|
|
7751
7867
|
"begin": "?",
|
|
7752
7868
|
"end": "?",
|
|
@@ -7792,8 +7908,26 @@ var OCMF = class {
|
|
|
7792
7908
|
if (containerEVSE !== void 0 && CTR.chargingSessions?.[0] !== void 0) {
|
|
7793
7909
|
const chargingSession = CTR.chargingSessions[0];
|
|
7794
7910
|
chargingSession.EVSEId ??= containerEVSE["@id"];
|
|
7795
|
-
if (chargingSession.EVSEId === containerEVSE["@id"])
|
|
7796
|
-
|
|
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
|
+
}
|
|
7797
7931
|
}
|
|
7798
7932
|
const resolvedConnectorId = signedConnectorId ?? containerConnector?.["@id"];
|
|
7799
7933
|
if ((resolvedConnectorId !== void 0 || signedCable !== void 0) && CTR.chargingSessions?.[0] !== void 0) {
|
|
@@ -7952,8 +8086,16 @@ var OCMF = class {
|
|
|
7952
8086
|
CTR.warnings = (CTR.warnings ?? []).concat(ContainerInfos.warnings);
|
|
7953
8087
|
CTR.status = OCMFJSONDocuments.every((ocmfJSONDocument) => ocmfJSONDocument.validationStatus === "ValidSignature" /* ValidSignature */) ? "ValidSignature" /* ValidSignature */ : "InvalidSignature" /* InvalidSignature */;
|
|
7954
8088
|
if (CTR.chargingSessions != null && CTR.chargingSessions.length > 0 && CTR.chargingSessions[0]) {
|
|
7955
|
-
|
|
7956
|
-
|
|
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;
|
|
7957
8099
|
return CTR;
|
|
7958
8100
|
}
|
|
7959
8101
|
}
|
|
@@ -8617,8 +8759,29 @@ var OCPI = class {
|
|
|
8617
8759
|
const address = asJSONObject(placeInfo?.["address"]);
|
|
8618
8760
|
const geoLat = asNumber(geoLocation?.["lat"]);
|
|
8619
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;
|
|
8620
8780
|
const containerInfos = {
|
|
8621
|
-
|
|
8781
|
+
EVSEs: evseId !== void 0 ? [{
|
|
8782
|
+
"@id": evseId,
|
|
8783
|
+
energyMeters: containerEnergyMeter !== void 0 ? [containerEnergyMeter] : void 0
|
|
8784
|
+
}] : void 0,
|
|
8622
8785
|
chargingStations: [{
|
|
8623
8786
|
"@id": evseIdStr.substring(0, evseIdStr.lastIndexOf("*")),
|
|
8624
8787
|
geoLocation: geoLat !== void 0 && geoLon !== void 0 ? { lat: geoLat, lng: geoLon } : void 0,
|
|
@@ -8629,7 +8792,6 @@ var OCPI = class {
|
|
|
8629
8792
|
country: asString(address["country"]) ?? ""
|
|
8630
8793
|
} : void 0
|
|
8631
8794
|
}]
|
|
8632
|
-
//energyMeter: chargyLib.asJSONObject(SomeJSON["meterInfo"])
|
|
8633
8795
|
};
|
|
8634
8796
|
return new OCMF(this.chargy).TryToParseOCMFDocument(
|
|
8635
8797
|
firstSignedData,
|
|
@@ -11573,7 +11735,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
11573
11735
|
if (plainText !== "" && chargingSession.signature != null && chargingSession.signature !== "") {
|
|
11574
11736
|
let sha225Value = null;
|
|
11575
11737
|
let sha256Value = null;
|
|
11576
|
-
let
|
|
11738
|
+
let sha384Value = null;
|
|
11577
11739
|
let sha512Value = null;
|
|
11578
11740
|
for (const publicKey of publicKeys) {
|
|
11579
11741
|
const algorithm = typeof publicKey.algorithm === "object" ? publicKey.algorithm.name : publicKey.algorithm;
|
|
@@ -11598,9 +11760,9 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
11598
11760
|
) ? "ValidSignature" /* ValidSignature */ : "InvalidSignature" /* InvalidSignature */;
|
|
11599
11761
|
break;
|
|
11600
11762
|
case "secp384r1":
|
|
11601
|
-
|
|
11763
|
+
sha384Value = sha384Value ?? await sha384(plainText);
|
|
11602
11764
|
sessionResult = this.curve384r1.keyFromPublic(publicKey.value, "hex").verify(
|
|
11603
|
-
|
|
11765
|
+
sha384Value,
|
|
11604
11766
|
chargingSession.signature
|
|
11605
11767
|
) ? "ValidSignature" /* ValidSignature */ : "InvalidSignature" /* InvalidSignature */;
|
|
11606
11768
|
break;
|
|
@@ -11622,12 +11784,13 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
11622
11784
|
chargingSession.hashValue = sha256Value ?? "";
|
|
11623
11785
|
break;
|
|
11624
11786
|
case "secp384r1":
|
|
11625
|
-
chargingSession.hashValue =
|
|
11787
|
+
chargingSession.hashValue = sha384Value ?? "";
|
|
11626
11788
|
break;
|
|
11627
11789
|
case "secp521r1":
|
|
11628
11790
|
chargingSession.hashValue = sha512Value ?? "";
|
|
11629
11791
|
break;
|
|
11630
11792
|
}
|
|
11793
|
+
break;
|
|
11631
11794
|
}
|
|
11632
11795
|
}
|
|
11633
11796
|
}
|
|
@@ -11749,7 +11912,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
11749
11912
|
case "secp384r1":
|
|
11750
11913
|
hashInfo = "(SHA384, 384 Bits, hex)";
|
|
11751
11914
|
break;
|
|
11752
|
-
case "
|
|
11915
|
+
case "secp521r1":
|
|
11753
11916
|
hashInfo = "(SHA512, 512 Bits, hex)";
|
|
11754
11917
|
break;
|
|
11755
11918
|
}
|
|
@@ -12145,8 +12308,14 @@ var validationRules_default = {
|
|
|
12145
12308
|
function isPdfAttachment(value) {
|
|
12146
12309
|
if (!isMandatoryJSONObject(value))
|
|
12147
12310
|
return false;
|
|
12148
|
-
return typeof value["filename"] === "string"
|
|
12311
|
+
return typeof value["filename"] === "string";
|
|
12149
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
|
+
];
|
|
12150
12319
|
var Chargy = class {
|
|
12151
12320
|
//#region Data
|
|
12152
12321
|
i18n;
|
|
@@ -12245,7 +12414,9 @@ var Chargy = class {
|
|
|
12245
12414
|
case "1.3.101.113":
|
|
12246
12415
|
KeyType = "EdDSA";
|
|
12247
12416
|
break;
|
|
12417
|
+
case "2.16.840.1.101.3.4.3.17":
|
|
12248
12418
|
case "2.16.840.1.101.3.4.3.18":
|
|
12419
|
+
case "2.16.840.1.101.3.4.3.19":
|
|
12249
12420
|
KeyType = "ML-DSA";
|
|
12250
12421
|
break;
|
|
12251
12422
|
}
|
|
@@ -12258,9 +12429,15 @@ var Chargy = class {
|
|
|
12258
12429
|
case "1.3.101.113":
|
|
12259
12430
|
Algorithm = "Ed448";
|
|
12260
12431
|
break;
|
|
12432
|
+
case "2.16.840.1.101.3.4.3.17":
|
|
12433
|
+
Algorithm = "ML-DSA-44";
|
|
12434
|
+
break;
|
|
12261
12435
|
case "2.16.840.1.101.3.4.3.18":
|
|
12262
12436
|
Algorithm = "ML-DSA-65";
|
|
12263
12437
|
break;
|
|
12438
|
+
case "2.16.840.1.101.3.4.3.19":
|
|
12439
|
+
Algorithm = "ML-DSA-87";
|
|
12440
|
+
break;
|
|
12264
12441
|
// Koblitz 224-bit curve
|
|
12265
12442
|
case "1.3.132.0.32":
|
|
12266
12443
|
Algorithm = "secp224k1";
|
|
@@ -12279,7 +12456,7 @@ var Chargy = class {
|
|
|
12279
12456
|
break;
|
|
12280
12457
|
}
|
|
12281
12458
|
const publicKeyData = new Uint8Array(publicKeyDER.publicKey.data);
|
|
12282
|
-
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;
|
|
12283
12460
|
if (publicKeyDER.publicKey.unused !== void 0 && publicKeyDER.publicKey.unused !== 0)
|
|
12284
12461
|
throw new Error("The SubjectPublicKeyInfo public key has unused bits!");
|
|
12285
12462
|
if (expectedLength !== void 0 && publicKeyData.length !== expectedLength)
|
|
@@ -12326,7 +12503,7 @@ var Chargy = class {
|
|
|
12326
12503
|
publicKeyDER
|
|
12327
12504
|
).publicKeys[0];
|
|
12328
12505
|
const algorithm = typeof publicKey?.algorithm === "string" ? publicKey.algorithm : publicKey?.algorithm.name;
|
|
12329
|
-
return algorithm === "Ed25519" || algorithm === "Ed448" || algorithm
|
|
12506
|
+
return algorithm === "Ed25519" || algorithm === "Ed448" || algorithm?.startsWith("ML-DSA-") === true ? publicKey?.value : buf2hex(publicKeyDER);
|
|
12330
12507
|
} catch {
|
|
12331
12508
|
return void 0;
|
|
12332
12509
|
}
|
|
@@ -12339,7 +12516,7 @@ var Chargy = class {
|
|
|
12339
12516
|
publicKeyDER
|
|
12340
12517
|
).publicKeys[0];
|
|
12341
12518
|
const algorithm = typeof publicKey?.algorithm === "string" ? publicKey.algorithm : publicKey?.algorithm.name;
|
|
12342
|
-
return algorithm === "Ed25519" || algorithm === "Ed448" || algorithm
|
|
12519
|
+
return algorithm === "Ed25519" || algorithm === "Ed448" || algorithm?.startsWith("ML-DSA-") === true ? publicKey?.value : buf2hex(publicKeyDER);
|
|
12343
12520
|
} catch {
|
|
12344
12521
|
return void 0;
|
|
12345
12522
|
}
|
|
@@ -12915,45 +13092,27 @@ var Chargy = class {
|
|
|
12915
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;
|
|
12916
13093
|
if (pdfDocument !== null) {
|
|
12917
13094
|
try {
|
|
12918
|
-
const
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
|
|
12924
|
-
|
|
12925
|
-
|
|
12926
|
-
|
|
12927
|
-
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
|
|
12937
|
-
data: attachment.content,
|
|
12938
|
-
info: "A XML file extracted from a PDF/A-3 or newer attachment"
|
|
12939
|
-
});
|
|
12940
|
-
else if (attachment.filename.endsWith(".json"))
|
|
12941
|
-
expandedFiles.push({
|
|
12942
|
-
name: attachment.filename,
|
|
12943
|
-
path: FileInfos[0]?.path,
|
|
12944
|
-
type: "application/json",
|
|
12945
|
-
data: attachment.content,
|
|
12946
|
-
info: "A JSON file extracted from a PDF/A-3 or newer attachment"
|
|
12947
|
-
});
|
|
12948
|
-
else if (attachment.filename.endsWith(".csv"))
|
|
12949
|
-
expandedFiles.push({
|
|
12950
|
-
name: attachment.filename,
|
|
12951
|
-
path: FileInfos[0]?.path,
|
|
12952
|
-
type: "text/csv",
|
|
12953
|
-
data: attachment.content,
|
|
12954
|
-
info: "A CSV file extracted from a PDF/A-3 or newer attachment"
|
|
12955
|
-
});
|
|
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
|
|
12956
13114
|
});
|
|
13115
|
+
}
|
|
12957
13116
|
} catch (error) {
|
|
12958
13117
|
console.error(`Error extracting PDF/A-3 attachments: ${String(error)}`);
|
|
12959
13118
|
}
|
|
@@ -13564,6 +13723,6 @@ buffer/index.js:
|
|
|
13564
13723
|
*)
|
|
13565
13724
|
*/
|
|
13566
13725
|
|
|
13567
|
-
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, 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 };
|
|
13568
13727
|
//# sourceMappingURL=index.js.map
|
|
13569
13728
|
//# sourceMappingURL=index.js.map
|