@sempdev/semp 0.5.1 → 0.5.5
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/dist/brief/address.d.ts +1 -1
- package/dist/brief/address.js +1 -1
- package/dist/brief/brief.d.ts +1 -1
- package/dist/brief/brief.js +1 -1
- package/dist/canonical/marshal.d.ts +2 -2
- package/dist/canonical/marshal.js +2 -2
- package/dist/closure/driver.d.ts +2 -2
- package/dist/closure/driver.js +1 -1
- package/dist/crypto/aead.d.ts +2 -2
- package/dist/crypto/aead.js +2 -2
- package/dist/crypto/kdf.d.ts +1 -1
- package/dist/crypto/kdf.js +1 -1
- package/dist/crypto/mac.d.ts +1 -1
- package/dist/crypto/mac.js +1 -1
- package/dist/delivery/ack.d.ts +5 -5
- package/dist/delivery/ack.js +6 -6
- package/dist/delivery/blocklist.d.ts +1 -1
- package/dist/delivery/blocklist.js +2 -2
- package/dist/delivery/device_sync.d.ts +26 -0
- package/dist/delivery/device_sync.d.ts.map +1 -0
- package/dist/delivery/device_sync.js +18 -0
- package/dist/delivery/device_sync.js.map +1 -0
- package/dist/delivery/disposition.d.ts +1 -1
- package/dist/delivery/fetch.d.ts +1 -1
- package/dist/delivery/fetch.js +1 -1
- package/dist/delivery/inbox.d.ts +2 -2
- package/dist/delivery/inbox.js +2 -2
- package/dist/delivery/index.d.ts +4 -0
- package/dist/delivery/index.d.ts.map +1 -1
- package/dist/delivery/index.js +4 -0
- package/dist/delivery/index.js.map +1 -1
- package/dist/delivery/persistent_silent.d.ts +70 -0
- package/dist/delivery/persistent_silent.d.ts.map +1 -0
- package/dist/delivery/persistent_silent.js +117 -0
- package/dist/delivery/persistent_silent.js.map +1 -0
- package/dist/delivery/pipeline.d.ts +4 -4
- package/dist/delivery/pipeline.js +2 -2
- package/dist/delivery/policy_state.d.ts +2 -2
- package/dist/delivery/policy_state.js +4 -4
- package/dist/delivery/receipt.d.ts +3 -3
- package/dist/delivery/receipt.js +3 -3
- package/dist/delivery/receipt_store.d.ts +1 -1
- package/dist/delivery/receipt_store.js +1 -1
- package/dist/delivery/retry.d.ts +2 -2
- package/dist/delivery/retry.js +2 -2
- package/dist/delivery/scheduler.d.ts +1 -1
- package/dist/delivery/scheduler.js +1 -1
- package/dist/delivery/stage_partition.d.ts +1 -1
- package/dist/delivery/stage_partition.js +1 -1
- package/dist/delivery/staged_runner.d.ts +1 -1
- package/dist/delivery/staged_runner.js +2 -2
- package/dist/delivery/status_message.d.ts +75 -0
- package/dist/delivery/status_message.d.ts.map +1 -0
- package/dist/delivery/status_message.js +109 -0
- package/dist/delivery/status_message.js.map +1 -0
- package/dist/delivery/upgrade_signal.d.ts +48 -0
- package/dist/delivery/upgrade_signal.d.ts.map +1 -0
- package/dist/delivery/upgrade_signal.js +48 -0
- package/dist/delivery/upgrade_signal.js.map +1 -0
- package/dist/discovery/configuration.d.ts +20 -1
- package/dist/discovery/configuration.d.ts.map +1 -1
- package/dist/discovery/configuration.js.map +1 -1
- package/dist/discovery/dns.d.ts +27 -1
- package/dist/discovery/dns.d.ts.map +1 -1
- package/dist/discovery/dns.js +37 -0
- package/dist/discovery/dns.js.map +1 -1
- package/dist/discovery/index.d.ts +2 -2
- package/dist/discovery/index.d.ts.map +1 -1
- package/dist/discovery/index.js +1 -1
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/partition.d.ts +1 -1
- package/dist/discovery/partition.js +1 -1
- package/dist/discovery/resolver.d.ts +5 -5
- package/dist/discovery/resolver.js +5 -5
- package/dist/discovery/txt.d.ts +1 -1
- package/dist/discovery/txt.js +1 -1
- package/dist/enclosure/forwarding.d.ts +1 -1
- package/dist/enclosure/forwarding.js +1 -1
- package/dist/envelope/buckets.d.ts +2 -2
- package/dist/envelope/buckets.js +2 -2
- package/dist/envelope/compose.d.ts +17 -2
- package/dist/envelope/compose.d.ts.map +1 -1
- package/dist/envelope/compose.js +29 -11
- package/dist/envelope/compose.js.map +1 -1
- package/dist/envelope/encode.d.ts +2 -2
- package/dist/envelope/encode.js +3 -3
- package/dist/envelope/index.d.ts +1 -1
- package/dist/envelope/index.d.ts.map +1 -1
- package/dist/envelope/index.js +1 -1
- package/dist/envelope/index.js.map +1 -1
- package/dist/envelope/open_any.d.ts.map +1 -1
- package/dist/envelope/open_any.js +5 -5
- package/dist/envelope/open_any.js.map +1 -1
- package/dist/envelope/open_verified.d.ts +1 -1
- package/dist/envelope/open_verified.js +1 -1
- package/dist/envelope/padding.d.ts +2 -2
- package/dist/envelope/padding.js +3 -3
- package/dist/envelope/verify.d.ts +1 -1
- package/dist/envelope/verify.js +1 -1
- package/dist/extensions/index.d.ts +1 -0
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +1 -0
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/limits.d.ts +2 -2
- package/dist/extensions/limits.js +2 -2
- package/dist/extensions/validation_failure.d.ts +48 -0
- package/dist/extensions/validation_failure.d.ts.map +1 -0
- package/dist/extensions/validation_failure.js +25 -0
- package/dist/extensions/validation_failure.js.map +1 -0
- package/dist/handshake/abort.d.ts +1 -1
- package/dist/handshake/abort.js +1 -1
- package/dist/handshake/client_state.d.ts +5 -5
- package/dist/handshake/client_state.js +5 -5
- package/dist/handshake/confirm.d.ts +2 -2
- package/dist/handshake/confirm.js +2 -2
- package/dist/handshake/driver.d.ts +2 -2
- package/dist/handshake/driver.js +1 -1
- package/dist/handshake/federation.d.ts +6 -6
- package/dist/handshake/federation.js +5 -5
- package/dist/handshake/first_contact.d.ts +1 -1
- package/dist/handshake/first_contact.js +1 -1
- package/dist/handshake/identity.d.ts +1 -1
- package/dist/handshake/identity.js +1 -1
- package/dist/handshake/pow.js +1 -1
- package/dist/handshake/server_state.d.ts +3 -3
- package/dist/handshake/server_state.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/keys/compromise.d.ts +2 -2
- package/dist/keys/compromise.js +1 -1
- package/dist/keys/device_certificate.d.ts +3 -3
- package/dist/keys/device_certificate.js +4 -4
- package/dist/keys/key_revocation.d.ts +2 -2
- package/dist/keys/key_revocation.js +1 -1
- package/dist/keys/request.d.ts +17 -3
- package/dist/keys/request.d.ts.map +1 -1
- package/dist/keys/request.js.map +1 -1
- package/dist/keys/sign.d.ts +1 -1
- package/dist/keys/sign.js +1 -1
- package/dist/keys/signed.d.ts +3 -3
- package/dist/keys/signed.js +3 -3
- package/dist/keys/store.js +1 -1
- package/dist/largeattachment/crypto.d.ts +1 -1
- package/dist/largeattachment/crypto.js +2 -2
- package/dist/largeattachment/upload.d.ts +3 -3
- package/dist/largeattachment/upload.js +1 -1
- package/dist/migration/index.d.ts +1 -1
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +1 -1
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/lockout.d.ts +2 -2
- package/dist/migration/lockout.js +2 -2
- package/dist/migration/migration.d.ts +6 -4
- package/dist/migration/migration.d.ts.map +1 -1
- package/dist/migration/migration.js +3 -3
- package/dist/migration/migration.js.map +1 -1
- package/dist/migration/notice.d.ts +31 -19
- package/dist/migration/notice.d.ts.map +1 -1
- package/dist/migration/notice.js +37 -71
- package/dist/migration/notice.js.map +1 -1
- package/dist/migration/orchestrate.d.ts +10 -10
- package/dist/migration/orchestrate.d.ts.map +1 -1
- package/dist/migration/orchestrate.js +23 -23
- package/dist/migration/orchestrate.js.map +1 -1
- package/dist/migration/sign.js +9 -9
- package/dist/migration/sign.js.map +1 -1
- package/dist/migration/types.d.ts +35 -29
- package/dist/migration/types.d.ts.map +1 -1
- package/dist/migration/types.js +5 -7
- package/dist/migration/types.js.map +1 -1
- package/dist/recovery/bundle_store.js +1 -1
- package/dist/recovery/sign.js +3 -3
- package/dist/recovery/types.d.ts +3 -3
- package/dist/reputation/abuse_report.d.ts +3 -3
- package/dist/reputation/abuse_report.js +2 -2
- package/dist/reputation/eligibility.d.ts +44 -0
- package/dist/reputation/eligibility.d.ts.map +1 -0
- package/dist/reputation/eligibility.js +58 -0
- package/dist/reputation/eligibility.js.map +1 -0
- package/dist/reputation/evidence.d.ts +47 -0
- package/dist/reputation/evidence.d.ts.map +1 -0
- package/dist/reputation/evidence.js +117 -0
- package/dist/reputation/evidence.js.map +1 -0
- package/dist/reputation/gossip_fetch.d.ts +2 -2
- package/dist/reputation/gossip_fetch.js +1 -1
- package/dist/reputation/index.d.ts +4 -1
- package/dist/reputation/index.d.ts.map +1 -1
- package/dist/reputation/index.js +4 -1
- package/dist/reputation/index.js.map +1 -1
- package/dist/reputation/pow.d.ts +1 -1
- package/dist/reputation/pow.js +1 -1
- package/dist/reputation/references.d.ts +51 -0
- package/dist/reputation/references.d.ts.map +1 -0
- package/dist/reputation/references.js +95 -0
- package/dist/reputation/references.js.map +1 -0
- package/dist/reputation/sign.d.ts +1 -1
- package/dist/reputation/sign.js +2 -2
- package/dist/reputation/types.d.ts +46 -2
- package/dist/reputation/types.d.ts.map +1 -1
- package/dist/reputation/types.js +14 -0
- package/dist/reputation/types.js.map +1 -1
- package/dist/reputation/whois.d.ts +1 -1
- package/dist/reputation/whois.js +1 -1
- package/dist/seal/wrap.d.ts +2 -2
- package/dist/seal/wrap.js +4 -4
- package/dist/session/dispatcher.d.ts +3 -3
- package/dist/session/dispatcher.js +1 -1
- package/dist/session/rekey_seal.d.ts +3 -3
- package/dist/session/rekey_seal.js +3 -3
- package/dist/session/session.d.ts +3 -3
- package/dist/session/session.js +3 -3
- package/dist/transparency/log.d.ts +1 -1
- package/dist/transparency/log.js +2 -2
- package/dist/transparency/types.d.ts +2 -2
- package/dist/transparency/types.js +1 -1
- package/dist/transport/h2.d.ts +33 -12
- package/dist/transport/h2.d.ts.map +1 -1
- package/dist/transport/h2.js +40 -13
- package/dist/transport/h2.js.map +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.d.ts.map +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/memory.js +1 -1
- package/dist/transport/ws.d.ts +1 -1
- package/dist/transport/ws.js +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Sign / verify primitives for reputation wire records per
|
|
3
3
|
* REPUTATION.md §4.2 + §3.5 + §5.
|
|
4
4
|
*
|
|
5
|
-
* Reputation records use a NO-PREFIX signing input
|
|
5
|
+
* Reputation records use a NO-PREFIX signing input - the canonical
|
|
6
6
|
* bytes with `signature.value` elided are signed directly under
|
|
7
7
|
* Ed25519. Other SEMP records use SEMP-* domain-separation
|
|
8
8
|
* prefixes (registered in ENVELOPE.md §4.3) but reputation ones do
|
package/dist/reputation/sign.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Sign / verify primitives for reputation wire records per
|
|
3
3
|
* REPUTATION.md §4.2 + §3.5 + §5.
|
|
4
4
|
*
|
|
5
|
-
* Reputation records use a NO-PREFIX signing input
|
|
5
|
+
* Reputation records use a NO-PREFIX signing input - the canonical
|
|
6
6
|
* bytes with `signature.value` elided are signed directly under
|
|
7
7
|
* Ed25519. Other SEMP records use SEMP-* domain-separation
|
|
8
8
|
* prefixes (registered in ENVELOPE.md §4.3) but reputation ones do
|
|
@@ -126,7 +126,7 @@ export function authAllowsEnclosure(auth) {
|
|
|
126
126
|
return auth.scope === "enclosure_only" || auth.scope === "brief_and_enclosure";
|
|
127
127
|
}
|
|
128
128
|
// ---------------------------------------------------------------------------
|
|
129
|
-
// AbuseReport
|
|
129
|
+
// AbuseReport - sent over an authenticated session, no own signature
|
|
130
130
|
/** Structural validation of an {@link AbuseReport} per §3.2. Throws on first violation. */
|
|
131
131
|
export function validateAbuseReport(r) {
|
|
132
132
|
if (r.type !== "SEMP_ABUSE_REPORT") {
|
|
@@ -12,8 +12,16 @@ export declare const Version = "1.0.0";
|
|
|
12
12
|
export declare const PublicationPath = "/.well-known/semp/reputation/";
|
|
13
13
|
/** Assessment classification per §4.6. */
|
|
14
14
|
export type Assessment = "trusted" | "neutral" | "suspicious" | "hostile";
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Abuse category per §3.4 + ERRORS.md §9.
|
|
17
|
+
*
|
|
18
|
+
* `observation_record_abuse` covers misbehavior in the trust-
|
|
19
|
+
* gossip observation records themselves: oversized records,
|
|
20
|
+
* evidence-hash mismatches, hostile or non-conforming evidence_uri
|
|
21
|
+
* content, fabricated metrics, and systematic publication of
|
|
22
|
+
* unverifiable assessments.
|
|
23
|
+
*/
|
|
24
|
+
export type AbuseCategory = "spam" | "harassment" | "phishing" | "malware" | "protocol_abuse" | "impersonation" | "observation_record_abuse" | "other";
|
|
17
25
|
/**
|
|
18
26
|
* Report whether `c` is one of the categories defined in §3.4.
|
|
19
27
|
* Unknown categories are permitted for forward compatibility.
|
|
@@ -44,6 +52,19 @@ export interface Metrics {
|
|
|
44
52
|
}
|
|
45
53
|
/** Cap applied by Bucketize: counts at/above this clamp here. */
|
|
46
54
|
export declare const MaxMetricBucket: number;
|
|
55
|
+
/**
|
|
56
|
+
* Binds the bytes returned by an observation's `evidence_uri` to
|
|
57
|
+
* the signed observation record per REPUTATION.md §4.2 / §5.5.1.
|
|
58
|
+
* Consumers MUST compute the digest of the fetched bytes under
|
|
59
|
+
* `algorithm` and MUST treat a mismatch as a verification failure
|
|
60
|
+
* equivalent to a signature failure.
|
|
61
|
+
*/
|
|
62
|
+
export interface EvidenceHash {
|
|
63
|
+
/** Digest algorithm identifier. "sha-256" is the only value currently defined. */
|
|
64
|
+
algorithm: string;
|
|
65
|
+
/** Base64-encoded digest of the evidence bytes. */
|
|
66
|
+
value: string;
|
|
67
|
+
}
|
|
47
68
|
/** Single signed observation record per §4.2. */
|
|
48
69
|
export interface Observation {
|
|
49
70
|
type: typeof ObservationType;
|
|
@@ -55,7 +76,17 @@ export interface Observation {
|
|
|
55
76
|
metrics: Metrics;
|
|
56
77
|
assessment: Assessment;
|
|
57
78
|
evidence_available: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* URL where evidence can be fetched. REQUIRED when
|
|
81
|
+
* `evidence_available` is true; MUST be absent when false.
|
|
82
|
+
*/
|
|
58
83
|
evidence_uri?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Digest binding fetched evidence to the signed observation per
|
|
86
|
+
* §5.5.1. REQUIRED when `evidence_available` is true; MUST be
|
|
87
|
+
* absent when false.
|
|
88
|
+
*/
|
|
89
|
+
evidence_hash?: EvidenceHash;
|
|
59
90
|
/** ISO 8601 UTC. */
|
|
60
91
|
timestamp: string;
|
|
61
92
|
/** ISO 8601 UTC hard expiry. */
|
|
@@ -64,6 +95,19 @@ export interface Observation {
|
|
|
64
95
|
/** Always emitted (even when empty) so canonical bytes are stable. */
|
|
65
96
|
extensions: Record<string, unknown>;
|
|
66
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* §4.6.1 hard upper bound on the canonical UTF-8 JSON form of a
|
|
100
|
+
* single SEMP_TRUST_OBSERVATION record. Servers MUST reject larger
|
|
101
|
+
* records as malformed and MUST NOT propagate them.
|
|
102
|
+
*/
|
|
103
|
+
export declare const MaxObservationBytes = 16384;
|
|
104
|
+
/**
|
|
105
|
+
* §5.5.2 RECOMMENDED upper bound on a single evidence-fetch
|
|
106
|
+
* response body. Operators MAY tighten further via local
|
|
107
|
+
* configuration; consumers MUST cap their fetch at a
|
|
108
|
+
* locally-configured limit.
|
|
109
|
+
*/
|
|
110
|
+
export declare const MaxEvidenceBytes: number;
|
|
67
111
|
/** Publication envelope carrying a list of observations per §5.1. */
|
|
68
112
|
export interface TrustObservations {
|
|
69
113
|
type: typeof ObservationsEnvelopeType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reputation/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+CAA+C;AAC/C,eAAO,MAAM,eAAe,2BAA2B,CAAC;AACxD,eAAO,MAAM,wBAAwB,4BAA4B,CAAC;AAClE,eAAO,MAAM,eAAe,sBAAsB,CAAC;AACnD,eAAO,MAA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B,SAAS,EAAE,sBAAsB,EAAE,CAAC;CACrC,CAAC;AAEN,0CAA0C;AAC1C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,eAAe,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,aAAa,GAAG,MAAM,CAAC;IACjC,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC"}
|
package/dist/reputation/types.js
CHANGED
|
@@ -22,6 +22,7 @@ export function isKnownAbuseCategory(c) {
|
|
|
22
22
|
case "malware":
|
|
23
23
|
case "protocol_abuse":
|
|
24
24
|
case "impersonation":
|
|
25
|
+
case "observation_record_abuse":
|
|
25
26
|
case "other":
|
|
26
27
|
return true;
|
|
27
28
|
default:
|
|
@@ -30,4 +31,17 @@ export function isKnownAbuseCategory(c) {
|
|
|
30
31
|
}
|
|
31
32
|
/** Cap applied by Bucketize: counts at/above this clamp here. */
|
|
32
33
|
export const MaxMetricBucket = 1 << 20;
|
|
34
|
+
/**
|
|
35
|
+
* §4.6.1 hard upper bound on the canonical UTF-8 JSON form of a
|
|
36
|
+
* single SEMP_TRUST_OBSERVATION record. Servers MUST reject larger
|
|
37
|
+
* records as malformed and MUST NOT propagate them.
|
|
38
|
+
*/
|
|
39
|
+
export const MaxObservationBytes = 16384;
|
|
40
|
+
/**
|
|
41
|
+
* §5.5.2 RECOMMENDED upper bound on a single evidence-fetch
|
|
42
|
+
* response body. Operators MAY tighten further via local
|
|
43
|
+
* configuration; consumers MUST cap their fetch at a
|
|
44
|
+
* locally-configured limit.
|
|
45
|
+
*/
|
|
46
|
+
export const MaxEvidenceBytes = 1024 * 1024;
|
|
33
47
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/reputation/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AACxD,MAAM,CAAC,MAAM,wBAAwB,GAAG,yBAAyB,CAAC;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AACnD,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,0CAA0C;AAC1C,MAAM,CAAC,MAAM,eAAe,GAAG,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/reputation/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AACxD,MAAM,CAAC,MAAM,wBAAwB,GAAG,yBAAyB,CAAC;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AACnD,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,0CAA0C;AAC1C,MAAM,CAAC,MAAM,eAAe,GAAG,+BAA+B,CAAC;AAwB/D;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAAS;IAC5C,QAAQ,CAAC,EAAE,CAAC;QACV,KAAK,MAAM,CAAC;QACZ,KAAK,YAAY,CAAC;QAClB,KAAK,UAAU,CAAC;QAChB,KAAK,SAAS,CAAC;QACf,KAAK,gBAAgB,CAAC;QACtB,KAAK,eAAe,CAAC;QACrB,KAAK,0BAA0B,CAAC;QAChC,KAAK,OAAO;YACV,OAAO,IAAI,CAAC;QACd;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AA4BD,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,CAAC;AA+CvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WHOIS hooks per REPUTATION.md §2.1.
|
|
3
3
|
*
|
|
4
|
-
* Operators supply their own WHOIS implementation
|
|
4
|
+
* Operators supply their own WHOIS implementation - there is no de
|
|
5
5
|
* facto WHOIS library that is both reliable and free of rate limits,
|
|
6
6
|
* so this is intentionally pluggable.
|
|
7
7
|
*
|
package/dist/reputation/whois.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WHOIS hooks per REPUTATION.md §2.1.
|
|
3
3
|
*
|
|
4
|
-
* Operators supply their own WHOIS implementation
|
|
4
|
+
* Operators supply their own WHOIS implementation - there is no de
|
|
5
5
|
* facto WHOIS library that is both reliable and free of rate limits,
|
|
6
6
|
* so this is intentionally pluggable.
|
|
7
7
|
*
|
package/dist/seal/wrap.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare function unwrap(suite: Suite, recipientPrivateKey: Uint8Array, re
|
|
|
40
40
|
* Wrap `symmetricKey` for the given recipient under the negotiated
|
|
41
41
|
* suite. Production code path: uses the platform CSPRNG to generate
|
|
42
42
|
* a fresh ephemeral every call, which is what the §4.4.1 wrap
|
|
43
|
-
* construction requires
|
|
43
|
+
* construction requires - wrap-key uniqueness is what makes the
|
|
44
44
|
* zero-nonce AEAD safe.
|
|
45
45
|
*
|
|
46
46
|
* For deterministic byte-level reproducibility (vectors, audits),
|
|
@@ -63,7 +63,7 @@ export interface WrapRandomness {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Deterministic wrap for vector reproduction and audits. Production
|
|
66
|
-
* code MUST use {@link wrap} (which sources fresh entropy)
|
|
66
|
+
* code MUST use {@link wrap} (which sources fresh entropy) - a
|
|
67
67
|
* deterministic wrap that leaks `ephemeralX25519Priv` reduces to
|
|
68
68
|
* "the adversary has the wrap key". Exposed here only because
|
|
69
69
|
* cross-language vectors pin these inputs.
|
package/dist/seal/wrap.js
CHANGED
|
@@ -61,7 +61,7 @@ export function unwrap(suite, recipientPrivateKey, recipientPublicKey, wrappedB6
|
|
|
61
61
|
const prk = kdf.extract(salt, sharedSecret);
|
|
62
62
|
const wrapKey = kdf.expand(prk, new TextEncoder().encode(WrapInfo), 32);
|
|
63
63
|
// AEAD: zero nonce, recipientPublicKey as AAD. The seal AEAD is
|
|
64
|
-
// ChaCha20-Poly1305 (12-byte nonce) regardless of suite
|
|
64
|
+
// ChaCha20-Poly1305 (12-byte nonce) regardless of suite - only
|
|
65
65
|
// the KEM is post-quantum on the PQ side. The `suite`-derived
|
|
66
66
|
// `aead` here is unused but kept for signature parity.
|
|
67
67
|
void aead;
|
|
@@ -72,7 +72,7 @@ export function unwrap(suite, recipientPrivateKey, recipientPublicKey, wrappedB6
|
|
|
72
72
|
* Wrap `symmetricKey` for the given recipient under the negotiated
|
|
73
73
|
* suite. Production code path: uses the platform CSPRNG to generate
|
|
74
74
|
* a fresh ephemeral every call, which is what the §4.4.1 wrap
|
|
75
|
-
* construction requires
|
|
75
|
+
* construction requires - wrap-key uniqueness is what makes the
|
|
76
76
|
* zero-nonce AEAD safe.
|
|
77
77
|
*
|
|
78
78
|
* For deterministic byte-level reproducibility (vectors, audits),
|
|
@@ -99,7 +99,7 @@ export function wrap(suite, recipientPublicKey, symmetricKey) {
|
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Deterministic wrap for vector reproduction and audits. Production
|
|
102
|
-
* code MUST use {@link wrap} (which sources fresh entropy)
|
|
102
|
+
* code MUST use {@link wrap} (which sources fresh entropy) - a
|
|
103
103
|
* deterministic wrap that leaks `ephemeralX25519Priv` reduces to
|
|
104
104
|
* "the adversary has the wrap key". Exposed here only because
|
|
105
105
|
* cross-language vectors pin these inputs.
|
|
@@ -114,7 +114,7 @@ export function wrapWithRandomness(suite, recipientPublicKey, symmetricKey, rand
|
|
|
114
114
|
const prk = kdf.extract(salt, sharedSecret);
|
|
115
115
|
const wrapKey = kdf.expand(prk, new TextEncoder().encode(WrapInfo), 32);
|
|
116
116
|
// AEAD: zero nonce, recipientPublicKey as AAD. Always
|
|
117
|
-
// ChaCha20-Poly1305 (12-byte nonce) regardless of suite
|
|
117
|
+
// ChaCha20-Poly1305 (12-byte nonce) regardless of suite - only
|
|
118
118
|
// the KEM is post-quantum on the PQ side.
|
|
119
119
|
const nonce = new Uint8Array(12);
|
|
120
120
|
const aeadCT = aeadSeal("chacha20-poly1305", wrapKey, nonce, symmetricKey, recipientPublicKey);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Reads frames off a Session's transport in a loop, parses the
|
|
5
5
|
* outermost `type` field, and routes each frame to the matching
|
|
6
6
|
* caller-supplied handler. Designed for the long-running phase
|
|
7
|
-
* after a successful handshake
|
|
7
|
+
* after a successful handshake - when the wire carries a mix of
|
|
8
8
|
* envelopes, sealed rekey messages, key-fetch requests, etc.
|
|
9
9
|
*
|
|
10
10
|
* The dispatcher does NOT verify envelope signatures or open
|
|
@@ -21,7 +21,7 @@ export interface DispatchHandlers {
|
|
|
21
21
|
* transport and invokes this with the JSON object (already
|
|
22
22
|
* parsed). Production callers route through {@link "./rekey".rekeyServer}
|
|
23
23
|
* by feeding the bytes back through their own transport-level
|
|
24
|
-
* input
|
|
24
|
+
* input - see the dispatcher example in the README.
|
|
25
25
|
*/
|
|
26
26
|
onRekey?: (frame: Uint8Array, parsed: unknown) => Promise<void> | void;
|
|
27
27
|
/** A wire envelope (`type: SEMP_ENVELOPE`). */
|
|
@@ -44,7 +44,7 @@ export interface DispatchHandlers {
|
|
|
44
44
|
onUnknown?: (type: string, frame: Uint8Array) => Promise<void> | void;
|
|
45
45
|
/**
|
|
46
46
|
* Invoked on a non-fatal error inside a handler. The dispatcher
|
|
47
|
-
* loop continues
|
|
47
|
+
* loop continues - the caller MUST decide whether to close the
|
|
48
48
|
* session. If this is not supplied, handler errors are swallowed.
|
|
49
49
|
*/
|
|
50
50
|
onHandlerError?: (err: Error, type: string) => void;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Reads frames off a Session's transport in a loop, parses the
|
|
5
5
|
* outermost `type` field, and routes each frame to the matching
|
|
6
6
|
* caller-supplied handler. Designed for the long-running phase
|
|
7
|
-
* after a successful handshake
|
|
7
|
+
* after a successful handshake - when the wire carries a mix of
|
|
8
8
|
* envelopes, sealed rekey messages, key-fetch requests, etc.
|
|
9
9
|
*
|
|
10
10
|
* The dispatcher does NOT verify envelope signatures or open
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Rekey messages are AEAD-encrypted under the CURRENT session's
|
|
5
5
|
* directional keys. Receiving a valid sealed rekey is itself the
|
|
6
|
-
* authentication
|
|
7
|
-
* forge one
|
|
6
|
+
* authentication - only a holder of the live session keys can
|
|
7
|
+
* forge one - so the rekey messages carry no separate identity
|
|
8
8
|
* signature.
|
|
9
9
|
*
|
|
10
10
|
* Wire shape:
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*
|
|
27
27
|
* where LP(x) prepends a 4-byte big-endian length to x. Mixing the
|
|
28
28
|
* MAC key into the AAD ensures that compromising the encryption
|
|
29
|
-
* key alone is insufficient
|
|
29
|
+
* key alone is insufficient - an attacker would also need the MAC
|
|
30
30
|
* key, which satisfies the spec's "MACed under the MAC key"
|
|
31
31
|
* requirement.
|
|
32
32
|
*
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Rekey messages are AEAD-encrypted under the CURRENT session's
|
|
5
5
|
* directional keys. Receiving a valid sealed rekey is itself the
|
|
6
|
-
* authentication
|
|
7
|
-
* forge one
|
|
6
|
+
* authentication - only a holder of the live session keys can
|
|
7
|
+
* forge one - so the rekey messages carry no separate identity
|
|
8
8
|
* signature.
|
|
9
9
|
*
|
|
10
10
|
* Wire shape:
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*
|
|
27
27
|
* where LP(x) prepends a 4-byte big-endian length to x. Mixing the
|
|
28
28
|
* MAC key into the AAD ensures that compromising the encryption
|
|
29
|
-
* key alone is insufficient
|
|
29
|
+
* key alone is insufficient - an attacker would also need the MAC
|
|
30
30
|
* key, which satisfies the spec's "MACed under the MAC key"
|
|
31
31
|
* requirement.
|
|
32
32
|
*
|
|
@@ -92,7 +92,7 @@ export declare class Session {
|
|
|
92
92
|
isExpired(now?: Date): boolean;
|
|
93
93
|
/**
|
|
94
94
|
* Live session keys. Throws if the session has been closed or
|
|
95
|
-
* erased
|
|
95
|
+
* erased - once erase() runs, the bytes are zeroized and any
|
|
96
96
|
* caller still holding a Session reference cannot accidentally
|
|
97
97
|
* encrypt under invalidated material.
|
|
98
98
|
*/
|
|
@@ -114,7 +114,7 @@ export declare class Session {
|
|
|
114
114
|
receive(): Promise<Uint8Array | null>;
|
|
115
115
|
/**
|
|
116
116
|
* Close the session and the underlying transport. Idempotent.
|
|
117
|
-
* Does NOT zeroize keys
|
|
117
|
+
* Does NOT zeroize keys - callers that want zeroization use
|
|
118
118
|
* {@link erase}.
|
|
119
119
|
*/
|
|
120
120
|
close(): Promise<void>;
|
|
@@ -122,7 +122,7 @@ export declare class Session {
|
|
|
122
122
|
* Atomically install new session keys + a new session_id from a
|
|
123
123
|
* successful rekey. Zeroizes the prior keys before swapping. The
|
|
124
124
|
* session retains its TTL boundary (TTL counts from the original
|
|
125
|
-
* establishedAt)
|
|
125
|
+
* establishedAt) - rekey rolls forward the keys, not the lifetime.
|
|
126
126
|
*/
|
|
127
127
|
applyRekey(apply: RekeyApply): void;
|
|
128
128
|
/**
|
package/dist/session/session.js
CHANGED
|
@@ -75,7 +75,7 @@ export class Session {
|
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Live session keys. Throws if the session has been closed or
|
|
78
|
-
* erased
|
|
78
|
+
* erased - once erase() runs, the bytes are zeroized and any
|
|
79
79
|
* caller still holding a Session reference cannot accidentally
|
|
80
80
|
* encrypt under invalidated material.
|
|
81
81
|
*/
|
|
@@ -117,7 +117,7 @@ export class Session {
|
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
* Close the session and the underlying transport. Idempotent.
|
|
120
|
-
* Does NOT zeroize keys
|
|
120
|
+
* Does NOT zeroize keys - callers that want zeroization use
|
|
121
121
|
* {@link erase}.
|
|
122
122
|
*/
|
|
123
123
|
async close() {
|
|
@@ -136,7 +136,7 @@ export class Session {
|
|
|
136
136
|
* Atomically install new session keys + a new session_id from a
|
|
137
137
|
* successful rekey. Zeroizes the prior keys before swapping. The
|
|
138
138
|
* session retains its TTL boundary (TTL counts from the original
|
|
139
|
-
* establishedAt)
|
|
139
|
+
* establishedAt) - rekey rolls forward the keys, not the lifetime.
|
|
140
140
|
*/
|
|
141
141
|
applyRekey(apply) {
|
|
142
142
|
if (this._keys === null) {
|
|
@@ -34,7 +34,7 @@ export declare class Log {
|
|
|
34
34
|
/**
|
|
35
35
|
* Validate `entry`, hash its leaf, and append. Returns the
|
|
36
36
|
* assigned 0-based leaf index. Does NOT verify any signature on
|
|
37
|
-
* the entry
|
|
37
|
+
* the entry - admission policy is the caller's concern.
|
|
38
38
|
*/
|
|
39
39
|
append(entry: LogEntry): number;
|
|
40
40
|
/** Current tree size. */
|
package/dist/transparency/log.js
CHANGED
|
@@ -35,7 +35,7 @@ export class Log {
|
|
|
35
35
|
/**
|
|
36
36
|
* Validate `entry`, hash its leaf, and append. Returns the
|
|
37
37
|
* assigned 0-based leaf index. Does NOT verify any signature on
|
|
38
|
-
* the entry
|
|
38
|
+
* the entry - admission policy is the caller's concern.
|
|
39
39
|
*/
|
|
40
40
|
append(entry) {
|
|
41
41
|
validateLogEntry(entry);
|
|
@@ -125,7 +125,7 @@ export class Log {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
function isoSecond(d) {
|
|
128
|
-
// Strip milliseconds
|
|
128
|
+
// Strip milliseconds - STH timestamps are second-precision per
|
|
129
129
|
// CONFORMANCE.md §9.3.
|
|
130
130
|
const iso = d.toISOString();
|
|
131
131
|
return iso.replace(/\.\d{3}Z$/, "Z");
|
|
@@ -18,7 +18,7 @@ export declare const LeafPrefix = 0;
|
|
|
18
18
|
/** RFC 6962 interior-node domain-separation byte. */
|
|
19
19
|
export declare const InteriorPrefix = 1;
|
|
20
20
|
/**
|
|
21
|
-
* STH staleness ceiling per §2.3
|
|
21
|
+
* STH staleness ceiling per §2.3 - verifiers reject STHs whose
|
|
22
22
|
* timestamp is more than this old.
|
|
23
23
|
*/
|
|
24
24
|
export declare const MaxSTHFreshnessMs: number;
|
|
@@ -47,7 +47,7 @@ export interface LogEntry {
|
|
|
47
47
|
revoked_at?: string | null;
|
|
48
48
|
/** Populated only on `revoke`. */
|
|
49
49
|
revoked_reason?: string | null;
|
|
50
|
-
/** Populated only on `rotate`
|
|
50
|
+
/** Populated only on `rotate` - names the key being rotated out. */
|
|
51
51
|
supersedes?: string | null;
|
|
52
52
|
/** ISO 8601 UTC; the log's timestamp for this insertion. */
|
|
53
53
|
log_timestamp: string;
|
|
@@ -18,7 +18,7 @@ export const LeafPrefix = 0x00;
|
|
|
18
18
|
/** RFC 6962 interior-node domain-separation byte. */
|
|
19
19
|
export const InteriorPrefix = 0x01;
|
|
20
20
|
/**
|
|
21
|
-
* STH staleness ceiling per §2.3
|
|
21
|
+
* STH staleness ceiling per §2.3 - verifiers reject STHs whose
|
|
22
22
|
* timestamp is more than this old.
|
|
23
23
|
*/
|
|
24
24
|
export const MaxSTHFreshnessMs = 60 * 60 * 1000;
|
package/dist/transport/h2.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP/2 transport binding per TRANSPORT.md §4.2.
|
|
3
3
|
*
|
|
4
|
-
* Unlike WebSocket
|
|
4
|
+
* Unlike WebSocket, which gives us a single bidirectional pipe,
|
|
5
5
|
* the SEMP HTTP/2 binding is a collection of HTTP endpoints with
|
|
6
6
|
* path-based routing:
|
|
7
7
|
*
|
|
8
|
-
* - `
|
|
9
|
-
* - `POST /v1/
|
|
10
|
-
* - `
|
|
11
|
-
* - `POST /v1/
|
|
12
|
-
* - `POST /v1/
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
8
|
+
* - `GET /v1/discovery/{address}` - discovery lookup (preferred)
|
|
9
|
+
* - `POST /v1/discovery/{address}` - same lookup with a signed body
|
|
10
|
+
* - `GET /v1/keys/{address}` - key request (preferred)
|
|
11
|
+
* - `POST /v1/keys/{address}` - same lookup with a signed body
|
|
12
|
+
* - `POST /v1/handshake` - handshake step
|
|
13
|
+
* - `POST /v1/envelope` - envelope submit
|
|
14
|
+
* - `GET /v1/session/{id}` - long-lived server-push stream
|
|
15
|
+
* (Server-Sent Events)
|
|
16
16
|
*
|
|
17
17
|
* This module exposes:
|
|
18
18
|
*
|
|
@@ -31,6 +31,27 @@
|
|
|
31
31
|
import type { DialOptions, Transport } from "./transport.js";
|
|
32
32
|
/** Header name the server sets on its response to handshake init. */
|
|
33
33
|
export declare const SempSessionIdHeader = "Semp-Session-Id";
|
|
34
|
+
/** Path constants for the HTTP/2 binding per TRANSPORT.md §4.2.1. */
|
|
35
|
+
export declare const PathDiscovery = "/v1/discovery";
|
|
36
|
+
export declare const PathKeys = "/v1/keys";
|
|
37
|
+
export declare const PathHandshake = "/v1/handshake";
|
|
38
|
+
export declare const PathEnvelope = "/v1/envelope";
|
|
39
|
+
export declare const PathSession = "/v1/session/";
|
|
40
|
+
/**
|
|
41
|
+
* Build the GET-lookup URL path for a discovery lookup per
|
|
42
|
+
* TRANSPORT.md §4.2.1: `/v1/discovery/{address}`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function discoveryPath(address: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Build the GET-lookup URL path for a key request per
|
|
47
|
+
* TRANSPORT.md §4.2.1: `/v1/keys/{address}`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function keysPath(address: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Build the GET-stream URL path for a session id per
|
|
52
|
+
* TRANSPORT.md §4.2.4: `/v1/session/{id}`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function sessionPath(sessionId: string): string;
|
|
34
55
|
/**
|
|
35
56
|
* Minimal subset of the WHATWG fetch surface this module depends on.
|
|
36
57
|
* Both Node 22+ and browsers ship `fetch` matching this shape. Tests
|
|
@@ -104,7 +125,7 @@ export interface DialH2SessionOptions extends DialOptions {
|
|
|
104
125
|
/** Override the fetch implementation. Defaults to `globalThis.fetch`. */
|
|
105
126
|
fetchImpl?: H2FetchLike;
|
|
106
127
|
/**
|
|
107
|
-
* URL of the session endpoint, including the session id segment
|
|
128
|
+
* URL of the session endpoint, including the session id segment -
|
|
108
129
|
* for example `https://semp.example.com/v1/session/01J...`. The
|
|
109
130
|
* caller composes this from the configuration's
|
|
110
131
|
* `endpoints.client.h2` base + the session id.
|
|
@@ -134,13 +155,13 @@ export declare function dialH2Session(opts: DialH2SessionOptions): Promise<Trans
|
|
|
134
155
|
* The encoder normalizes CR / CRLF line terminators to LF before
|
|
135
156
|
* emitting each `data:` line. SEMP payloads are JSON documents whose
|
|
136
157
|
* control bytes are escaped (`\r`, `\n`), so the wire form never
|
|
137
|
-
* actually carries a literal CR or LF
|
|
158
|
+
* actually carries a literal CR or LF - but be defensive.
|
|
138
159
|
*/
|
|
139
160
|
export declare function encodeSSE(message: string): string;
|
|
140
161
|
/**
|
|
141
162
|
* Decode SSE events from a string buffer. Each call returns the next
|
|
142
163
|
* complete event's `data` payload (or `null` if no complete event is
|
|
143
|
-
* buffered yet). Stateful
|
|
164
|
+
* buffered yet). Stateful - the buffer accumulates partial input.
|
|
144
165
|
*/
|
|
145
166
|
export declare class SSEDecoder {
|
|
146
167
|
private bu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OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,SAAS,CAAgB;IAEjC,uCAAuC;IACvC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzB;;;OAGG;IACH,IAAI,IAAI,MAAM,GAAG,IAAI;IA6CrB;;;OAGG;IACH,KAAK,IAAI,MAAM,GAAG,IAAI;CAQvB;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBhD"}
|
package/dist/transport/h2.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP/2 transport binding per TRANSPORT.md §4.2.
|
|
3
3
|
*
|
|
4
|
-
* Unlike WebSocket
|
|
4
|
+
* Unlike WebSocket, which gives us a single bidirectional pipe,
|
|
5
5
|
* the SEMP HTTP/2 binding is a collection of HTTP endpoints with
|
|
6
6
|
* path-based routing:
|
|
7
7
|
*
|
|
8
|
-
* - `
|
|
9
|
-
* - `POST /v1/
|
|
10
|
-
* - `
|
|
11
|
-
* - `POST /v1/
|
|
12
|
-
* - `POST /v1/
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
8
|
+
* - `GET /v1/discovery/{address}` - discovery lookup (preferred)
|
|
9
|
+
* - `POST /v1/discovery/{address}` - same lookup with a signed body
|
|
10
|
+
* - `GET /v1/keys/{address}` - key request (preferred)
|
|
11
|
+
* - `POST /v1/keys/{address}` - same lookup with a signed body
|
|
12
|
+
* - `POST /v1/handshake` - handshake step
|
|
13
|
+
* - `POST /v1/envelope` - envelope submit
|
|
14
|
+
* - `GET /v1/session/{id}` - long-lived server-push stream
|
|
15
|
+
* (Server-Sent Events)
|
|
16
16
|
*
|
|
17
17
|
* This module exposes:
|
|
18
18
|
*
|
|
@@ -30,6 +30,33 @@
|
|
|
30
30
|
*/
|
|
31
31
|
/** Header name the server sets on its response to handshake init. */
|
|
32
32
|
export const SempSessionIdHeader = "Semp-Session-Id";
|
|
33
|
+
/** Path constants for the HTTP/2 binding per TRANSPORT.md §4.2.1. */
|
|
34
|
+
export const PathDiscovery = "/v1/discovery";
|
|
35
|
+
export const PathKeys = "/v1/keys";
|
|
36
|
+
export const PathHandshake = "/v1/handshake";
|
|
37
|
+
export const PathEnvelope = "/v1/envelope";
|
|
38
|
+
export const PathSession = "/v1/session/";
|
|
39
|
+
/**
|
|
40
|
+
* Build the GET-lookup URL path for a discovery lookup per
|
|
41
|
+
* TRANSPORT.md §4.2.1: `/v1/discovery/{address}`.
|
|
42
|
+
*/
|
|
43
|
+
export function discoveryPath(address) {
|
|
44
|
+
return `${PathDiscovery}/${address}`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Build the GET-lookup URL path for a key request per
|
|
48
|
+
* TRANSPORT.md §4.2.1: `/v1/keys/{address}`.
|
|
49
|
+
*/
|
|
50
|
+
export function keysPath(address) {
|
|
51
|
+
return `${PathKeys}/${address}`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Build the GET-stream URL path for a session id per
|
|
55
|
+
* TRANSPORT.md §4.2.4: `/v1/session/{id}`.
|
|
56
|
+
*/
|
|
57
|
+
export function sessionPath(sessionId) {
|
|
58
|
+
return `${PathSession}${sessionId}`;
|
|
59
|
+
}
|
|
33
60
|
/**
|
|
34
61
|
* POST a SEMP message to one of the request/response endpoints
|
|
35
62
|
* (`/v1/handshake`, `/v1/keys`, `/v1/envelope`, `/v1/discovery`).
|
|
@@ -186,7 +213,7 @@ export async function dialH2Session(opts) {
|
|
|
186
213
|
* The encoder normalizes CR / CRLF line terminators to LF before
|
|
187
214
|
* emitting each `data:` line. SEMP payloads are JSON documents whose
|
|
188
215
|
* control bytes are escaped (`\r`, `\n`), so the wire form never
|
|
189
|
-
* actually carries a literal CR or LF
|
|
216
|
+
* actually carries a literal CR or LF - but be defensive.
|
|
190
217
|
*/
|
|
191
218
|
export function encodeSSE(message) {
|
|
192
219
|
const lines = splitSSELines(message);
|
|
@@ -222,7 +249,7 @@ function splitSSELines(s) {
|
|
|
222
249
|
/**
|
|
223
250
|
* Decode SSE events from a string buffer. Each call returns the next
|
|
224
251
|
* complete event's `data` payload (or `null` if no complete event is
|
|
225
|
-
* buffered yet). Stateful
|
|
252
|
+
* buffered yet). Stateful - the buffer accumulates partial input.
|
|
226
253
|
*/
|
|
227
254
|
export class SSEDecoder {
|
|
228
255
|
buffer = "";
|
|
@@ -252,10 +279,10 @@ export class SSEDecoder {
|
|
|
252
279
|
this.dataLines = [];
|
|
253
280
|
return event;
|
|
254
281
|
}
|
|
255
|
-
// Empty leading lines (keepalives)
|
|
282
|
+
// Empty leading lines (keepalives) - skip.
|
|
256
283
|
continue;
|
|
257
284
|
}
|
|
258
|
-
// Comment lines start with ":"
|
|
285
|
+
// Comment lines start with ":" - ignore.
|
|
259
286
|
if (line.startsWith(":")) {
|
|
260
287
|
continue;
|
|
261
288
|
}
|