@open-charging-cloud/wwcp-poi 0.2.0 → 0.3.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 +836 -498
- package/README.md +44 -32
- package/dist/crypto/ber.d.ts +48 -0
- package/dist/crypto/ber.d.ts.map +1 -0
- package/dist/crypto/certificates.d.ts +21 -0
- package/dist/crypto/certificates.d.ts.map +1 -0
- package/dist/crypto/curves.d.ts +25 -0
- package/dist/crypto/curves.d.ts.map +1 -0
- package/dist/crypto/ecc.d.ts +34 -0
- package/dist/crypto/ecc.d.ts.map +1 -0
- package/dist/crypto/publicKeys.d.ts +51 -0
- package/dist/crypto/publicKeys.d.ts.map +1 -0
- package/dist/crypto/rsa.d.ts +30 -0
- package/dist/crypto/rsa.d.ts.map +1 -0
- package/dist/encoding/text.d.ts +9 -0
- package/dist/encoding/text.d.ts.map +1 -1
- package/dist/evTaler/amounts.d.ts +89 -0
- package/dist/evTaler/amounts.d.ts.map +1 -0
- package/dist/evTaler/contractTerms.d.ts +107 -0
- package/dist/evTaler/contractTerms.d.ts.map +1 -0
- package/dist/evTaler/meterValue.d.ts +65 -0
- package/dist/evTaler/meterValue.d.ts.map +1 -0
- package/dist/evTaler/payURI.d.ts +28 -0
- package/dist/evTaler/payURI.d.ts.map +1 -0
- package/dist/evTaler/settlement.d.ts +85 -0
- package/dist/evTaler/settlement.d.ts.map +1 -0
- package/dist/evTaler/step.d.ts +72 -0
- package/dist/evTaler/step.d.ts.map +1 -0
- package/dist/history/apply.d.ts +6 -1
- package/dist/history/apply.d.ts.map +1 -1
- package/dist/history/changeSet.d.ts +18 -2
- package/dist/history/changeSet.d.ts.map +1 -1
- package/dist/history/checkpoint.d.ts +7 -0
- package/dist/history/checkpoint.d.ts.map +1 -1
- package/dist/history/commit.d.ts +13 -1
- package/dist/history/commit.d.ts.map +1 -1
- package/dist/history/elements.d.ts +19 -0
- package/dist/history/elements.d.ts.map +1 -0
- package/dist/history/history.d.ts +46 -6
- package/dist/history/history.d.ts.map +1 -1
- package/dist/history/preconditions.d.ts +22 -0
- package/dist/history/preconditions.d.ts.map +1 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9061 -1449
- package/dist/index.js.map +1 -1
- package/dist/json/canonical.d.ts.map +1 -1
- package/dist/keys.d.ts.map +1 -1
- package/dist/network/certificates.d.ts +16 -4
- package/dist/network/certificates.d.ts.map +1 -1
- package/dist/network/countries.d.ts +16 -0
- package/dist/network/countries.d.ts.map +1 -0
- package/dist/network/evTaler.d.ts +1 -14
- package/dist/network/evTaler.d.ts.map +1 -1
- package/dist/network/identifications.d.ts +6 -6
- package/dist/network/identifications.d.ts.map +1 -1
- package/dist/network/measurementPublicKey.d.ts +7 -0
- package/dist/network/measurementPublicKey.d.ts.map +1 -0
- package/dist/network/offers.d.ts +53 -0
- package/dist/network/offers.d.ts.map +1 -0
- package/dist/network/partyKeys.d.ts +8 -5
- package/dist/network/partyKeys.d.ts.map +1 -1
- package/dist/network/poiJSON.d.ts +172 -0
- package/dist/network/poiJSON.d.ts.map +1 -0
- package/dist/network/poiValues.d.ts +48 -0
- package/dist/network/poiValues.d.ts.map +1 -0
- package/dist/network/reading.d.ts +46 -0
- package/dist/network/reading.d.ts.map +1 -0
- package/dist/network/references.d.ts +36 -0
- package/dist/network/references.d.ts.map +1 -0
- package/dist/network/roamingNetwork.d.ts +10 -11
- package/dist/network/roamingNetwork.d.ts.map +1 -1
- package/dist/network/timeZones.d.ts +8 -0
- package/dist/network/timeZones.d.ts.map +1 -0
- package/dist/network/tree.d.ts +14 -0
- package/dist/network/tree.d.ts.map +1 -1
- package/dist/network/versionTexts.d.ts +1 -7
- package/dist/network/versionTexts.d.ts.map +1 -1
- package/dist/network/writtenForm.d.ts.map +1 -1
- package/dist/proofs/priceStatement.d.ts.map +1 -1
- package/dist/verifier/checkpoints.d.ts +6 -0
- package/dist/verifier/checkpoints.d.ts.map +1 -1
- package/package.json +14 -13
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type JSONObject, type JSONValue } from '../json/value.ts';
|
|
2
|
+
import { type EVTalerMerchant } from '../network/evTaler.ts';
|
|
3
|
+
import { type VerifiedChargingStation, type VerifiedPrice } from '../verifier/chargingStation.ts';
|
|
4
|
+
import { EVTalerRates, NetDecimal } from './amounts.ts';
|
|
5
|
+
import { type EVTalerMeterValueVerifier, type EVTalerVerifiedMeterValue } from './meterValue.ts';
|
|
6
|
+
import { type EVTalerPayURI } from './payURI.ts';
|
|
7
|
+
import { EVTalerStep } from './step.ts';
|
|
8
|
+
/** How exactly a reader checked the amount of a step (`EVTalerAmountChecks`). */
|
|
9
|
+
export declare const EVTalerAmountChecks: {
|
|
10
|
+
/** What the step covers at the price of the session, rounded up to the minor unit; in step 1 with the flat fee, the reserve as the rest. */
|
|
11
|
+
readonly Exact: "exact";
|
|
12
|
+
/** The session is priced by energy and time: the amount is at least what the step covers, the rest an estimate (5.1). */
|
|
13
|
+
readonly Estimate: "estimate";
|
|
14
|
+
/** The prices of the session are not of the simple profile: the amount is not recalculated. */
|
|
15
|
+
readonly Unsupported: "unsupported";
|
|
16
|
+
};
|
|
17
|
+
export type EVTalerAmountCheck = typeof EVTalerAmountChecks[keyof typeof EVTalerAmountChecks];
|
|
18
|
+
/** A step of an EV Taler session as its contract terms and a station proof establish it (`EVTalerVerifiedStep`, 7). */
|
|
19
|
+
export interface EVTalerVerifiedStep {
|
|
20
|
+
readonly terms: EVTalerContractTerms;
|
|
21
|
+
readonly step: EVTalerStep;
|
|
22
|
+
/** The operator's merchant, as the proof gives it. */
|
|
23
|
+
readonly merchant: EVTalerMerchant;
|
|
24
|
+
/** The EV Taler tariff of the EVSE, as the proof gives it. */
|
|
25
|
+
readonly tariff: JSONObject;
|
|
26
|
+
readonly currency: string;
|
|
27
|
+
/** The price statement that prices the session, if any. */
|
|
28
|
+
readonly priceStatement: VerifiedPrice | undefined;
|
|
29
|
+
/** The elements that price the session: of the price statement, else of the tariff. */
|
|
30
|
+
readonly elements: readonly JSONObject[];
|
|
31
|
+
/** The rates of the simple profile, if the elements are of it. */
|
|
32
|
+
readonly rates: EVTalerRates | undefined;
|
|
33
|
+
/** When step 1 was made: the time its price statement is current at, in milliseconds since 1970. */
|
|
34
|
+
readonly sessionStarted: number;
|
|
35
|
+
/** What the step covers at the price of its dimension, if recalculated. */
|
|
36
|
+
readonly stepPrice: NetDecimal | undefined;
|
|
37
|
+
/** The flat fee, in step 1, if recalculated. */
|
|
38
|
+
readonly flatFee: NetDecimal | undefined;
|
|
39
|
+
/** The reserve, in step 1, if recalculated: the amount less the step and the flat fee. */
|
|
40
|
+
readonly reserve: NetDecimal | undefined;
|
|
41
|
+
readonly amountCheck: EVTalerAmountCheck;
|
|
42
|
+
/** From step 2 on: the signed meter value at the start, verified. */
|
|
43
|
+
readonly start: EVTalerVerifiedMeterValue | undefined;
|
|
44
|
+
/** What a reader should know. */
|
|
45
|
+
readonly diagnostics: readonly string[];
|
|
46
|
+
}
|
|
47
|
+
/** An exchange of contract terms: its base URL and its master public key. */
|
|
48
|
+
export interface EVTalerContractExchange {
|
|
49
|
+
readonly url: string;
|
|
50
|
+
readonly masterPublicKey: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The contract terms of a step of an EV Taler session, as GNU Taler's merchant backend makes them and its instance signs
|
|
54
|
+
* them (contract terms of version 0): what WWCP_POI reads of them, the rest kept as given.
|
|
55
|
+
*/
|
|
56
|
+
export declare class EVTalerContractTerms {
|
|
57
|
+
/** The contract terms, as given. */
|
|
58
|
+
readonly json: JSONObject;
|
|
59
|
+
readonly orderId: string;
|
|
60
|
+
readonly currency: string;
|
|
61
|
+
readonly amount: NetDecimal;
|
|
62
|
+
/** The base URL of the merchant instance. */
|
|
63
|
+
readonly merchantBaseURL: string;
|
|
64
|
+
/** The public key of the merchant instance, which signed the contract terms. */
|
|
65
|
+
readonly merchantPublicKey: string;
|
|
66
|
+
/** The exchanges the merchant accepts. */
|
|
67
|
+
readonly exchanges: readonly EVTalerContractExchange[];
|
|
68
|
+
/** When the contract terms were made, in milliseconds since 1970. */
|
|
69
|
+
readonly timestamp: number;
|
|
70
|
+
/** Until when the step can be paid. */
|
|
71
|
+
readonly payDeadline: number;
|
|
72
|
+
/** Until when the step can be refunded. */
|
|
73
|
+
readonly refundDeadline: number;
|
|
74
|
+
/** How long the wallet asks for a refund by itself, in microseconds, Infinity for "forever"; undefined if not at all. */
|
|
75
|
+
readonly autoRefund: number | undefined;
|
|
76
|
+
/** The step in WWCP terms: "extra": { "wwcp": … }. */
|
|
77
|
+
readonly step: EVTalerStep;
|
|
78
|
+
private constructor();
|
|
79
|
+
/**
|
|
80
|
+
* Reads the given contract terms of a step (`EVTalerContractTerms.TryParse`): of version 0, with an order, an amount and
|
|
81
|
+
* a maximum fee in one currency, the merchant's base URL and public key, at least one exchange, the times GNU Taler
|
|
82
|
+
* writes as { "t_s": … }, and the step in "extra": { "wwcp": … }. Refused in the words of WWCP_POI.
|
|
83
|
+
*/
|
|
84
|
+
static parse(json: JSONValue | undefined): EVTalerContractTerms;
|
|
85
|
+
/**
|
|
86
|
+
* Checks these contract terms of a step against a verified charging station (`EVTalerContractTerms.TryVerify`,
|
|
87
|
+
* concepts/EVTaler.md 6 and 7): the merchant and its exchanges are those of the operator's evTaler in the currency of
|
|
88
|
+
* the EVSE's EV Taler tariff; the step names the roaming network, an EVSE of the station, that tariff and the price
|
|
89
|
+
* statement current when the session began; it follows the step before, or is step 1; from step 2 on, the signed start
|
|
90
|
+
* value is verified with a measurement key the proof gives; the amount is the step at the price of the session, where
|
|
91
|
+
* the prices are of the simple profile; the refund deadline is after the payment deadline, and the wallet picks a refund
|
|
92
|
+
* up by itself. Refused in the words of WWCP_POI.
|
|
93
|
+
*
|
|
94
|
+
* @param priceStatements The price statements the app holds of the station, its pool and its EVSEs, as JSON.
|
|
95
|
+
* @param previous The step before, verified; none for step 1.
|
|
96
|
+
* @param verifier A transparency software verifying signed meter values, from step 2 on.
|
|
97
|
+
* @param payURI The taler://pay URI of the offer, if the app has it as well.
|
|
98
|
+
*/
|
|
99
|
+
verify(station: VerifiedChargingStation, priceStatements: JSONValue, previous: EVTalerVerifiedStep | undefined, verifier: EVTalerMeterValueVerifier | undefined, payURI?: EVTalerPayURI): EVTalerVerifiedStep;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The EV Taler tariff of the given EVSE, as the proof gives its tariffs (`EVTalerContractTerms.TryGetEVTalerTariff`, 4.3):
|
|
103
|
+
* the first of the type AD_HOC_PAYMENT, else the first without a type, with a currency, naming no payment means or
|
|
104
|
+
* EV_TALER among them; refused in the words of WWCP_POI otherwise.
|
|
105
|
+
*/
|
|
106
|
+
export declare function evTalerTariff(station: VerifiedChargingStation, evseId: string): JSONObject;
|
|
107
|
+
//# sourceMappingURL=contractTerms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contractTerms.d.ts","sourceRoot":"","sources":["../../src/evTaler/contractTerms.ts"],"names":[],"mappings":"AAmBA,OAAO,EAA0B,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAuC,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGlG,OAAO,EAAyB,KAAK,uBAAuB,EAAE,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACzH,OAAO,EAAE,YAAY,EAAE,UAAU,EAA8B,MAAM,cAAc,CAAC;AACpF,OAAO,EAAoB,KAAK,yBAAyB,EAAE,KAAK,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAOxC,iFAAiF;AACjF,eAAO,MAAM,mBAAmB;IAC5B,4IAA4I;;IAE5I,yHAAyH;;IAEzH,+FAA+F;;CAEzF,CA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;IAGzB,oCAAoC;aACpB,IAAI,EAAgB,UAAU;aAC9B,OAAO,EAAa,MAAM;aAC1B,QAAQ,EAAY,MAAM;aAC1B,MAAM,EAAc,UAAU;IAC9C,6CAA6C;aAC7B,eAAe,EAAK,MAAM;IAC1C,gFAAgF;aAChE,iBAAiB,EAAG,MAAM;IAC1C,0CAA0C;aAC1B,SAAS,EAAW,SAAS,uBAAuB,EAAE;IACtE,qEAAqE;aACrD,SAAS,EAAW,MAAM;IAC1C,uCAAuC;aACvB,WAAW,EAAS,MAAM;IAC1C,2CAA2C;aAC3B,cAAc,EAAM,MAAM;IAC1C,yHAAyH;aACzG,UAAU,EAAU,MAAM,GAAG,SAAS;IACtD,sDAAsD;aACtC,IAAI,EAAgB,WAAW;IArBnD,OAAO;IAwBP;;;;OAIG;WACW,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,oBAAoB;IAkFtE;;;;;;;;;;;;;OAaG;IACI,MAAM,CAAC,OAAO,EAAW,uBAAuB,EACzC,eAAe,EAAG,SAAS,EAC3B,QAAQ,EAAU,mBAAmB,GAAG,SAAS,EACjD,QAAQ,EAAU,yBAAyB,GAAG,SAAS,EACvD,MAAM,CAAC,EAAW,aAAa,GAAG,mBAAmB;CAiKtE;AAGD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAkB1F"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type JSONObject, type JSONValue } from '../json/value.ts';
|
|
2
|
+
import type { VerifiedChargingStation } from '../verifier/chargingStation.ts';
|
|
3
|
+
import type { NetDecimal } from './amounts.ts';
|
|
4
|
+
/** What a transparency software reads from a signed meter value it verified: the meter that signed it, when, the energy register in kWh. */
|
|
5
|
+
export interface EVTalerMeterReading {
|
|
6
|
+
readonly meterSerialNumber: string;
|
|
7
|
+
/** When it was measured, in milliseconds since 1970. */
|
|
8
|
+
readonly timestamp: number;
|
|
9
|
+
readonly energy: NetDecimal;
|
|
10
|
+
}
|
|
11
|
+
/** A measurement public key a station proof gives: its identification and its key, the DER of a SubjectPublicKeyInfo. */
|
|
12
|
+
export interface EVTalerMeasurementKey {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly key: Uint8Array;
|
|
15
|
+
readonly json: JSONObject;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A transparency software verifying a signed meter value with the given public key, as it knows the format of the value,
|
|
19
|
+
* e.g. OCMF (`EVTalerMeterValueVerifier`): what the value says, or an Error saying why it is not valid.
|
|
20
|
+
*/
|
|
21
|
+
export type EVTalerMeterValueVerifier = (value: EVTalerSignedMeterValue, key: EVTalerMeasurementKey) => EVTalerMeterReading;
|
|
22
|
+
/** A signed meter value verified with a key a station proof gives for the meter of the EVSE or for the station. */
|
|
23
|
+
export interface EVTalerVerifiedMeterValue {
|
|
24
|
+
readonly value: EVTalerSignedMeterValue;
|
|
25
|
+
readonly reading: EVTalerMeterReading;
|
|
26
|
+
/** The @id of the measurement public key it was verified with. */
|
|
27
|
+
readonly keyId: string;
|
|
28
|
+
/** The @id of the energy meter or the charging station whose key it is. */
|
|
29
|
+
readonly signedBy: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A signed meter value as a charging station sends it with OCPP 2.1 (SignedMeterValueType): the signed data as the meter
|
|
33
|
+
* gives it, Base64 encoded, how it is encoded and signed, and maybe the public key. It is kept and compared as sent.
|
|
34
|
+
*/
|
|
35
|
+
export declare class EVTalerSignedMeterValue {
|
|
36
|
+
/** The signed data, canonical Base64, as the station sent it. */
|
|
37
|
+
readonly signedMeterData: string;
|
|
38
|
+
/** How the meter encodes it, e.g. "OCMF". */
|
|
39
|
+
readonly encodingMethod: string;
|
|
40
|
+
/** How it is signed, if the station says so apart from the data. */
|
|
41
|
+
readonly signingMethod: string | undefined;
|
|
42
|
+
/** The public key, canonical Base64 of the DER of a SubjectPublicKeyInfo, if the station sent it: which key of the proof verifies it. */
|
|
43
|
+
readonly publicKey: string | undefined;
|
|
44
|
+
private constructor();
|
|
45
|
+
/** A signed meter value as a charging station sent it, refused in the words of WWCP_POI where it is no valid one. */
|
|
46
|
+
static create(signedMeterData: string, encodingMethod: string, signingMethod?: string, publicKey?: string): EVTalerSignedMeterValue;
|
|
47
|
+
/**
|
|
48
|
+
* Reads a signed meter value as OCPP 2.1 writes it (`EVTalerSignedMeterValue.TryParse`): the signed data and the public
|
|
49
|
+
* key canonical Base64, the methods nonempty texts, nothing else; refused in its words.
|
|
50
|
+
*/
|
|
51
|
+
static parse(json: JSONValue | undefined): EVTalerSignedMeterValue;
|
|
52
|
+
/** As OCPP 2.1 writes it. */
|
|
53
|
+
toJSON(): JSONObject;
|
|
54
|
+
/** Whether the station sent the same, field by field. */
|
|
55
|
+
equals(other: EVTalerSignedMeterValue | undefined): boolean;
|
|
56
|
+
private invalid;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Verifies the given signed meter value of the given EVSE with a measurement public key the station proof gives for the
|
|
60
|
+
* energy meter of the EVSE or for the charging station (`EVTalerSignedMeterValue.TryVerify`): the one the value names by
|
|
61
|
+
* its public key, else the only one there is; no key is tried after another. The reading must name the serial number of
|
|
62
|
+
* the meter or the station whose key it is. Refused in the words of WWCP_POI.
|
|
63
|
+
*/
|
|
64
|
+
export declare function verifyMeterValue(station: VerifiedChargingStation, evseId: string, value: EVTalerSignedMeterValue, verifier: EVTalerMeterValueVerifier): EVTalerVerifiedMeterValue;
|
|
65
|
+
//# sourceMappingURL=meterValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meterValue.d.ts","sourceRoot":"","sources":["../../src/evTaler/meterValue.ts"],"names":[],"mappings":"AAmBA,OAAO,EAA0B,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG3F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC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AS,GAAG,SAAS,GAAG,uBAAuB;IAuBzE,6BAA6B;IACtB,MAAM,IAAI,UAAU;IAS3B,yDAAyD;IAClD,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,SAAS,GAAG,OAAO;IASlE,OAAO,CAAC,OAAO;CAkBlB;AAGD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAI,uBAAuB,EAClC,MAAM,EAAK,MAAM,EACjB,KAAK,EAAM,uBAAuB,EAClC,QAAQ,EAAG,yBAAyB,GAAG,yBAAyB,CA2DhG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EVTalerMerchant } from '../network/evTaler.ts';
|
|
2
|
+
/** Whether two HTTPS base URLs are the same: the host in any case, the path as written (`EVTalerPayURI.SameBaseURL`). */
|
|
3
|
+
export declare function sameBaseURL(a: string, b: string): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* A taler://pay URI of an offer, as the merchant backend gives it (`EVTalerPayURI`):
|
|
6
|
+
* taler://pay/{merchant_host}{/merchant_prefix_path*}/{order_id}/{session_id}{?c=claim_token}{#ssid}.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EVTalerPayURI {
|
|
9
|
+
/** The URI as given. */
|
|
10
|
+
readonly text: string;
|
|
11
|
+
/** The base URL of the merchant instance it names: https://{merchant_host}/{merchant_prefix_path}/. */
|
|
12
|
+
readonly merchantBaseURL: string;
|
|
13
|
+
readonly orderId: string;
|
|
14
|
+
/** GNU Taler's session of the order, if any; not the session of the offers server. */
|
|
15
|
+
readonly sessionId: string | undefined;
|
|
16
|
+
readonly claimToken: string | undefined;
|
|
17
|
+
private constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Reads the given taler://pay URI (`EVTalerPayURI.TryParse`). Its scheme is read in any case, as QR codes write it in
|
|
20
|
+
* upper case; taler+http://, of a merchant without HTTPS, is refused. The order and GNU Taler's session are counted from
|
|
21
|
+
* the end of its path, as the merchant's path may have any number of segments. Refused in the words of WWCP_POI.
|
|
22
|
+
*/
|
|
23
|
+
static parse(text: string): EVTalerPayURI;
|
|
24
|
+
/** Checks that it names the merchant instance of the given EV Taler merchant: its host in any case, its path as written. */
|
|
25
|
+
verify(merchant: EVTalerMerchant): void;
|
|
26
|
+
toString(): string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=payURI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payURI.d.ts","sourceRoot":"","sources":["../../src/evTaler/payURI.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAY7D,yHAAyH;AACzH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAwBzD;AAGD;;;GAGG;AACH,qBAAa,aAAa;IAGlB,wBAAwB;aACR,IAAI,EAAc,MAAM;IACxC,uGAAuG;aACvF,eAAe,EAAG,MAAM;aACxB,OAAO,EAAW,MAAM;IACxC,sFAAsF;aACtE,SAAS,EAAS,MAAM,GAAG,SAAS;aACpC,UAAU,EAAQ,MAAM,GAAG,SAAS;IARxD,OAAO;IAWP;;;;OAIG;WACW,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa;IAkDhD,4HAA4H;IACrH,MAAM,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAKvC,QAAQ,IAAI,MAAM;CAI5B"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type JSONObject, type JSONValue } from '../json/value.ts';
|
|
2
|
+
import type { VerifiedChargingStation } from '../verifier/chargingStation.ts';
|
|
3
|
+
import { NetDecimal } from './amounts.ts';
|
|
4
|
+
import { type EVTalerAmountCheck, type EVTalerVerifiedStep } from './contractTerms.ts';
|
|
5
|
+
import { EVTalerSignedMeterValue, type EVTalerMeterValueVerifier, type EVTalerVerifiedMeterValue } from './meterValue.ts';
|
|
6
|
+
/** The JSON-LD context of a settlement statement. */
|
|
7
|
+
export declare const EV_TALER_SETTLEMENT_CONTEXT: string;
|
|
8
|
+
/** An order of a step of a session and what it took. */
|
|
9
|
+
export interface EVTalerSettledOrder {
|
|
10
|
+
readonly orderId: string;
|
|
11
|
+
readonly amount: NetDecimal;
|
|
12
|
+
}
|
|
13
|
+
/** What a reader established of a settlement statement (`EVTalerSettlementVerification`, 5.4). */
|
|
14
|
+
export interface EVTalerSettlementVerification {
|
|
15
|
+
readonly settlement: EVTalerSettlement;
|
|
16
|
+
/** The signed meter values at the start and at the end, verified. */
|
|
17
|
+
readonly start: EVTalerVerifiedMeterValue;
|
|
18
|
+
readonly end: EVTalerVerifiedMeterValue;
|
|
19
|
+
/** The energy of the session, in kWh: the end value less the start value. */
|
|
20
|
+
readonly energy: NetDecimal;
|
|
21
|
+
/** The price of the session by its rates, where they are of the simple profile. */
|
|
22
|
+
readonly computedPrice: NetDecimal | undefined;
|
|
23
|
+
/** Exact when the price was recalculated, else unsupported. */
|
|
24
|
+
readonly priceCheck: EVTalerAmountCheck;
|
|
25
|
+
readonly diagnostics: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
/** The settlement statement of an EV Taler session (`EVTalerSettlement`). */
|
|
28
|
+
export declare class EVTalerSettlement {
|
|
29
|
+
/** The JSON as signed. */
|
|
30
|
+
readonly json: JSONObject;
|
|
31
|
+
/** When it started: the time of the signed meter value at the start, in milliseconds since 1970. */
|
|
32
|
+
readonly start: number;
|
|
33
|
+
/** When it ended: the time of the signed meter value at the end. */
|
|
34
|
+
readonly end: number;
|
|
35
|
+
/** The signed meter values at the start and at the end, as the station sent them. */
|
|
36
|
+
readonly meterValues: readonly [EVTalerSignedMeterValue, EVTalerSignedMeterValue];
|
|
37
|
+
/** The energy, in kWh. */
|
|
38
|
+
readonly energy: NetDecimal;
|
|
39
|
+
/** The orders of the steps, in their order, and what each took. */
|
|
40
|
+
readonly orders: readonly EVTalerSettledOrder[];
|
|
41
|
+
readonly price: NetDecimal;
|
|
42
|
+
/** What the steps took together. */
|
|
43
|
+
readonly paid: NetDecimal;
|
|
44
|
+
/** What was refunded: the paid amount less the price, not less than nothing. */
|
|
45
|
+
readonly refunded: NetDecimal;
|
|
46
|
+
readonly signedAt: number;
|
|
47
|
+
private constructor();
|
|
48
|
+
private text;
|
|
49
|
+
get roamingNetworkId(): string;
|
|
50
|
+
get EVSEId(): string;
|
|
51
|
+
get sessionId(): string;
|
|
52
|
+
/** The public key of the merchant instance that took the steps, as in evTaler. */
|
|
53
|
+
get merchantPublicKey(): string;
|
|
54
|
+
get chargingTariffId(): string;
|
|
55
|
+
/** The digest of the price statement that priced it, if any. */
|
|
56
|
+
get priceStatement(): string | undefined;
|
|
57
|
+
get currency(): string;
|
|
58
|
+
/** The charging station operator signing it. */
|
|
59
|
+
get signer(): string;
|
|
60
|
+
get algorithm(): string;
|
|
61
|
+
/** The @id of the signing key. */
|
|
62
|
+
get keyId(): string;
|
|
63
|
+
/** The signature, Base64. */
|
|
64
|
+
get value(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Reads the given settlement statement (`EVTalerSettlement.TryParse`): its context and role, nothing it does not know,
|
|
67
|
+
* both signed meter values, at least one order, its decimals as texts, what was paid the sum of the orders and what was
|
|
68
|
+
* refunded the paid amount less the price, not less than nothing. Refused in the words of WWCP_POI.
|
|
69
|
+
*/
|
|
70
|
+
static parse(json: JSONValue | undefined): EVTalerSettlement;
|
|
71
|
+
/** The signature input: the canonical JSON of what it names, but its value. */
|
|
72
|
+
signingBytes(): Uint8Array;
|
|
73
|
+
/**
|
|
74
|
+
* Verifies this settlement statement against the verified charging station and the verified steps of its session
|
|
75
|
+
* (`EVTalerSettlement.TryVerify`, 5.4): signed by the operator with a key that may sign payments, valid when it was
|
|
76
|
+
* signed; of the merchant, EVSE, session, tariff and price statement of the steps, naming their orders and amounts; both
|
|
77
|
+
* signed meter values verified with one measurement key the proof gives, the start value the one the steps name, the end
|
|
78
|
+
* value after and not below it, the times and the energy theirs; and, where the prices are of the simple profile, the
|
|
79
|
+
* price recalculated. Refused in the words of WWCP_POI.
|
|
80
|
+
*/
|
|
81
|
+
verify(station: VerifiedChargingStation, steps: readonly EVTalerVerifiedStep[], verifier: EVTalerMeterValueVerifier): EVTalerSettlementVerification;
|
|
82
|
+
/** E.g. "7.412 kWh, 5.32 EUR". */
|
|
83
|
+
toString(): string;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=settlement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settlement.d.ts","sourceRoot":"","sources":["../../src/evTaler/settlement.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAmC,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGpG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAiB,UAAU,EAA6B,MAAM,cAAc,CAAC;AACpF,OAAO,EAAuB,KAAK,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5G,OAAO,EAAE,uBAAuB,EAAoB,KAAK,yBAAyB,EAAE,KAAK,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAU5I,qDAAqD;AACrD,eAAO,MAAM,2BAA2B,QAAyD,CAAC;AAYlG,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAI,UAAU,CAAC;CACjC;AAED,kGAAkG;AAClG,MAAM,WAAW,6BAA6B;IAC1C,QAAQ,CAAC,UAAU,EAAM,iBAAiB,CAAC;IAC3C,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAW,yBAAyB,CAAC;IACnD,QAAQ,CAAC,GAAG,EAAa,yBAAyB,CAAC;IACnD,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAU,UAAU,CAAC;IACpC,mFAAmF;IACnF,QAAQ,CAAC,aAAa,EAAG,UAAU,GA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AA+E;IACxE,YAAY,IAAI,UAAU;IAIjC;;;;;;;OAOG;IACI,MAAM,CAAC,OAAO,EAAI,uBAAuB,EAClC,KAAK,EAAM,SAAS,mBAAmB,EAAE,EACzC,QAAQ,EAAG,yBAAyB,GAAG,6BAA6B;IAoHlF,kCAAkC;IAC3B,QAAQ,IAAI,MAAM;CAI5B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type JSONObject, type JSONValue } from '../json/value.ts';
|
|
2
|
+
import { NetDecimal } from './amounts.ts';
|
|
3
|
+
import { EVTalerSignedMeterValue } from './meterValue.ts';
|
|
4
|
+
/** The JSON-LD context of a step. */
|
|
5
|
+
export declare const EV_TALER_STEP_CONTEXT: string;
|
|
6
|
+
/** What a step covers: energy, in kWh, or time, in minutes. */
|
|
7
|
+
export type EVTalerCoversUnit = 'kWh' | 'min';
|
|
8
|
+
/** What a step of an EV Taler session pays for, counted from the start of the session: from, to, and the unit. */
|
|
9
|
+
export declare class EVTalerCovers {
|
|
10
|
+
readonly from: NetDecimal;
|
|
11
|
+
readonly to: NetDecimal;
|
|
12
|
+
readonly unit: EVTalerCoversUnit;
|
|
13
|
+
private constructor();
|
|
14
|
+
/** What a step covers: from less than to, neither negative, in kWh or minutes; refused in the words of WWCP_POI otherwise. */
|
|
15
|
+
static create(from: NetDecimal | number, to: NetDecimal | number, unit: string): EVTalerCovers;
|
|
16
|
+
/** Reads what a step covers (`EVTalerCovers.TryParse`), its decimals as texts; refused in its words. */
|
|
17
|
+
static parse(json: JSONValue | undefined): EVTalerCovers;
|
|
18
|
+
/** The decimals as texts. */
|
|
19
|
+
toJSON(): JSONObject;
|
|
20
|
+
equals(other: EVTalerCovers): boolean;
|
|
21
|
+
/** E.g. "0 to 5 kWh". */
|
|
22
|
+
toString(): string;
|
|
23
|
+
}
|
|
24
|
+
/** Whether the given text is a session of the offers server: 128 bits, canonical base64url without padding, 22 characters. */
|
|
25
|
+
export declare function isEVTalerSessionId(text: string | undefined): text is string;
|
|
26
|
+
/** The data of a step: as `EVTalerStep.create` takes it. */
|
|
27
|
+
export interface EVTalerStepData {
|
|
28
|
+
readonly roamingNetworkId: string;
|
|
29
|
+
readonly EVSEId: string;
|
|
30
|
+
readonly sessionId: string;
|
|
31
|
+
readonly step: number;
|
|
32
|
+
readonly previousOrderId?: string | undefined;
|
|
33
|
+
readonly chargingTariffId: string;
|
|
34
|
+
readonly priceStatement?: string | undefined;
|
|
35
|
+
readonly covers: EVTalerCovers;
|
|
36
|
+
readonly startMeterValue?: EVTalerSignedMeterValue | undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A step of an EV Taler session in WWCP terms (`EVTalerStep`): where, which session, which step after which order, the EV
|
|
40
|
+
* Taler tariff and the price statement, what it covers, and from step 2 on the signed meter value at the start.
|
|
41
|
+
*/
|
|
42
|
+
export declare class EVTalerStep {
|
|
43
|
+
/** The roaming network, trimmed as its identification reads it. */
|
|
44
|
+
readonly roamingNetworkId: string;
|
|
45
|
+
/** The EVSE, as the roaming network writes it. */
|
|
46
|
+
readonly EVSEId: string;
|
|
47
|
+
/** The session at the offers server: 128 random bits, base64url. Not GNU Taler's session_id of an order. */
|
|
48
|
+
readonly sessionId: string;
|
|
49
|
+
/** The number of the step: 1, 2, … */
|
|
50
|
+
readonly step: number;
|
|
51
|
+
/** The order_id of the step before; none in step 1. */
|
|
52
|
+
readonly previousOrderId: string | undefined;
|
|
53
|
+
/** The EV Taler tariff of the EVSE (4.3). */
|
|
54
|
+
readonly chargingTariffId: string;
|
|
55
|
+
/** The digest of the price statement whose elements price the session; none when the tariff's own do. */
|
|
56
|
+
readonly priceStatement: string | undefined;
|
|
57
|
+
readonly covers: EVTalerCovers;
|
|
58
|
+
/** From step 2 on: the signed meter value at the start of the session, as the station sent it. */
|
|
59
|
+
readonly startMeterValue: EVTalerSignedMeterValue | undefined;
|
|
60
|
+
private constructor();
|
|
61
|
+
/** A step of an EV Taler session, refused in the words of WWCP_POI where it is no valid one. */
|
|
62
|
+
static create(data: EVTalerStepData): EVTalerStep;
|
|
63
|
+
/**
|
|
64
|
+
* Reads a step of an EV Taler session, the object of "extra": { "wwcp": … } (`EVTalerStep.TryParse`): its context,
|
|
65
|
+
* nothing it does not know, and the rules of `create`; refused in the words of WWCP_POI.
|
|
66
|
+
*/
|
|
67
|
+
static parse(json: JSONValue | undefined): EVTalerStep;
|
|
68
|
+
/** The JSON of "extra": { "wwcp": … }. */
|
|
69
|
+
toJSON(): JSONObject;
|
|
70
|
+
private invalid;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/evTaler/step.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAiB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlF,OAAO,EAAiB,UAAU,EAAgB,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAO1D,qCAAqC;AACrC,eAAO,MAAM,qBAAqB,QAAmD,CAAC;AAEtF,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,KAAK,CAAC;AAG9C,kHAAkH;AAClH,qBAAa,aAAa;aAGF,IAAI,EAAG,UAAU;aACjB,EAAE,EAAK,UAAU;aACjB,IAAI,EAAG,iBAAiB;IAH5C,OAAO;IAMP,8HAA8H;WAChH,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,EAAE,EAAE,EAAE,UAAU,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa;IAerG,wGAAwG;WAC1F,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,aAAa;IAwB/D,6BAA6B;IACtB,MAAM,IAAI,UAAU;IAIpB,MAAM,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAI5C,yBAAyB;IAClB,QA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AAU;IAe3B,OAAO,CAAC,OAAO;CAiClB"}
|
package/dist/history/apply.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RoamingNetwork } from '../network/roamingNetwork.ts';
|
|
2
|
-
import type
|
|
2
|
+
import { type ChangeSet } from './changeSet.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Checks the signatures of a change set against the version it is applied to (4.1): every signature valid, by a key of a
|
|
5
5
|
* party of the version valid at `createdAt` or by a new identity key of one of its changes (proof of possession); for every
|
|
@@ -11,6 +11,11 @@ export declare function checkOwnership(before: RoamingNetwork, changeSet: Change
|
|
|
11
11
|
* Applies a change set to the version it fits (4, 5.2): its owners signed it (unless `checkOwnership` is false), its
|
|
12
12
|
* `beforeETags` are those of the version, its changes apply, and the result has its `afterETags`. Returns the new version.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* The stamp of a change set applied to the given version (SPECIFICATION.md 4, S5): its createdAt, or the lastChange of the
|
|
16
|
+
* roaming network of the version, where that is later; in milliseconds since 1970.
|
|
17
|
+
*/
|
|
18
|
+
export declare function stampOf(before: RoamingNetwork, changeSet: ChangeSet): number;
|
|
14
19
|
export declare function applyChangeSet(before: RoamingNetwork, changeSet: ChangeSet, options?: {
|
|
15
20
|
checkOwnership?: boolean;
|
|
16
21
|
}): RoamingNetwork;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/history/apply.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,cAAc,EAAE,MAAsB,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/history/apply.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,cAAc,EAAE,MAAsB,8BAA8B,CAAC;AAM9E,OAAO,EAAoD,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA+mDlG;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CA6KjF;AAuBD;;;GAGG;AACH;;;GAGG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAI5E;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,cAAc,CAiFvI"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type JSONObject, type JSONValue } from '../json/value.ts';
|
|
2
2
|
import { type ETag } from '../etags.ts';
|
|
3
3
|
import type { POIPublicKey } from '../keys.ts';
|
|
4
|
+
import { type Precondition } from './preconditions.ts';
|
|
4
5
|
/** The context of a change set, also of the signature input of its signatures (4). */
|
|
5
6
|
export declare const CHANGE_SET_CONTEXT: string;
|
|
6
7
|
/** How the identification of the change set of a merge starts, which is identified by its parents, not by its content (5.3). */
|
|
@@ -12,6 +13,20 @@ export declare const MERGE_CHANGE_SET_ID_PREFIX = "merge-";
|
|
|
12
13
|
export declare function changeSetIdentification(json: JSONObject): string;
|
|
13
14
|
/** The kinds of changes (SPECIFICATION.md section 4). */
|
|
14
15
|
export type ChangeKind = 'Add' | 'Remove' | 'UpdateProperty' | 'RemoveProperty' | 'AddElement' | 'RemoveElement' | 'ReplaceElement' | 'UpdateElementProperty' | 'RemoveElementProperty';
|
|
16
|
+
/** The context of a segment of an element path, where it is given. */
|
|
17
|
+
export declare const ELEMENT_PATH_SEGMENT_CONTEXT: string;
|
|
18
|
+
/**
|
|
19
|
+
* One step of an element path (`POIElementPathSegment`): a property of the entity, or of the element the step before
|
|
20
|
+
* addresses, and the identification of an element of it, which an array needs and one identified object may name.
|
|
21
|
+
*/
|
|
22
|
+
export interface ElementPathSegment {
|
|
23
|
+
readonly propertyName: string;
|
|
24
|
+
readonly elementId: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/** Whether a change addresses an element of a property of its entity by its element path. */
|
|
27
|
+
export declare const isElementChange: (change: Change) => boolean;
|
|
28
|
+
/** The property of the entity itself a change changes: of an element change the one its path starts with. */
|
|
29
|
+
export declare const entityPropertyName: (change: Change) => string | undefined;
|
|
15
30
|
/** One change of a change set. */
|
|
16
31
|
export interface Change {
|
|
17
32
|
readonly kind: ChangeKind;
|
|
@@ -23,7 +38,8 @@ export interface Change {
|
|
|
23
38
|
readonly newValue: JSONValue | undefined;
|
|
24
39
|
readonly parentEntityType: string | undefined;
|
|
25
40
|
readonly parentEntityId: string | undefined;
|
|
26
|
-
|
|
41
|
+
/** The element path of an element change, not empty; `undefined` for every other change. */
|
|
42
|
+
readonly elementPath: readonly ElementPathSegment[] | undefined;
|
|
27
43
|
readonly json: JSONObject;
|
|
28
44
|
}
|
|
29
45
|
/** A signature of a change set: by an owner of one of its changes, or a new identity key as its proof of possession. */
|
|
@@ -41,7 +57,7 @@ export declare class ChangeSet {
|
|
|
41
57
|
readonly roamingNetworkId: string;
|
|
42
58
|
readonly createdAt: number;
|
|
43
59
|
readonly changes: readonly Change[];
|
|
44
|
-
readonly preconditions: readonly
|
|
60
|
+
readonly preconditions: readonly Precondition[];
|
|
45
61
|
readonly beforeETags: readonly ETag[];
|
|
46
62
|
readonly afterETags: readonly ETag[];
|
|
47
63
|
readonly signatures: readonly ChangeSetSignature[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changeSet.d.ts","sourceRoot":"","sources":["../../src/history/changeSet.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAwC,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIzG,OAAO,EAAc,KAAK,IAAI,EAAE,MAAU,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAc,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"changeSet.d.ts","sourceRoot":"","sources":["../../src/history/changeSet.ts"],"names":[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** Whether this is the final checkpoint of its epoch, `"final": true` with the next epoch (11.2). */
|
|
38
38
|
get isFinal(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* This checkpoint with only those of its signatures that are given, e.g. the ones verified where it is taken
|
|
41
|
+
* (`WithSignaturesOnly` of WWCP_POI 399b7c8, POI3-ISSUES.md S39): the others left out, its identification the same.
|
|
42
|
+
* A signature is given when one of the same role, signer, time, algorithm, key and value is, each given one once: of
|
|
43
|
+
* two exact copies, one given keeps the first alone, as WWCP_POI reads them as one.
|
|
44
|
+
*/
|
|
45
|
+
withSignaturesOnly(signatures: readonly RoleSignature[]): Checkpoint;
|
|
39
46
|
static parse(value: JSONValue | undefined): Checkpoint;
|
|
40
47
|
/** What the identification is the digest of: the checkpoint without `@id` and `signatures`, with its `@context`. */
|
|
41
48
|
identificationContent(): JSONObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../src/history/checkpoint.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAc,OAAO,EAAqB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5F,OAAO,EAAyB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAA4F,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7I,OAAO,
|
|
1
|
+
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../src/history/checkpoint.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAc,OAAO,EAAqB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5F,OAAO,EA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HAAkH;IAC3G,aAAa,IAAI,UAAU;IAM3B,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,UAAU;IAIzD,8EAA8E;IACvE,eAAe,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,GAAG,IAAI;IASzE,iFAAiF;IAC1E,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAKpC;;;;OAIG;IACI,aAAa,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;CAazD;AAGD,iIAAiI;AACjI,eAAO,MAAM,cAAc,GAAI,MAAM,UAAU,EAAE,WAAW,aAAa,KAAG,UAC3B,CAAC;AAElD,qEAAqE;AACrE,eAAO,MAAM,WAAW,GAAI,SAAS,SAAS,MAAM,EAAE,EAAE,WAAW,aAAa,KAAG,UAC6B,CAAC;AAGjH;;;GAGG;AACH,qBAAa,eAAe;aAGJ,YAAY,EAAG,MAAM;aACrB,IAAI,EAAW,UAAU;aACzB,QAAQ,EAAO,MAAM;aACrB,QAAQ,EAAO,MAAM;aACrB,KAAK,EAAU,SAAS,IAAI,EAAE;aAC9B,KAAK,EAAU,MAAM;aACrB,IAAI,EAAW,MAAM;aACrB,SAAS,EAAM,SAAS,UAAU,EAAE;aACpC,IAAI,EAAW,UAAU;IAT7C,OAAO;WAaO,KAAK,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,eAAe;IA2BlE;;;OAGG;IACI,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;CAe9C;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/history/commit.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const SignatureRoles: {
|
|
|
12
12
|
readonly ChargingStationOperator: "chargingStationOperator";
|
|
13
13
|
readonly Witness: "witness";
|
|
14
14
|
};
|
|
15
|
-
/** A signature of a commit or a checkpoint (5.4, 10.2), its
|
|
15
|
+
/** A signature of a commit or a checkpoint (5.4, 10.2), as WWCP_POI3 reads it: its role, time, algorithm, key and value trimmed. */
|
|
16
16
|
export interface RoleSignature {
|
|
17
17
|
readonly role: string;
|
|
18
18
|
readonly signer: string | undefined;
|
|
@@ -23,6 +23,18 @@ export interface RoleSignature {
|
|
|
23
23
|
readonly json: JSONObject;
|
|
24
24
|
}
|
|
25
25
|
export declare function parseRoleSignature(value: JSONValue | undefined, what: string): RoleSignature;
|
|
26
|
+
/** Whether two signatures of a commit or checkpoint are the same: of one role, signer, time, algorithm, key and value. */
|
|
27
|
+
export declare const sameRoleSignature: (a: RoleSignature, b: RoleSignature) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether two signatures of a commit or checkpoint are of one key in one role (`IsOfTheSameKeyAndRoleAs` of WWCP_POI):
|
|
30
|
+
* where a checkpoint is taken, the first of them that verifies is kept (S39).
|
|
31
|
+
*/
|
|
32
|
+
export declare const ofTheSameKeyAndRole: (a: RoleSignature, b: RoleSignature) => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* A signature of a commit or checkpoint as WWCP_POI names it in its messages (`ToString`): its role, its signer if it
|
|
35
|
+
* names one, its key and when it signed.
|
|
36
|
+
*/
|
|
37
|
+
export declare const describeRoleSignature: (signature: RoleSignature) => string;
|
|
26
38
|
/** The signature input of a commit or checkpoint signature: its own fields, and what it signs under `property`. */
|
|
27
39
|
export declare function roleSignatureBytes(context: string, signature: RoleSignature, property: string, signed: JSONObject): Uint8Array;
|
|
28
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../src/history/commit.ts"],"names":[],"mappings":"AAmBA,OAAO,
|
|
1
|
+
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../src/history/commit.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAO,OAAO,EAAqB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEpG,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA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qBAAa,MAAM;aAGK,EAAE,EAAmB,MAAM;aAC3B,gBAAgB,EAAK,MAAM;aAC3B,QAAQ,EAAa,MAAM;aAC3B,KAAK,EAAgB,SAAS,IAAI,EAAE;aACpC,KAAK,EAAgB,MAAM;aAC3B,SAAS,EAAY,SAAS,MAAM,EAAE;aACtC,SAAS,EAAY,UAAU,GAAG,SAAS;aAC3C,UAAU,EAAW,SAAS,aAAa,EAAE;aAC7C,kBAAkB,EAAG,aAAa;IAClD,4GAA4G;aAC5F,QAAQ,EAAa,aAAa,GAAG,SAAS;aAC9C,IAAI,EAAiB,UAAU;IAZnD,OAAO;IAgBP;;;;OAIG;WACW,SAAS,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM;WAgB3E,KAAK,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM;IAsGzD,sHAAsH;IAC/G,qBAAqB,IAAI,UAAU;IAY1C,2HAA2H;IACpH,aAAa,IAAI,UAAU;IAYlC,0DAA0D;IACnD,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,UAAU;IAIzD,8EAA8E;IACvE,eAAe,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,GAAG,IAAI;IASzE,gEAAgE;IAChE,IAAW,WAAW,IAAI,MAAM,GAAG,SAAS,CAG3C;IAED,+GAA+G;IACxG,cAAc,IAAI,UAAU;CAItC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type JSONValue } from '../json/value.ts';
|
|
2
|
+
import type { Change, ElementPathSegment } from './changeSet.ts';
|
|
3
|
+
/** An element path as a text for messages, e.g. `chargingConnectors['1'].maxPower` (`PathText`). */
|
|
4
|
+
export declare function pathText(path: readonly ElementPathSegment[], propertyName?: string): string;
|
|
5
|
+
/** What an element change makes of the property its path starts with, or why it does not apply. */
|
|
6
|
+
export type ElementApplied = {
|
|
7
|
+
readonly error: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly error?: undefined;
|
|
10
|
+
readonly newValue: JSONValue | undefined;
|
|
11
|
+
readonly current: JSONValue | undefined;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Applies an element change to the value of the property of the entity its path starts with (`POIElements.TryApply`):
|
|
15
|
+
* the new value of that property, `undefined` when it is removed, and the value the change finds, as its old value names
|
|
16
|
+
* it: the element, or the property of the element, `undefined` when absent. The given value is not changed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function applyElement(change: Change, propertyValue: JSONValue | undefined): ElementApplied;
|
|
19
|
+
//# sourceMappingURL=elements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/history/elements.ts"],"names":[],"mappings":"AAkBA,OAAO,EAA8E,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG9H,OAAO,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAgIjE,oGAAoG;AACpG,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,kBAAkB,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3F;AAGD,mGAAmG;AACnG,MAAM,MAAM,cAAc,GACpB;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,CAAC;AAGxH;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,GAAG,SAAS,GAAG,cAAc,CA+LjG"}
|