@open-charging-cloud/wwcp-poi 0.2.0 → 0.4.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 +658 -1
- package/README.md +106 -38
- package/dist/common.d.ts +11 -0
- package/dist/common.d.ts.map +1 -1
- 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 +126 -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 +30 -4
- 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 +21 -3
- 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 +23 -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 +10170 -2047
- 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 +7 -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 +175 -0
- package/dist/network/poiJSON.d.ts.map +1 -0
- package/dist/network/poiValues.d.ts +55 -0
- package/dist/network/poiValues.d.ts.map +1 -0
- package/dist/network/reading.d.ts +58 -0
- package/dist/network/reading.d.ts.map +1 -0
- package/dist/network/references.d.ts +43 -0
- package/dist/network/references.d.ts.map +1 -0
- package/dist/network/roamingNetwork.d.ts +17 -12
- 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 +27 -1
- package/dist/network/writtenForm.d.ts.map +1 -1
- package/dist/proofs/keyStatement.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/dist/verifier/grossRates.d.ts +11 -0
- package/dist/verifier/grossRates.d.ts.map +1 -0
- package/dist/verifier/sessionPrices.d.ts +3 -0
- package/dist/verifier/sessionPrices.d.ts.map +1 -1
- package/package.json +14 -13
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Decimal } from '../json/decimal.ts';
|
|
2
|
+
import { type JSONObject } from '../json/value.ts';
|
|
3
|
+
import type { EVTalerCovers } from './step.ts';
|
|
4
|
+
/**
|
|
5
|
+
* A number as System.Decimal holds and calculates it: a mantissa below 2^96 and at most 28 decimal places; a result it can
|
|
6
|
+
* not hold exactly rounded half to even, to as many places as it holds (DecCalc of .NET).
|
|
7
|
+
*/
|
|
8
|
+
export declare class NetDecimal {
|
|
9
|
+
readonly mantissa: bigint;
|
|
10
|
+
readonly scale: number;
|
|
11
|
+
private constructor();
|
|
12
|
+
static readonly ZERO: NetDecimal;
|
|
13
|
+
/** The given mantissa and scale, rounded half to even to what System.Decimal holds. */
|
|
14
|
+
private static fitted;
|
|
15
|
+
static of(value: number | bigint | Decimal): NetDecimal;
|
|
16
|
+
/** A text of digits, as `Decimal.TryParse` with `NumberStyles.AllowDecimalPoint` reads it; undefined beyond its range. */
|
|
17
|
+
static parse(text: string): NetDecimal | undefined;
|
|
18
|
+
/** An exact quotient of integers, e.g. milliseconds as seconds. */
|
|
19
|
+
static ofFraction(mantissa: bigint, scale: number): NetDecimal;
|
|
20
|
+
private aligned;
|
|
21
|
+
plus(other: NetDecimal): NetDecimal;
|
|
22
|
+
minus(other: NetDecimal): NetDecimal;
|
|
23
|
+
times(other: NetDecimal): NetDecimal;
|
|
24
|
+
/** The quotient as System.Decimal divides: exact where it holds it, else rounded half to even to as many places as it holds. */
|
|
25
|
+
dividedBy(other: NetDecimal): NetDecimal;
|
|
26
|
+
compareTo(other: NetDecimal): -1 | 0 | 1;
|
|
27
|
+
equals(other: NetDecimal): boolean;
|
|
28
|
+
isNegative(): boolean;
|
|
29
|
+
/** `Math.Round` to the given number of decimal places in the given way. */
|
|
30
|
+
round(places: number, mode: 'toEven' | 'awayFromZero' | 'toPositiveInfinity' | 'toZero'): NetDecimal;
|
|
31
|
+
/** `Math.Ceiling`. */
|
|
32
|
+
ceiling(): NetDecimal;
|
|
33
|
+
/** The digits of the given number of decimal places, as `ToString("F" + places)` writes a value that has no more. */
|
|
34
|
+
toFixed(places: number): string;
|
|
35
|
+
/** As `ToString("0.############################")` writes it: without trailing zeros, "-0" as "0". */
|
|
36
|
+
toString(): string;
|
|
37
|
+
}
|
|
38
|
+
/** The number of decimal digits of the minor unit of the given ISO 4217 currency: 2 unless it is known otherwise. */
|
|
39
|
+
export declare const minorUnitDigits: (currency: string) => number;
|
|
40
|
+
/** The given value rounded up to the minor unit of the given currency, as the amount of a step. */
|
|
41
|
+
export declare const roundUp: (value: NetDecimal, currency: string) => NetDecimal;
|
|
42
|
+
/** The given value rounded to the nearest minor unit of the given currency, half away from zero, as the price of a session. */
|
|
43
|
+
export declare const roundToNearest: (value: NetDecimal, currency: string) => NetDecimal;
|
|
44
|
+
/** The given amount with the digits of the minor unit of its currency, e.g. "3.20", or with all of its digits where it has more. */
|
|
45
|
+
export declare function writeAmount(value: NetDecimal, currency: string): string;
|
|
46
|
+
/** The given value as a text without trailing zeros, e.g. "13.412". */
|
|
47
|
+
export declare const writeDecimal: (value: NetDecimal) => string;
|
|
48
|
+
/**
|
|
49
|
+
* An amount as GNU Taler writes it, e.g. "EUR:3.25": a currency of at most 11 letters, no sign, at most 8 fractional
|
|
50
|
+
* digits, an integer part of at most 2^52; its error otherwise, as WWCP_POI words it.
|
|
51
|
+
*/
|
|
52
|
+
export declare function talerAmountOf(text: string | undefined): {
|
|
53
|
+
currency: string;
|
|
54
|
+
value: NetDecimal;
|
|
55
|
+
} | string;
|
|
56
|
+
/** The given property as a decimal written as a text, not negative, e.g. "13.412"; its error otherwise. */
|
|
57
|
+
export declare function decimalTextOf(json: JSONObject, name: string): NetDecimal | string;
|
|
58
|
+
/**
|
|
59
|
+
* The gross rates an EV Taler session is priced by, where its prices are those of the simple profile (`EVTalerRates`): one
|
|
60
|
+
* element, without restrictions, of ENERGY, TIME and FLAT components each at most once, with their VAT added; no minimum
|
|
61
|
+
* or maximum price. A session of other prices is paid in steps all the same, but its amounts and its price are not
|
|
62
|
+
* recalculated by a reader.
|
|
63
|
+
*/
|
|
64
|
+
export declare class EVTalerRates {
|
|
65
|
+
readonly currency: string;
|
|
66
|
+
/** The gross price of a kWh, if the tariff prices energy. */
|
|
67
|
+
readonly energyPerKWh: NetDecimal | undefined;
|
|
68
|
+
/** The billing increment of energy, in Wh. */
|
|
69
|
+
readonly energyStepWh: NetDecimal | undefined;
|
|
70
|
+
/** The gross price of an hour of charging, if the tariff prices time. */
|
|
71
|
+
readonly timePerHour: NetDecimal | undefined;
|
|
72
|
+
/** The billing increment of time, in seconds. */
|
|
73
|
+
readonly timeStepSeconds: NetDecimal | undefined;
|
|
74
|
+
/** The gross flat fee, if any. */
|
|
75
|
+
readonly flatFee: NetDecimal | undefined;
|
|
76
|
+
private constructor();
|
|
77
|
+
/** The rates of the simple profile of the given elements of the given charging tariff, or why there are none. */
|
|
78
|
+
static of(currency: string, tariff: JSONObject, elements: readonly JSONObject[]): EVTalerRates | {
|
|
79
|
+
readonly reason: string;
|
|
80
|
+
};
|
|
81
|
+
/** The price of what a step covers, rounded up to the minor unit: its kWh at the price of energy, its minutes at the price of time. */
|
|
82
|
+
stepPrice(covers: EVTalerCovers): NetDecimal | string;
|
|
83
|
+
/**
|
|
84
|
+
* The price of a session of the given energy, in kWh, and duration, in milliseconds: the flat fee, the energy and the
|
|
85
|
+
* time each billed in its increments, rounded to the nearest minor unit of the currency.
|
|
86
|
+
*/
|
|
87
|
+
sessionPrice(energy: NetDecimal, durationMs: number): NetDecimal;
|
|
88
|
+
}
|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WACnG,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,UAAU,EAAE,GAAG,YAAY,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IA0DnI,uIAAuI;IAChI,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,UAAU,GAAG,MAAM;IAgB5D;;;OAGG;IACI,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU;CAiB1E"}
|
|
@@ -0,0 +1,126 @@
|
|
|
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
|
+
/** What prices a session at an EVSE (`EVTalerContractTerms.TryGetSessionPrices`): its tariff, a price statement, the elements. */
|
|
102
|
+
export interface EVTalerSessionPrices {
|
|
103
|
+
/** The EV Taler tariff of the EVSE, as the proof gives it. */
|
|
104
|
+
readonly tariff: JSONObject;
|
|
105
|
+
/** The price statement that prices the session, if any. */
|
|
106
|
+
readonly priceStatement?: VerifiedPrice;
|
|
107
|
+
/** The elements that price the session: of the price statement, else of the tariff. */
|
|
108
|
+
readonly elements: readonly JSONObject[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* What prices a session at the given EVSE that begins at the given time, as the backend of an operator makes its steps
|
|
112
|
+
* and `verify` checks them (`EVTalerContractTerms.TryGetSessionPrices` of WWCP_POI 62390ca, concepts/EVTaler.md 4.3): the
|
|
113
|
+
* EV Taler tariff of the EVSE, the price statement current then that prices it, the one of an EVSE before the one of the
|
|
114
|
+
* station before the one of its pool, if there is one, and the elements, of that statement or else of the tariff itself.
|
|
115
|
+
* Refused in the words of WWCP_POI where there is no EV Taler tariff or the price statements do not verify.
|
|
116
|
+
*
|
|
117
|
+
* @param priceStatements The price statements of the station, its pool and its EVSEs, as JSON.
|
|
118
|
+
*/
|
|
119
|
+
export declare function evTalerSessionPrices(station: VerifiedChargingStation, evseId: string, priceStatements: JSONValue, at: number | Date | string): EVTalerSessionPrices;
|
|
120
|
+
/**
|
|
121
|
+
* The EV Taler tariff of the given EVSE, as the proof gives its tariffs (`EVTalerContractTerms.TryGetEVTalerTariff`, 4.3):
|
|
122
|
+
* the first of the type AD_HOC_PAYMENT, else the first without a type, with a currency, naming no payment means or
|
|
123
|
+
* EV_TALER among them; refused in the words of WWCP_POI otherwise.
|
|
124
|
+
*/
|
|
125
|
+
export declare function evTalerTariff(station: VerifiedChargingStation, evseId: string): JSONObject;
|
|
126
|
+
//# 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,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,OAAO,mBAAmB,CAAC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E,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;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C,4IAA4I;AAC5I,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,iBAAiB,EAAG,MAAM,CAAC;IACpC,wDAAwD;IACxD,QAAQ,CAAC,SAAS,EAAW,MAAM,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAc,UAAU,CAAC;CAC3C;AAED,yHAAyH;AACzH,MAAM,WAAW,qBAAqB;IAClC,QAAQ,CAAC,EAAE,EAAK,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAI,UAAU,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAG,UAAU,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,uBAAuB,EAAE,GAAG,EAAE,qBAAqB,KAAK,mBAAmB,CAAC;AAE5H,mHAAmH;AACnH,MAAM,WAAW,yBAAyB;IACtC,QAAQ,CAAC,KAAK,EAAM,uBAAuB,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAI,mBAAmB,CAAC;IACxC,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAM,MAAM,CAAC;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;CAC9B;AAcD;;;GAGG;AACH,qBAAa,uBAAuB;IAG5B,iEAAiE;aACjD,eAAe,EAAG,MAAM;IACxC,6CAA6C;aAC7B,cAAc,EAAI,MAAM;IACxC,oEAAoE;aACpD,aAAa,EAAK,MAAM,GAAG,SAAS;IACpD,yIAAyI;aACzH,SAAS,EAAS,MAAM,GAAG,SAAS;IARxD,OAAO;IAWP,qHAAqH;WACvG,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,uBAAuB;IAQ1I;;;OAGG;WACW,KAAK,CAAC,IAAI,EAAE,SAAS,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,EAA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,IAAW,cAAc,IAAQ,MAAM,GAAG,SAAS,CAA6G;IAChK,IAAW,QAAQ,IAAc,MAAM,CAAkC;IACzE,gDAAgD;IAChD,IAAW,MAAM,IAAgB,MAAM,CAAgC;IACvE,IAAW,SAAS,IAAa,MAAM,CAAmC;IAC1E,kCAAkC;IAClC,IAAW,KAAK,IAAiB,MAAM,CAA+B;IACtE,6BAA6B;IAC7B,IAAW,KAAK,IAAiB,MAAM,CAA+B;IAEtE;;;;OAIG;WACW,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,iBAAiB;IAyFnE,+EAA+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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GAAG,SAAS;IACrD,6CAA6C;aAC7B,gBAAgB,EAAG,MAAM;IACzC,yGAAyG;aACzF,cAAc,EAAK,MAAM,GAAG,SAAS;aACrC,MAAM,EAAa,aAAa;IAChD,kGAAkG;aAClF,eAAe,EAAI,uBAAuB,GAAG,SAAS;IAjB1E,OAAO;IAoBP,gGAAgG;WAClF,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW;IAkBxD;;;OAGG;WACW,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW;IA0D7D,0CAA0C;IACnC,MAAM,IAAI,UAAU;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,
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/history/apply.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiC,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAS7F,OAAO,EAAoD,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAs4DlG;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAsNjF;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,CAmHvI"}
|
|
@@ -1,17 +1,39 @@
|
|
|
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;
|
|
7
|
+
/** The context of a change, where it is given; WWCP_POI3 writes a change within its change set without it. */
|
|
8
|
+
export declare const CHANGE_CONTEXT: string;
|
|
6
9
|
/** How the identification of the change set of a merge starts, which is identified by its parents, not by its content (5.3). */
|
|
7
10
|
export declare const MERGE_CHANGE_SET_ID_PREFIX = "merge-";
|
|
8
11
|
/**
|
|
9
12
|
* The identification of a change set by its content (4): the SHA-256 of its canonical JSON with its context, without
|
|
10
|
-
* `@id` and its signatures, as 64 lowercase hex digits, in every epoch.
|
|
13
|
+
* `@id` and its signatures, as 64 lowercase hex digits, in every epoch; of its content as WWCP_POI3 reads it (`asRead`).
|
|
11
14
|
*/
|
|
12
15
|
export declare function changeSetIdentification(json: JSONObject): string;
|
|
16
|
+
/**
|
|
17
|
+
* A change set as WWCP_POI3 writes it again (`ToJSON`), as its identification, its signatures and the identification and
|
|
18
|
+
* signatures of a commit embedding it are of it (`asRead`): its context and its signatures as given.
|
|
19
|
+
*/
|
|
20
|
+
export declare const changeSetAsWritten: (json: JSONObject) => JSONObject;
|
|
13
21
|
/** The kinds of changes (SPECIFICATION.md section 4). */
|
|
14
22
|
export type ChangeKind = 'Add' | 'Remove' | 'UpdateProperty' | 'RemoveProperty' | 'AddElement' | 'RemoveElement' | 'ReplaceElement' | 'UpdateElementProperty' | 'RemoveElementProperty';
|
|
23
|
+
/** The context of a segment of an element path, where it is given. */
|
|
24
|
+
export declare const ELEMENT_PATH_SEGMENT_CONTEXT: string;
|
|
25
|
+
/**
|
|
26
|
+
* One step of an element path (`POIElementPathSegment`): a property of the entity, or of the element the step before
|
|
27
|
+
* addresses, and the identification of an element of it, which an array needs and one identified object may name.
|
|
28
|
+
*/
|
|
29
|
+
export interface ElementPathSegment {
|
|
30
|
+
readonly propertyName: string;
|
|
31
|
+
readonly elementId: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** Whether a change addresses an element of a property of its entity by its element path. */
|
|
34
|
+
export declare const isElementChange: (change: Change) => boolean;
|
|
35
|
+
/** The property of the entity itself a change changes: of an element change the one its path starts with. */
|
|
36
|
+
export declare const entityPropertyName: (change: Change) => string | undefined;
|
|
15
37
|
/** One change of a change set. */
|
|
16
38
|
export interface Change {
|
|
17
39
|
readonly kind: ChangeKind;
|
|
@@ -23,7 +45,8 @@ export interface Change {
|
|
|
23
45
|
readonly newValue: JSONValue | undefined;
|
|
24
46
|
readonly parentEntityType: string | undefined;
|
|
25
47
|
readonly parentEntityId: string | undefined;
|
|
26
|
-
|
|
48
|
+
/** The element path of an element change, not empty; `undefined` for every other change. */
|
|
49
|
+
readonly elementPath: readonly ElementPathSegment[] | undefined;
|
|
27
50
|
readonly json: JSONObject;
|
|
28
51
|
}
|
|
29
52
|
/** 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 +64,7 @@ export declare class ChangeSet {
|
|
|
41
64
|
readonly roamingNetworkId: string;
|
|
42
65
|
readonly createdAt: number;
|
|
43
66
|
readonly changes: readonly Change[];
|
|
44
|
-
readonly preconditions: readonly
|
|
67
|
+
readonly preconditions: readonly Precondition[];
|
|
45
68
|
readonly beforeETags: readonly ETag[];
|
|
46
69
|
readonly afterETags: readonly ETag[];
|
|
47
70
|
readonly signatures: readonly ChangeSetSignature[];
|
|
@@ -50,7 +73,10 @@ export declare class ChangeSet {
|
|
|
50
73
|
static parse(value: JSONValue | undefined): ChangeSet;
|
|
51
74
|
/** The description in its first language. */
|
|
52
75
|
get description(): string | undefined;
|
|
53
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* The signature input of one of its signatures (4): the context, its algorithm and key, and the change set without
|
|
78
|
+
* signatures, as WWCP_POI3 writes it again (`ToJSON(Embedded: true, IncludeSignatures: false)`), as it is identified.
|
|
79
|
+
*/
|
|
54
80
|
signingBytes(signature: ChangeSetSignature): Uint8Array;
|
|
55
81
|
/** Verifies one signature with the given key. */
|
|
56
82
|
verifySignature(signature: ChangeSetSignature, key: POIPublicKey): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changeSet.d.ts","sourceRoot":"","sources":["../../src/history/changeSet.ts"],"names":[],"mappings":"AAmBA,OAAO,
|
|
1
|
+
{"version":3,"file":"changeSet.d.ts","sourceRoot":"","sources":["../../src/history/changeSet.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgD,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIjH,OAAO,EAAyB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KA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