@open-charging-cloud/chargy-gui 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/LICENSE +661 -0
- package/README.md +48 -2
- package/SECURITY.md +21 -0
- package/dist/anchorKeyTrust.d.ts +9 -0
- package/dist/anchorKeyTrust.d.ts.map +1 -0
- package/dist/anchorKeyTrust.js +24 -0
- package/dist/anchorKeyTrust.js.map +1 -0
- package/dist/anchorKeyTrustView.d.ts +14 -0
- package/dist/anchorKeyTrustView.d.ts.map +1 -0
- package/dist/anchorKeyTrustView.js +95 -0
- package/dist/anchorKeyTrustView.js.map +1 -0
- package/dist/browserFiles.d.ts +5 -0
- package/dist/browserFiles.d.ts.map +1 -0
- package/dist/browserFiles.js +100 -0
- package/dist/browserFiles.js.map +1 -0
- package/dist/core/i18n.json +1518 -0
- package/dist/core/package.json +119 -0
- package/dist/core/validationRules.json +8 -0
- package/dist/domHelpers.d.ts +25 -0
- package/dist/domHelpers.d.ts.map +1 -0
- package/dist/domHelpers.js +212 -0
- package/dist/domHelpers.js.map +1 -0
- package/dist/historicalSessionPanel.d.ts +24 -0
- package/dist/historicalSessionPanel.d.ts.map +1 -0
- package/dist/historicalSessionPanel.js +108 -0
- package/dist/historicalSessionPanel.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/liveLinkTrust.d.ts +208 -0
- package/dist/liveLinkTrust.d.ts.map +1 -0
- package/dist/liveLinkTrust.js +452 -0
- package/dist/liveLinkTrust.js.map +1 -0
- package/dist/livePOISession.d.ts +38 -0
- package/dist/livePOISession.d.ts.map +1 -0
- package/dist/livePOISession.js +193 -0
- package/dist/livePOISession.js.map +1 -0
- package/dist/measurementDetailsRenderer.d.ts +25 -0
- package/dist/measurementDetailsRenderer.d.ts.map +1 -0
- package/dist/measurementDetailsRenderer.js +343 -0
- package/dist/measurementDetailsRenderer.js.map +1 -0
- package/dist/poiConsistencyView.d.ts +3 -0
- package/dist/poiConsistencyView.d.ts.map +1 -0
- package/dist/poiConsistencyView.js +14 -0
- package/dist/poiConsistencyView.js.map +1 -0
- package/dist/poiObservedHistory.d.ts +49 -0
- package/dist/poiObservedHistory.d.ts.map +1 -0
- package/dist/poiObservedHistory.js +205 -0
- package/dist/poiObservedHistory.js.map +1 -0
- package/dist/poiTransport.d.ts +12 -0
- package/dist/poiTransport.d.ts.map +1 -0
- package/dist/poiTransport.js +74 -0
- package/dist/poiTransport.js.map +1 -0
- package/dist/poiTrustContext.d.ts +134 -0
- package/dist/poiTrustContext.d.ts.map +1 -0
- package/dist/poiTrustContext.js +243 -0
- package/dist/poiTrustContext.js.map +1 -0
- package/dist/poiTrustLineage.d.ts +10 -0
- package/dist/poiTrustLineage.d.ts.map +1 -0
- package/dist/poiTrustLineage.js +47 -0
- package/dist/poiTrustLineage.js.map +1 -0
- package/dist/poiURLs.d.ts +5 -0
- package/dist/poiURLs.d.ts.map +1 -0
- package/dist/poiURLs.js +24 -0
- package/dist/poiURLs.js.map +1 -0
- package/dist/poiWitnessManagement.d.ts +3 -0
- package/dist/poiWitnessManagement.d.ts.map +1 -0
- package/dist/poiWitnessManagement.js +127 -0
- package/dist/poiWitnessManagement.js.map +1 -0
- package/dist/poiWitnessTrust.d.ts +26 -0
- package/dist/poiWitnessTrust.d.ts.map +1 -0
- package/dist/poiWitnessTrust.js +90 -0
- package/dist/poiWitnessTrust.js.map +1 -0
- package/dist/pricePublicationData.d.ts +19 -0
- package/dist/pricePublicationData.d.ts.map +1 -0
- package/dist/pricePublicationData.js +83 -0
- package/dist/pricePublicationData.js.map +1 -0
- package/dist/roamingNetworks.d.ts +14 -0
- package/dist/roamingNetworks.d.ts.map +1 -0
- package/dist/roamingNetworks.js +33 -0
- package/dist/roamingNetworks.js.map +1 -0
- package/dist/securityFingerprint.d.ts +16 -0
- package/dist/securityFingerprint.d.ts.map +1 -0
- package/dist/securityFingerprint.js +36 -0
- package/dist/securityFingerprint.js.map +1 -0
- package/dist/securityFingerprintView.d.ts +3 -0
- package/dist/securityFingerprintView.d.ts.map +1 -0
- package/dist/securityFingerprintView.js +61 -0
- package/dist/securityFingerprintView.js.map +1 -0
- package/dist/sessionEvidenceStore.d.ts +23 -0
- package/dist/sessionEvidenceStore.d.ts.map +1 -0
- package/dist/sessionEvidenceStore.js +81 -0
- package/dist/sessionEvidenceStore.js.map +1 -0
- package/dist/sessionMeterKeyView.d.ts +9 -0
- package/dist/sessionMeterKeyView.d.ts.map +1 -0
- package/dist/sessionMeterKeyView.js +55 -0
- package/dist/sessionMeterKeyView.js.map +1 -0
- package/dist/sessionPOIData.d.ts +49 -0
- package/dist/sessionPOIData.d.ts.map +1 -0
- package/dist/sessionPOIData.js +161 -0
- package/dist/sessionPOIData.js.map +1 -0
- package/dist/sessionPOIPanel.d.ts +50 -0
- package/dist/sessionPOIPanel.d.ts.map +1 -0
- package/dist/sessionPOIPanel.js +288 -0
- package/dist/sessionPOIPanel.js.map +1 -0
- package/dist/sessionPriceData.d.ts +17 -0
- package/dist/sessionPriceData.d.ts.map +1 -0
- package/dist/sessionPriceData.js +51 -0
- package/dist/sessionPriceData.js.map +1 -0
- package/dist/sessionPricePanel.d.ts +31 -0
- package/dist/sessionPricePanel.d.ts.map +1 -0
- package/dist/sessionPricePanel.js +222 -0
- package/dist/sessionPricePanel.js.map +1 -0
- package/dist/sessionUIState.d.ts +12 -0
- package/dist/sessionUIState.d.ts.map +1 -0
- package/dist/sessionUIState.js +33 -0
- package/dist/sessionUIState.js.map +1 -0
- package/dist/stationProofData.d.ts +38 -0
- package/dist/stationProofData.d.ts.map +1 -0
- package/dist/stationProofData.js +83 -0
- package/dist/stationProofData.js.map +1 -0
- package/dist/stationProofPanel.d.ts +44 -0
- package/dist/stationProofPanel.d.ts.map +1 -0
- package/dist/stationProofPanel.js +304 -0
- package/dist/stationProofPanel.js.map +1 -0
- package/dist/stationProofView.d.ts +9 -0
- package/dist/stationProofView.d.ts.map +1 -0
- package/dist/stationProofView.js +186 -0
- package/dist/stationProofView.js.map +1 -0
- package/dist/trustAnchorData.d.ts +40 -0
- package/dist/trustAnchorData.d.ts.map +1 -0
- package/dist/trustAnchorData.js +91 -0
- package/dist/trustAnchorData.js.map +1 -0
- package/dist/trustAnchorDataView.d.ts +13 -0
- package/dist/trustAnchorDataView.d.ts.map +1 -0
- package/dist/trustAnchorDataView.js +69 -0
- package/dist/trustAnchorDataView.js.map +1 -0
- package/dist/trustAnchorImport.d.ts +5 -0
- package/dist/trustAnchorImport.d.ts.map +1 -0
- package/dist/trustAnchorImport.js +34 -0
- package/dist/trustAnchorImport.js.map +1 -0
- package/dist/trustAnchorPreview.d.ts +37 -0
- package/dist/trustAnchorPreview.d.ts.map +1 -0
- package/dist/trustAnchorPreview.js +180 -0
- package/dist/trustAnchorPreview.js.map +1 -0
- package/dist/trustManagement.d.ts +34 -0
- package/dist/trustManagement.d.ts.map +1 -0
- package/dist/trustManagement.js +405 -0
- package/dist/trustManagement.js.map +1 -0
- package/dist/trustStore.d.ts +75 -0
- package/dist/trustStore.d.ts.map +1 -0
- package/dist/trustStore.js +408 -0
- package/dist/trustStore.js.map +1 -0
- package/dist/trustTransitionView.d.ts +5 -0
- package/dist/trustTransitionView.d.ts.map +1 -0
- package/dist/trustTransitionView.js +110 -0
- package/dist/trustTransitionView.js.map +1 -0
- package/dist/trustedPublicKeys.d.ts +4 -0
- package/dist/trustedPublicKeys.d.ts.map +1 -0
- package/dist/trustedPublicKeys.js +25 -0
- package/dist/trustedPublicKeys.js.map +1 -0
- package/dist/wwcpPoi.d.ts +2 -0
- package/dist/wwcpPoi.d.ts.map +1 -0
- package/dist/wwcpPoi.js +2 -0
- package/dist/wwcpPoi.js.map +1 -0
- package/documentation/AUDIT.md +262 -0
- package/images/NGI0_tag.svg +149 -0
- package/package.json +75 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018-2026 GraphDefined GmbH <achim.friedland@graphdefined.com>
|
|
3
|
+
* This file is part of ChargyGUI <https://github.com/OpenChargingCloud/ChargyGUI.TS>
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Affero GPL license, Version 3.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.gnu.org/licenses/agpl.html
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export * from "@open-charging-cloud/chargy-core";
|
|
18
|
+
export * from "./anchorKeyTrust.js";
|
|
19
|
+
export * from "./anchorKeyTrustView.js";
|
|
20
|
+
export * from "./browserFiles.js";
|
|
21
|
+
export * from "./domHelpers.js";
|
|
22
|
+
export * from "./historicalSessionPanel.js";
|
|
23
|
+
export * from "./liveLinkTrust.js";
|
|
24
|
+
export * from "./livePOISession.js";
|
|
25
|
+
export * from "./measurementDetailsRenderer.js";
|
|
26
|
+
export * from "./poiConsistencyView.js";
|
|
27
|
+
export * from "./poiObservedHistory.js";
|
|
28
|
+
export * from "./poiTransport.js";
|
|
29
|
+
export * from "./poiTrustContext.js";
|
|
30
|
+
export * from "./poiTrustLineage.js";
|
|
31
|
+
export * from "./poiURLs.js";
|
|
32
|
+
export * from "./poiWitnessManagement.js";
|
|
33
|
+
export * from "./poiWitnessTrust.js";
|
|
34
|
+
export * from "./pricePublicationData.js";
|
|
35
|
+
export * from "./roamingNetworks.js";
|
|
36
|
+
export * from "./securityFingerprint.js";
|
|
37
|
+
export * from "./securityFingerprintView.js";
|
|
38
|
+
export * from "./sessionEvidenceStore.js";
|
|
39
|
+
export * from "./sessionMeterKeyView.js";
|
|
40
|
+
export * from "./sessionPOIData.js";
|
|
41
|
+
export * from "./sessionPOIPanel.js";
|
|
42
|
+
export * from "./sessionPriceData.js";
|
|
43
|
+
export * from "./sessionPricePanel.js";
|
|
44
|
+
export * from "./sessionUIState.js";
|
|
45
|
+
export * from "./stationProofData.js";
|
|
46
|
+
export * from "./stationProofPanel.js";
|
|
47
|
+
export * from "./stationProofView.js";
|
|
48
|
+
export * from "./trustAnchorData.js";
|
|
49
|
+
export * from "./trustAnchorDataView.js";
|
|
50
|
+
export * from "./trustAnchorImport.js";
|
|
51
|
+
export * from "./trustAnchorPreview.js";
|
|
52
|
+
export * from "./trustedPublicKeys.js";
|
|
53
|
+
export * from "./trustManagement.js";
|
|
54
|
+
export * from "./trustStore.js";
|
|
55
|
+
export * from "./trustTransitionView.js";
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC","sourcesContent":["/*\n * Copyright (c) 2018-2026 GraphDefined GmbH <achim.friedland@graphdefined.com>\n * This file is part of ChargyGUI <https://github.com/OpenChargingCloud/ChargyGUI.TS>\n *\n * Licensed under the Affero GPL license, Version 3.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.gnu.org/licenses/agpl.html\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"@open-charging-cloud/chargy-core\";\nexport * from \"./anchorKeyTrust.js\";\nexport * from \"./anchorKeyTrustView.js\";\nexport * from \"./browserFiles.js\";\nexport * from \"./domHelpers.js\";\nexport * from \"./historicalSessionPanel.js\";\nexport * from \"./liveLinkTrust.js\";\nexport * from \"./livePOISession.js\";\nexport * from \"./measurementDetailsRenderer.js\";\nexport * from \"./poiConsistencyView.js\";\nexport * from \"./poiObservedHistory.js\";\nexport * from \"./poiTransport.js\";\nexport * from \"./poiTrustContext.js\";\nexport * from \"./poiTrustLineage.js\";\nexport * from \"./poiURLs.js\";\nexport * from \"./poiWitnessManagement.js\";\nexport * from \"./poiWitnessTrust.js\";\nexport * from \"./pricePublicationData.js\";\nexport * from \"./roamingNetworks.js\";\nexport * from \"./securityFingerprint.js\";\nexport * from \"./securityFingerprintView.js\";\nexport * from \"./sessionEvidenceStore.js\";\nexport * from \"./sessionMeterKeyView.js\";\nexport * from \"./sessionPOIData.js\";\nexport * from \"./sessionPOIPanel.js\";\nexport * from \"./sessionPriceData.js\";\nexport * from \"./sessionPricePanel.js\";\nexport * from \"./sessionUIState.js\";\nexport * from \"./stationProofData.js\";\nexport * from \"./stationProofPanel.js\";\nexport * from \"./stationProofView.js\";\nexport * from \"./trustAnchorData.js\";\nexport * from \"./trustAnchorDataView.js\";\nexport * from \"./trustAnchorImport.js\";\nexport * from \"./trustAnchorPreview.js\";\nexport * from \"./trustedPublicKeys.js\";\nexport * from \"./trustManagement.js\";\nexport * from \"./trustStore.js\";\nexport * from \"./trustTransitionView.js\";\n"]}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
export type TrustDecision = "allow" | "deny";
|
|
2
|
+
/**
|
|
3
|
+
* One remembered decision.
|
|
4
|
+
*
|
|
5
|
+
* The origin itself is not stored. Like OpenSSH's hashed known_hosts, each
|
|
6
|
+
* entry keeps a fresh random salt and the keyed hash of the origin instead:
|
|
7
|
+
* the store can still answer "have I seen this origin?" - the candidate
|
|
8
|
+
* arrives in plain text with every live link - but a copy of the store
|
|
9
|
+
* answers little on its own. What that buys, and what it does not:
|
|
10
|
+
*
|
|
11
|
+
* - A snapshot of the store (a synced browser profile, a backup, a moment of
|
|
12
|
+
* access to the machine) no longer reveals where its owner charges - which
|
|
13
|
+
* is a movement profile - nor does it hand over a ready-made list of CPO
|
|
14
|
+
* live-data endpoints to probe.
|
|
15
|
+
* - The per-entry salt prevents precomputed tables and correlation: the same
|
|
16
|
+
* origin hashes differently in every entry and every installation, so two
|
|
17
|
+
* stores cannot be matched against each other.
|
|
18
|
+
* - The honest limit, same as OpenSSH's: publicly known endpoints can still
|
|
19
|
+
* be tested against each entry, one guess at a time. The protection is for
|
|
20
|
+
* what is not on a public list - and it makes the store worthless as a
|
|
21
|
+
* harvesting target rather than unreadable in principle.
|
|
22
|
+
*
|
|
23
|
+
* The algorithm is stored per entry, so a future switch (say, to HMAC-SHA512)
|
|
24
|
+
* needs no migration: new entries simply use the new algorithm, old ones keep
|
|
25
|
+
* matching with theirs. An entry whose algorithm this version does not know is
|
|
26
|
+
* preserved but never matches - a newer version may still understand it.
|
|
27
|
+
*
|
|
28
|
+
* The label is the operator name the user saw in the consent dialog, kept so
|
|
29
|
+
* the settings screen can say "GraphDefined GmbH" instead of a hash - or an
|
|
30
|
+
* unhelpful cloud hostname. It names the operator, not the server: the
|
|
31
|
+
* topology stays hashed.
|
|
32
|
+
*/
|
|
33
|
+
export interface ITrustedOrigin {
|
|
34
|
+
algorithm: string;
|
|
35
|
+
salt: string;
|
|
36
|
+
hash: string;
|
|
37
|
+
label: string;
|
|
38
|
+
decision: TrustDecision;
|
|
39
|
+
since: string;
|
|
40
|
+
lastUsed: string;
|
|
41
|
+
}
|
|
42
|
+
/** The remembered decisions, plus how long an unused one is kept. */
|
|
43
|
+
export interface ITrustedOriginsStore {
|
|
44
|
+
/**
|
|
45
|
+
* After how many months WITHOUT USE a decision expires and is asked again,
|
|
46
|
+
* or null to keep decisions indefinitely. Every time a decision actually
|
|
47
|
+
* decides something - an allowed origin is polled, a denied one is blocked
|
|
48
|
+
* - its clock restarts, so an entry in regular use never expires. What
|
|
49
|
+
* fades is what stopped being used: a stale "always" whose server no
|
|
50
|
+
* longer appears in any document, entries for endpoints an operator has
|
|
51
|
+
* long since retired. Idle expiry, not forced re-consent.
|
|
52
|
+
*/
|
|
53
|
+
retentionMonths: number | null;
|
|
54
|
+
origins: Array<ITrustedOrigin>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The two bounds below are this application's policy, not the format's: how
|
|
58
|
+
* often an https transport is asked when a document does not say is the
|
|
59
|
+
* format's own default, and ChargyCore states it as defaultRefreshSeconds.
|
|
60
|
+
* Duplicating the number here would give it two sources of truth.
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* A reloading client can hammer a server no faster than this, whatever the
|
|
64
|
+
* document says: a viral QR code must not turn every phone that scans it
|
|
65
|
+
* into a flood.
|
|
66
|
+
*/
|
|
67
|
+
export declare const minimumRefreshSeconds = 5;
|
|
68
|
+
/**
|
|
69
|
+
* And no slower than this. The refresh period is a document-controlled number
|
|
70
|
+
* with no upper bound of its own, and a value large enough to overflow the
|
|
71
|
+
* timer delay wraps back to firing immediately - so a document could turn its
|
|
72
|
+
* own "poll rarely" into "poll as fast as the network answers" through the far
|
|
73
|
+
* end of the range. One day is longer than any charging session and safely
|
|
74
|
+
* inside the timer's integer range.
|
|
75
|
+
*/
|
|
76
|
+
export declare const maximumRefreshSeconds: number;
|
|
77
|
+
/**
|
|
78
|
+
* How much a poll answer may weigh when the origin was approved by the user
|
|
79
|
+
* rather than by externalURLs.conf, which states a limit per prefix.
|
|
80
|
+
*/
|
|
81
|
+
export declare const defaultTrustedPayloadBytes: number;
|
|
82
|
+
/** How long decisions are kept when the user has not said otherwise. */
|
|
83
|
+
export declare const defaultRetentionMonths = 6;
|
|
84
|
+
export declare const minimumRetentionMonths = 1;
|
|
85
|
+
export declare const maximumRetentionMonths = 120;
|
|
86
|
+
export declare const currentTrustHashAlgorithm = "HMAC-SHA-256";
|
|
87
|
+
/** Whether this entry is the remembered decision for the given origin. */
|
|
88
|
+
export declare function matchesTrustedOrigin(entry: ITrustedOrigin, origin: string): boolean;
|
|
89
|
+
/** The remembered decision for an origin, when there is one. */
|
|
90
|
+
export declare function findTrustedOrigin(store: ITrustedOriginsStore, origin: string): ITrustedOrigin | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Remembers a decision for an origin, replacing whatever was remembered
|
|
93
|
+
* before. The entry gets a fresh salt on every write; when the decision
|
|
94
|
+
* itself has not changed, its original date is kept, so reconsidering
|
|
95
|
+
* without changing anything does not reset "trusted since".
|
|
96
|
+
* Returns the entry as written.
|
|
97
|
+
*/
|
|
98
|
+
export declare function upsertTrustedOrigin(store: ITrustedOriginsStore, origin: string, decision: TrustDecision, label: string, nowISO: string): ITrustedOrigin;
|
|
99
|
+
/**
|
|
100
|
+
* How much newer a use has to be before it is worth persisting: the expiry is
|
|
101
|
+
* measured in months, so refreshing lastUsed more often than hourly would be
|
|
102
|
+
* pure storage churn for a live link that reloads every few seconds.
|
|
103
|
+
*/
|
|
104
|
+
export declare const lastUsedGranularityMs: number;
|
|
105
|
+
/**
|
|
106
|
+
* Records that the remembered decision for this origin was actually applied -
|
|
107
|
+
* an allowed origin polled, a denied one blocked. Every use restarts the idle
|
|
108
|
+
* expiry clock. Returns whether anything changed and is worth saving.
|
|
109
|
+
*/
|
|
110
|
+
export declare function touchTrustedOrigin(store: ITrustedOriginsStore, origin: string, now: Date): boolean;
|
|
111
|
+
/** Forgets the remembered decision for an origin. Returns whether one existed. */
|
|
112
|
+
export declare function removeTrustedOrigin(store: ITrustedOriginsStore, origin: string): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The label an entry is shown under: the operator name the user saw when
|
|
115
|
+
* consenting. Document text from outside, so control and format characters -
|
|
116
|
+
* newlines, zero-width characters, bidi overrides - are stripped, the rest is
|
|
117
|
+
* trimmed and capped. Rendering must additionally treat it as text, never as
|
|
118
|
+
* markup.
|
|
119
|
+
*/
|
|
120
|
+
export declare function sanitizeTrustLabel(value: unknown): string;
|
|
121
|
+
/**
|
|
122
|
+
* The label to actually store for a given origin. A label that contains the
|
|
123
|
+
* origin's host would smuggle the very plaintext back into storage that the
|
|
124
|
+
* hashing keeps out, so such a label is dropped - the entry then shows as an
|
|
125
|
+
* unknown operator, which is the honest price of a hostname-shaped name.
|
|
126
|
+
*/
|
|
127
|
+
export declare function trustLabelForOrigin(label: string, origin: string): string;
|
|
128
|
+
/**
|
|
129
|
+
* The retention setting, tolerantly: null means "keep indefinitely", numbers
|
|
130
|
+
* are clamped into [1, 120] months, and anything unusable falls back to the
|
|
131
|
+
* default rather than to "keep forever".
|
|
132
|
+
*/
|
|
133
|
+
export declare function sanitizeRetentionMonths(value: unknown): number | null;
|
|
134
|
+
/**
|
|
135
|
+
* When an entry expires, or null when decisions are kept indefinitely.
|
|
136
|
+
* Measured from the last use, not from the decision: using a decision
|
|
137
|
+
* restarts its clock, so only what lies unused actually runs out.
|
|
138
|
+
*/
|
|
139
|
+
export declare function trustedOriginExpiry(entry: ITrustedOrigin, retentionMonths: number | null): Date | null;
|
|
140
|
+
/**
|
|
141
|
+
* Drops every entry whose time is up. An entry whose date cannot be read
|
|
142
|
+
* counts as expired rather than immortal: with retention active, nothing may
|
|
143
|
+
* be un-forgettable. Returns whether anything changed.
|
|
144
|
+
*/
|
|
145
|
+
export declare function pruneExpiredTrustedOrigins(store: ITrustedOriginsStore, now: Date): boolean;
|
|
146
|
+
export declare function emptyTrustedOriginsStore(): ITrustedOriginsStore;
|
|
147
|
+
/**
|
|
148
|
+
* The stored decisions, tolerantly: anything that is not exactly an entry with
|
|
149
|
+
* a salt, a hash, an algorithm and a valid decision is dropped rather than
|
|
150
|
+
* trusted by accident, and a store that cannot be parsed at all counts as
|
|
151
|
+
* empty - the user is simply asked again. Entries with an algorithm this
|
|
152
|
+
* version does not know are kept: they never match here, but a newer version
|
|
153
|
+
* may still understand them.
|
|
154
|
+
*/
|
|
155
|
+
export declare function parseTrustedOriginsStore(json: string | null): ITrustedOriginsStore;
|
|
156
|
+
export declare function serializeTrustedOriginsStore(store: ITrustedOriginsStore): string;
|
|
157
|
+
/** The host of the machine itself. The WHATWG URL parser has already
|
|
158
|
+
* normalized IPv4 notations, so "127.1" arrives here as "127.0.0.1". */
|
|
159
|
+
export declare function isLoopbackHost(hostname: string): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* A host that is not on the public internet: loopback, RFC 1918, link-local
|
|
162
|
+
* and IPv6 unique-local addresses. A public web application must not let a
|
|
163
|
+
* document turn the user's browser into a probe for the network behind their
|
|
164
|
+
* router.
|
|
165
|
+
*/
|
|
166
|
+
export declare function isPrivateNetworkHost(hostname: string): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* What a build allows beyond the rules that hold everywhere. Both are off
|
|
169
|
+
* unless a development build was explicitly told to allow them - the defaults
|
|
170
|
+
* here say so, so a caller that passes nothing gets the strict rules.
|
|
171
|
+
*
|
|
172
|
+
* The values come from compile-time constants (see buildFlags.ts), never from
|
|
173
|
+
* the document, a setting or anything else a user could be talked into
|
|
174
|
+
* changing. They are passed in rather than read here so that this module stays
|
|
175
|
+
* a set of plain functions, and so that both answers can be tested.
|
|
176
|
+
*/
|
|
177
|
+
export interface ITransportAllowances {
|
|
178
|
+
/** Whether http:// and ws:// URLs may be used at all. */
|
|
179
|
+
insecureTransports?: boolean;
|
|
180
|
+
/** Whether hosts on the local network may be reached. */
|
|
181
|
+
privateNetworkTransports?: boolean;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Why this URL's scheme must not be used, or null if it may be.
|
|
185
|
+
*
|
|
186
|
+
* Encrypted schemes - https and wss - are always fine, their plaintext
|
|
187
|
+
* counterparts only in a build that was told to allow them, and everything
|
|
188
|
+
* else never. This is the rule that no trust decision may waive: what a
|
|
189
|
+
* consent tier can decide is whether an origin may be asked at all, not
|
|
190
|
+
* whether a request may travel in the clear, so it is asked before the tiers
|
|
191
|
+
* rather than after them.
|
|
192
|
+
*
|
|
193
|
+
* ws and wss are listed although nothing here opens a websocket yet: the rule
|
|
194
|
+
* belongs to the scheme, not to the code that happens to exist.
|
|
195
|
+
*
|
|
196
|
+
* An application served from loopback is a developer's, and a developer talks
|
|
197
|
+
* to their own machine: for them the rule is waived, as the others are.
|
|
198
|
+
*/
|
|
199
|
+
export declare function transportProtocolProblem(url: URL, appIsLoopback: boolean, allowances?: ITransportAllowances): string | null;
|
|
200
|
+
/**
|
|
201
|
+
* Why this URL must not be polled, or null if it may be - subject to the
|
|
202
|
+
* user's consent, which is the next gate, not this one.
|
|
203
|
+
*
|
|
204
|
+
* An application served from loopback is a developer's, and a developer polls
|
|
205
|
+
* their own machine: for them every rule is waived.
|
|
206
|
+
*/
|
|
207
|
+
export declare function pollTargetProblem(url: URL, appIsLoopback: boolean, allowances?: ITransportAllowances): string | null;
|
|
208
|
+
//# sourceMappingURL=liveLinkTrust.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveLinkTrust.d.ts","sourceRoot":"","sources":["../src/liveLinkTrust.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAO,MAAM,CAAC;IAClB,IAAI,EAAO,MAAM,CAAC;IAClB,KAAK,EAAM,MAAM,CAAC;IAClB,QAAQ,EAAG,aAAa,CAAC;IACzB,KAAK,EAAM,MAAM,CAAC;IAClB,QAAQ,EAAG,MAAM,CAAC;CACrB;AAED,qEAAqE;AACrE,MAAM,WAAW,oBAAoB;IAEjC;;;;;;;;OAQG;IACH,eAAe,EAAG,MAAM,GAAG,IAAI,CAAC;IAEhC,OAAO,EAAW,KAAK,CAAC,cAAc,CAAC,CAAC;CAE3C;AAED;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,IAAQ,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,QAAmB,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,QAAc,CAAC;AAItD,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAU1C,eAAO,MAAM,yBAAy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