@sempdev/semp 0.5.2 → 0.5.6
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/forwarder.d.ts +9 -1
- package/dist/delivery/forwarder.d.ts.map +1 -1
- package/dist/delivery/forwarder.js +1 -1
- package/dist/delivery/forwarder.js.map +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.d.ts.map +1 -1
- package/dist/delivery/pipeline.js +10 -3
- package/dist/delivery/pipeline.js.map +1 -1
- 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 +2 -2
- package/dist/envelope/compose.js +4 -4
- package/dist/envelope/encode.d.ts +2 -2
- package/dist/envelope/encode.js +3 -3
- 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 +27 -9
- package/dist/handshake/federation.d.ts.map +1 -1
- package/dist/handshake/federation.js +69 -17
- package/dist/handshake/federation.js.map +1 -1
- 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/index.d.ts +1 -1
- package/dist/handshake/index.d.ts.map +1 -1
- package/dist/handshake/index.js.map +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 +7 -2
- package/dist/keys/sign.d.ts.map +1 -1
- package/dist/keys/sign.js +10 -3
- package/dist/keys/sign.js.map +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
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SEMP_STATUS recipient-status configuration message per
|
|
3
|
+
* draft-gokce-semp-delivery §1.6.5.
|
|
4
|
+
*
|
|
5
|
+
* The client composes a signed StatusMessage carrying the user's
|
|
6
|
+
* state, optional message and until, plus the visibility rule
|
|
7
|
+
* that determines which senders may receive the status in
|
|
8
|
+
* acknowledgments. The client transmits the record to the home
|
|
9
|
+
* server as a signed message under the originating device's key;
|
|
10
|
+
* the home server verifies, checks device_id against the
|
|
11
|
+
* registered device set, and applies the latest update by
|
|
12
|
+
* updated_at.
|
|
13
|
+
*
|
|
14
|
+
* This is distinct from the runtime recipient-status surface in
|
|
15
|
+
* `./status.ts` (the value attached to delivery acknowledgments).
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import { signSignedDoc, verifySignedDoc } from "../keys/index.js";
|
|
20
|
+
/** Wire-level type discriminator. */
|
|
21
|
+
export const StatusMessageType = "SEMP_STATUS";
|
|
22
|
+
/** Wire-level version. */
|
|
23
|
+
export const StatusMessageVersion = "1.0.0";
|
|
24
|
+
/** Domain-separation prefix for SEMP_STATUS signatures. */
|
|
25
|
+
export const StatusMessagePrefix = "SEMP-STATUS:";
|
|
26
|
+
/**
|
|
27
|
+
* Sign `m.signature` with the originating device's identity
|
|
28
|
+
* private key under the SEMP-STATUS: prefix. Mutates m in place
|
|
29
|
+
* and returns the base64 signature value.
|
|
30
|
+
*/
|
|
31
|
+
export function signStatusMessage(m, devicePriv, deviceKeyId) {
|
|
32
|
+
if (deviceKeyId === "") {
|
|
33
|
+
throw new Error("delivery: empty device key_id");
|
|
34
|
+
}
|
|
35
|
+
if (m.type === "") {
|
|
36
|
+
m.type = StatusMessageType;
|
|
37
|
+
}
|
|
38
|
+
if (m.version === "") {
|
|
39
|
+
m.version = StatusMessageVersion;
|
|
40
|
+
}
|
|
41
|
+
validateStatusMessage(m, { skipSignatureCheck: true });
|
|
42
|
+
m.signature.algorithm = "ed25519";
|
|
43
|
+
m.signature.key_id = deviceKeyId;
|
|
44
|
+
m.signature.value = "";
|
|
45
|
+
const { signedJSON, signatureB64 } = signSignedDoc({
|
|
46
|
+
preSignJSON: m,
|
|
47
|
+
seed: devicePriv,
|
|
48
|
+
signaturePath: "signature.value",
|
|
49
|
+
prefix: StatusMessagePrefix,
|
|
50
|
+
});
|
|
51
|
+
m.signature.value = signedJSON.signature.value;
|
|
52
|
+
return signatureB64;
|
|
53
|
+
}
|
|
54
|
+
/** Verify `m.signature` against the originating device's public key. */
|
|
55
|
+
export function verifyStatusMessage(m, devicePub) {
|
|
56
|
+
validateStatusMessage(m);
|
|
57
|
+
if (m.signature.value === "") {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const { ok } = verifySignedDoc({
|
|
61
|
+
signedJSON: m,
|
|
62
|
+
publicKey: devicePub,
|
|
63
|
+
signaturePath: "signature.value",
|
|
64
|
+
prefix: StatusMessagePrefix,
|
|
65
|
+
});
|
|
66
|
+
return ok;
|
|
67
|
+
}
|
|
68
|
+
/** Structural validation per §1.6.5. */
|
|
69
|
+
export function validateStatusMessage(m, opts = {}) {
|
|
70
|
+
if (m.type !== StatusMessageType) {
|
|
71
|
+
throw new Error(`delivery: status message type ${JSON.stringify(m.type)}, want ${StatusMessageType}`);
|
|
72
|
+
}
|
|
73
|
+
if (m.version === "") {
|
|
74
|
+
throw new Error("delivery: status message missing version");
|
|
75
|
+
}
|
|
76
|
+
if (m.user_id === "") {
|
|
77
|
+
throw new Error("delivery: status message missing user_id");
|
|
78
|
+
}
|
|
79
|
+
if (m.state === "") {
|
|
80
|
+
throw new Error("delivery: status message missing state");
|
|
81
|
+
}
|
|
82
|
+
if (m.device_id === "") {
|
|
83
|
+
throw new Error("delivery: status message missing device_id");
|
|
84
|
+
}
|
|
85
|
+
if (m.updated_at === "") {
|
|
86
|
+
throw new Error("delivery: status message missing updated_at");
|
|
87
|
+
}
|
|
88
|
+
if (m.visibility.mode === "") {
|
|
89
|
+
throw new Error("delivery: status message visibility.mode is empty");
|
|
90
|
+
}
|
|
91
|
+
if (m.visibility.allow !== undefined) {
|
|
92
|
+
for (let i = 0; i < m.visibility.allow.length; i++) {
|
|
93
|
+
const e = m.visibility.allow[i];
|
|
94
|
+
if (e === undefined) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (e.type === "domain" && e.domain === "") {
|
|
98
|
+
throw new Error(`delivery: status visibility.allow[${i}] type=domain missing domain`);
|
|
99
|
+
}
|
|
100
|
+
if (e.type === "user" && e.address === "") {
|
|
101
|
+
throw new Error(`delivery: status visibility.allow[${i}] type=user missing address`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (!opts.skipSignatureCheck && m.signature === undefined) {
|
|
106
|
+
throw new Error("delivery: status message missing signature");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=status_message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status_message.js","sourceRoot":"","sources":["../../src/delivery/status_message.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAElE,qCAAqC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE/C,0BAA0B;AAC1B,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC;AA0ClD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,CAAgB,EAChB,UAAs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AAC,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;gBACpB,SAAS;YACX,CAAC;YACD,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;gBAC3C,MAAM,IAAI,KAAK,CACb,qCAAqC,CAAC,8BAA8B,CACrE,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,OAAO,KAAK,EAAE,EAAE,CAAC;gBAC1C,MAAM,IAAI,KAAK,CACb,qCAAqC,CAAC,6BAA6B,CACpE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SEMP upgrade-signaling SMTP headers per
|
|
3
|
+
* draft-gokce-semp-client §5.7.
|
|
4
|
+
*
|
|
5
|
+
* A SEMP-capable client SHOULD include these on every outbound
|
|
6
|
+
* SMTP message so a receiving SEMP-capable client can offer a
|
|
7
|
+
* thread upgrade without an additional DNS lookup. A recipient
|
|
8
|
+
* client that acts on the signal MUST verify the advertised
|
|
9
|
+
* identity by completing SEMP discovery against
|
|
10
|
+
* {@link UpgradeHeaderDomain} and fetching the identity key from
|
|
11
|
+
* that domain before treating the upgrade as trusted.
|
|
12
|
+
*
|
|
13
|
+
* The signal is unauthenticated at the SMTP layer; treat the
|
|
14
|
+
* headers as a hint only.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Boolean-style header name set to {@link UpgradeCapabilityPresent}
|
|
20
|
+
* whenever the sender's client can receive via SEMP at a published
|
|
21
|
+
* SEMP address.
|
|
22
|
+
*/
|
|
23
|
+
export declare const UpgradeHeaderCapability = "SEMP-Capability";
|
|
24
|
+
/**
|
|
25
|
+
* Header carrying the fingerprint of the sender's current SEMP
|
|
26
|
+
* identity public key in `<algorithm>:<hex>` form (for example
|
|
27
|
+
* `ed25519:abc123...`).
|
|
28
|
+
*/
|
|
29
|
+
export declare const UpgradeHeaderIdentity = "SEMP-Identity";
|
|
30
|
+
/**
|
|
31
|
+
* Header naming the sender's SEMP domain (the domain part of the
|
|
32
|
+
* sender's SEMP address). MAY differ from the domain of the SMTP
|
|
33
|
+
* `From` header.
|
|
34
|
+
*/
|
|
35
|
+
export declare const UpgradeHeaderDomain = "SEMP-Domain";
|
|
36
|
+
/**
|
|
37
|
+
* Header carrying the full SEMP address of the sender so the
|
|
38
|
+
* recipient does not have to infer it from the SMTP `From`
|
|
39
|
+
* local-part when the SMTP and SEMP local-parts differ.
|
|
40
|
+
*/
|
|
41
|
+
export declare const UpgradeHeaderAddress = "SEMP-Address";
|
|
42
|
+
/**
|
|
43
|
+
* Value the sender writes into the {@link UpgradeHeaderCapability}
|
|
44
|
+
* header. Single fixed value; future spec versions may extend the
|
|
45
|
+
* vocabulary.
|
|
46
|
+
*/
|
|
47
|
+
export declare const UpgradeCapabilityPresent = "1";
|
|
48
|
+
//# sourceMappingURL=upgrade_signal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade_signal.d.ts","sourceRoot":"","sources":["../../src/delivery/upgrade_signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SEMP upgrade-signaling SMTP headers per
|
|
3
|
+
* draft-gokce-semp-client §5.7.
|
|
4
|
+
*
|
|
5
|
+
* A SEMP-capable client SHOULD include these on every outbound
|
|
6
|
+
* SMTP message so a receiving SEMP-capable client can offer a
|
|
7
|
+
* thread upgrade without an additional DNS lookup. A recipient
|
|
8
|
+
* client that acts on the signal MUST verify the advertised
|
|
9
|
+
* identity by completing SEMP discovery against
|
|
10
|
+
* {@link UpgradeHeaderDomain} and fetching the identity key from
|
|
11
|
+
* that domain before treating the upgrade as trusted.
|
|
12
|
+
*
|
|
13
|
+
* The signal is unauthenticated at the SMTP layer; treat the
|
|
14
|
+
* headers as a hint only.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Boolean-style header name set to {@link UpgradeCapabilityPresent}
|
|
20
|
+
* whenever the sender's client can receive via SEMP at a published
|
|
21
|
+
* SEMP address.
|
|
22
|
+
*/
|
|
23
|
+
export const UpgradeHeaderCapability = "SEMP-Capability";
|
|
24
|
+
/**
|
|
25
|
+
* Header carrying the fingerprint of the sender's current SEMP
|
|
26
|
+
* identity public key in `<algorithm>:<hex>` form (for example
|
|
27
|
+
* `ed25519:abc123...`).
|
|
28
|
+
*/
|
|
29
|
+
export const UpgradeHeaderIdentity = "SEMP-Identity";
|
|
30
|
+
/**
|
|
31
|
+
* Header naming the sender's SEMP domain (the domain part of the
|
|
32
|
+
* sender's SEMP address). MAY differ from the domain of the SMTP
|
|
33
|
+
* `From` header.
|
|
34
|
+
*/
|
|
35
|
+
export const UpgradeHeaderDomain = "SEMP-Domain";
|
|
36
|
+
/**
|
|
37
|
+
* Header carrying the full SEMP address of the sender so the
|
|
38
|
+
* recipient does not have to infer it from the SMTP `From`
|
|
39
|
+
* local-part when the SMTP and SEMP local-parts differ.
|
|
40
|
+
*/
|
|
41
|
+
export const UpgradeHeaderAddress = "SEMP-Address";
|
|
42
|
+
/**
|
|
43
|
+
* Value the sender writes into the {@link UpgradeHeaderCapability}
|
|
44
|
+
* header. Single fixed value; future spec versions may extend the
|
|
45
|
+
* vocabulary.
|
|
46
|
+
*/
|
|
47
|
+
export const UpgradeCapabilityPresent = "1";
|
|
48
|
+
//# sourceMappingURL=upgrade_signal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade_signal.js","sourceRoot":"","sources":["../../src/delivery/upgrade_signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAErD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAEnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC"}
|
|
@@ -50,10 +50,28 @@ export interface ConfigEndpoints {
|
|
|
50
50
|
backup?: string;
|
|
51
51
|
migration?: string;
|
|
52
52
|
transparency_log?: string;
|
|
53
|
-
attachment_storage?: string;
|
|
54
53
|
/** Forward-compatible: any unknown endpoint URL keys land here. */
|
|
55
54
|
[key: string]: string | TransportEndpoints | undefined;
|
|
56
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Trust-gossip reciprocity policy mode per DISCOVERY.md §3.1.5 /
|
|
58
|
+
* DELIVERY.md §12.1. A peer that enforces reciprocity MUST
|
|
59
|
+
* disclose its policy in the configuration document so prospective
|
|
60
|
+
* consumers can capability-negotiate before fetching.
|
|
61
|
+
*
|
|
62
|
+
* - "none": no reciprocity requirement.
|
|
63
|
+
* - "lenient": prefers reciprocity but serves non-publishers; MAY
|
|
64
|
+
* weight their observations lower.
|
|
65
|
+
* - "strict": refuses to serve consumers that do not meet
|
|
66
|
+
* `minimum_publish_volume` across `evaluation_window_days`.
|
|
67
|
+
*/
|
|
68
|
+
export type ReciprocityMode = "none" | "lenient" | "strict";
|
|
69
|
+
/** Reciprocity policy disclosure per §3.1.5. */
|
|
70
|
+
export interface ReciprocityPolicy {
|
|
71
|
+
mode: ReciprocityMode;
|
|
72
|
+
minimum_publish_volume?: number;
|
|
73
|
+
evaluation_window_days?: number;
|
|
74
|
+
}
|
|
57
75
|
/** Operational limits per §3.1.3. */
|
|
58
76
|
export interface ConfigLimits {
|
|
59
77
|
max_envelope_size: number;
|
|
@@ -76,6 +94,7 @@ export interface Configuration {
|
|
|
76
94
|
suites: string[];
|
|
77
95
|
limits: ConfigLimits;
|
|
78
96
|
extensions?: ConfigExtension[];
|
|
97
|
+
reciprocity?: ReciprocityPolicy;
|
|
79
98
|
/** Forward-compatible: unknown top-level fields preserved here. */
|
|
80
99
|
[key: string]: unknown;
|
|
81
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/discovery/configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,aAAa,oCAAoC,CAAC;AAE/D,qCAAqC;AACrC,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,QAAY,CAAC;AAE3C,kDAAkD;AAClD,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAExD,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,QAAQ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KD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEjE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAM/E;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,GAAG,EAAE,MAAM,GACV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMzB;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAWV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/discovery/configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAE/D,qCAAqC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/discovery/configuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAE/D,qCAAqC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAEtD;;;;;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";
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* A parsed SEMP SRV record per §2.1. Returned by both
|
|
17
|
+
* {@link lookupSRV} (the standard `_semp._tcp.<domain>` record) and
|
|
18
|
+
* {@link lookupSRVUDP} (the optional `_semp._udp.<domain>` record
|
|
19
|
+
* that operators MAY publish to advertise a distinct QUIC target).
|
|
20
|
+
*/
|
|
16
21
|
export interface SRVRecord {
|
|
17
22
|
priority: number;
|
|
18
23
|
weight: number;
|
|
@@ -45,6 +50,27 @@ export declare function defaultDNSLookup(): Promise<DNSLookup>;
|
|
|
45
50
|
* selection per RFC 2782 sort within a priority group themselves).
|
|
46
51
|
*/
|
|
47
52
|
export declare function lookupSRV(domain: string, lookup?: DNSLookup): Promise<SRVRecord[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Look up the optional `_semp._udp.<domain>` SRV records per §2.1.
|
|
55
|
+
* Operators MAY publish this record when they want to advertise a
|
|
56
|
+
* distinct UDP target for QUIC (different host/port than the TCP
|
|
57
|
+
* target). Clients selecting QUIC MUST prefer it over the
|
|
58
|
+
* `_semp._tcp` target when present. When absent the QUIC endpoint
|
|
59
|
+
* defaults to the `_semp._tcp` target's host:port, which is the
|
|
60
|
+
* common case.
|
|
61
|
+
*
|
|
62
|
+
* Returns an empty array when no `_udp` record is published.
|
|
63
|
+
*/
|
|
64
|
+
export declare function lookupSRVUDP(domain: string, lookup?: DNSLookup): Promise<SRVRecord[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Resolve the SRV record a QUIC-capable client should use for
|
|
67
|
+
* `domain`. Prefers the optional `_semp._udp` record when present
|
|
68
|
+
* (operator-specified distinct UDP target). Otherwise falls back to
|
|
69
|
+
* the `_semp._tcp` target's host:port per DISCOVERY.md §2.1.
|
|
70
|
+
*
|
|
71
|
+
* Returns null when neither record exists.
|
|
72
|
+
*/
|
|
73
|
+
export declare function quicTarget(domain: string, lookup?: DNSLookup): Promise<SRVRecord | null>;
|
|
48
74
|
/**
|
|
49
75
|
* Look up `_semp._tcp.<domain>` TXT records and return the first
|
|
50
76
|
* one whose `v=` parameter is `semp1`. Returns null when no SEMP
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dns.d.ts","sourceRoot":"","sources":["../../src/discovery/dns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,UAAU,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"dns.d.ts","sourceRoot":"","sources":["../../src/discovery/dns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,UAAU,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,mCAAmC;AACnC,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAChD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;CAC/C;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,SAAS,CAAC,CAqD3D;AAoBD;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,EAAE,CAAC,CAKtB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,EAAE,CAAC,CAKtB;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAW3B;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAWjC;AAED,uEAAuE;AACvE,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAGrB"}
|
package/dist/discovery/dns.js
CHANGED
|
@@ -95,6 +95,43 @@ export async function lookupSRV(domain, lookup) {
|
|
|
95
95
|
const recs = await dns.lookupSRV(name);
|
|
96
96
|
return [...recs].sort((a, b) => a.priority - b.priority);
|
|
97
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Look up the optional `_semp._udp.<domain>` SRV records per §2.1.
|
|
100
|
+
* Operators MAY publish this record when they want to advertise a
|
|
101
|
+
* distinct UDP target for QUIC (different host/port than the TCP
|
|
102
|
+
* target). Clients selecting QUIC MUST prefer it over the
|
|
103
|
+
* `_semp._tcp` target when present. When absent the QUIC endpoint
|
|
104
|
+
* defaults to the `_semp._tcp` target's host:port, which is the
|
|
105
|
+
* common case.
|
|
106
|
+
*
|
|
107
|
+
* Returns an empty array when no `_udp` record is published.
|
|
108
|
+
*/
|
|
109
|
+
export async function lookupSRVUDP(domain, lookup) {
|
|
110
|
+
const dns = lookup ?? (await defaultDNSLookup());
|
|
111
|
+
const name = `_semp._udp.${domain}`;
|
|
112
|
+
const recs = await dns.lookupSRV(name);
|
|
113
|
+
return [...recs].sort((a, b) => a.priority - b.priority);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Resolve the SRV record a QUIC-capable client should use for
|
|
117
|
+
* `domain`. Prefers the optional `_semp._udp` record when present
|
|
118
|
+
* (operator-specified distinct UDP target). Otherwise falls back to
|
|
119
|
+
* the `_semp._tcp` target's host:port per DISCOVERY.md §2.1.
|
|
120
|
+
*
|
|
121
|
+
* Returns null when neither record exists.
|
|
122
|
+
*/
|
|
123
|
+
export async function quicTarget(domain, lookup) {
|
|
124
|
+
const dns = lookup ?? (await defaultDNSLookup());
|
|
125
|
+
const udp = await lookupSRVUDP(domain, dns);
|
|
126
|
+
if (udp.length > 0) {
|
|
127
|
+
return udp[0] ?? null;
|
|
128
|
+
}
|
|
129
|
+
const tcp = await lookupSRV(domain, dns);
|
|
130
|
+
if (tcp.length > 0) {
|
|
131
|
+
return tcp[0] ?? null;
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
98
135
|
/**
|
|
99
136
|
* Look up `_semp._tcp.<domain>` TXT records and return the first
|
|
100
137
|
* one whose `v=` parameter is `semp1`. Returns null when no SEMP
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dns.js","sourceRoot":"","sources":["../../src/discovery/dns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAwB,oBAAoB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"dns.js","sourceRoot":"","sources":["../../src/discovery/dns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAwB,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAgCtE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,GAAuC,CAAC;IAC5C,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,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AK,UAAU,SAAS,CAC7B,MAAc,EACd,MAAkB;IAElB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,gBAAgB,EAAE,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,cAAc,MAAM,EAAE,CAAC;IACpC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,GAAG,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;YACtB,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,uEAAuE;AACvE,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAAc,EACd,MAAkB;IAElB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,gBAAgB,EAAE,CAAC,CAAC;IACjD,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
export { parseTXTCapabilities, type TXTCapabilities } from "./txt.js";
|
|
11
|
-
export { type ConfigEndpoints, type ConfigExtension, type ConfigLimits, type Configuration, type TransportEndpoints, ConfigurationType, WellKnownMaxBytes, WellKnownPath, parseConfiguration, } from "./configuration.js";
|
|
11
|
+
export { type ConfigEndpoints, type ConfigExtension, type ConfigLimits, type Configuration, type ReciprocityMode, type ReciprocityPolicy, type TransportEndpoints, ConfigurationType, WellKnownMaxBytes, WellKnownPath, parseConfiguration, } from "./configuration.js";
|
|
12
12
|
export { type DomainKeys, type KeyBlock, DomainKeysMaxBytes, DomainKeysType, decodeKeyBlockPublic, parseDomainKeys, verifyDomainKeyFingerprint, } from "./domain_keys.js";
|
|
13
13
|
export { type FetchLike, type FetchOptions, type ResolveServerOptions, type ResolvedServer, fetchConfiguration, fetchDomainKeys, resolveServer, wellKnownUrl, } from "./resolver.js";
|
|
14
|
-
export { type DNSLookup, type MXRecord, type SRVRecord, defaultDNSLookup, lookupMX, lookupSRV, lookupTXT, } from "./dns.js";
|
|
14
|
+
export { type DNSLookup, type MXRecord, type SRVRecord, defaultDNSLookup, lookupMX, lookupSRV, lookupSRVUDP, lookupTXT, quicTarget, } from "./dns.js";
|
|
15
15
|
export { type DiscoveryCache, DefaultTTLLegacyMs, DefaultTTLNotFoundMs, DefaultTTLSEMPMs, InMemoryDiscoveryCache, } from "./cache.js";
|
|
16
16
|
export { type DiscoveryRequest, type DiscoveryResponse, type DiscoveryResult, type DiscoverySignature, type DiscoveryStatus, DiscoveryMessageType, DiscoveryRecordVersion, DiscoverySignaturePrefix, DiscoveryStepRequest, DiscoveryStepResponse, signDiscoveryResponse, validateDiscoveryRequest, validateDiscoveryResponse, verifyDiscoveryResponse, } from "./lookup.js";
|
|
17
17
|
export { OnionSuffix, OnionV3LabelLength, isOnionDomain, validateOnionDomain, } from "./onion.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,oBAAoB,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAEtE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,oBAAoB,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAEtE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,SAAS,EACT,UAAU,GACX,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,KAAK,cAAc,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
|
package/dist/discovery/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export { parseTXTCapabilities } from "./txt.js";
|
|
|
11
11
|
export { ConfigurationType, WellKnownMaxBytes, WellKnownPath, parseConfiguration, } from "./configuration.js";
|
|
12
12
|
export { DomainKeysMaxBytes, DomainKeysType, decodeKeyBlockPublic, parseDomainKeys, verifyDomainKeyFingerprint, } from "./domain_keys.js";
|
|
13
13
|
export { fetchConfiguration, fetchDomainKeys, resolveServer, wellKnownUrl, } from "./resolver.js";
|
|
14
|
-
export { defaultDNSLookup, lookupMX, lookupSRV, lookupTXT, } from "./dns.js";
|
|
14
|
+
export { defaultDNSLookup, lookupMX, lookupSRV, lookupSRVUDP, lookupTXT, quicTarget, } from "./dns.js";
|
|
15
15
|
export { DefaultTTLLegacyMs, DefaultTTLNotFoundMs, DefaultTTLSEMPMs, InMemoryDiscoveryCache, } from "./cache.js";
|
|
16
16
|
export { DiscoveryMessageType, DiscoveryRecordVersion, DiscoverySignaturePrefix, DiscoveryStepRequest, DiscoveryStepResponse, signDiscoveryResponse, validateDiscoveryRequest, validateDiscoveryResponse, verifyDiscoveryResponse, } from "./lookup.js";
|
|
17
17
|
export { OnionSuffix, OnionV3LabelLength, isOnionDomain, validateOnionDomain, } from "./onion.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,oBAAoB,EAAwB,MAAM,UAAU,CAAC;AAEtE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,oBAAoB,EAAwB,MAAM,UAAU,CAAC;AAEtE,OAAO,EAQL,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAGL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAKL,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAIL,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,SAAS,EACT,UAAU,GACX,MAAM,UAAU,CAAC;AAElB,OAAO,EAEL,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAML,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAML,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
|
|
@@ -50,7 +50,7 @@ export declare function defaultAlphaRanges(servers: number): AlphaRange[];
|
|
|
50
50
|
* lookup server (published at `_semp-partition-lookup.<domain>` SRV)
|
|
51
51
|
* and returns the hostname of the delivery server that handles
|
|
52
52
|
* `address`. The discovery package does not prescribe the wire
|
|
53
|
-
* format of the lookup query
|
|
53
|
+
* format of the lookup query - DISCOVERY.md §2.4 says "the
|
|
54
54
|
* partition server address is published as a separate SRV record"
|
|
55
55
|
* and leaves the query protocol to the implementation.
|
|
56
56
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Discovery resolver
|
|
2
|
+
* Discovery resolver - well-known URI fetch + parse, plus the
|
|
3
3
|
* higher-level "resolve a server" orchestrator that produces the
|
|
4
4
|
* `serverDomainPub` a {@link "../handshake/driver".runClient} call
|
|
5
5
|
* needs.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* the resolver uses Node 22+'s global `fetch`.
|
|
10
10
|
*
|
|
11
11
|
* The DNS SRV / TXT lookup leg of §5.1 is intentionally not
|
|
12
|
-
* implemented in this module
|
|
12
|
+
* implemented in this module - it requires `node:dns/promises` and
|
|
13
13
|
* does not cleanly tree-shake into a browser bundle. Callers that
|
|
14
14
|
* need DNS-first discovery wire it in front of {@link resolveServer}
|
|
15
15
|
* and pass an explicit `host` / well-known URL.
|
|
@@ -42,7 +42,7 @@ export interface FetchOptions {
|
|
|
42
42
|
/** Optional cancellation signal. */
|
|
43
43
|
signal?: AbortSignal;
|
|
44
44
|
/**
|
|
45
|
-
* Per-request timeout in milliseconds. Defaults to 10 seconds
|
|
45
|
+
* Per-request timeout in milliseconds. Defaults to 10 seconds -
|
|
46
46
|
* matches semp-go's `FetchConfiguration` default.
|
|
47
47
|
*/
|
|
48
48
|
timeoutMs?: number;
|
|
@@ -54,7 +54,7 @@ export declare function wellKnownUrl(host: string): string;
|
|
|
54
54
|
* Throws on transport failure, non-200 status, oversized body, or
|
|
55
55
|
* structural parse failure.
|
|
56
56
|
*
|
|
57
|
-
* The URL's scheme is NOT enforced
|
|
57
|
+
* The URL's scheme is NOT enforced - production callers must pass an
|
|
58
58
|
* `https://` URL, but tests need to point at a local httptest-style
|
|
59
59
|
* server so this layer stays permissive.
|
|
60
60
|
*/
|
|
@@ -64,7 +64,7 @@ export declare function fetchConfiguration(url: string, opts?: FetchOptions): Pr
|
|
|
64
64
|
* `endpoints.domain_keys` in a server's configuration. Returns the
|
|
65
65
|
* parsed document and the cross-checked signing-key public bytes.
|
|
66
66
|
*
|
|
67
|
-
* Throws if the fingerprint cross-check fails
|
|
67
|
+
* Throws if the fingerprint cross-check fails - a peer that trusts
|
|
68
68
|
* the publication channel still MUST confirm `key_id` is the SHA-256
|
|
69
69
|
* fingerprint of `public_key`, otherwise a misconfiguration could
|
|
70
70
|
* swap in a key whose fingerprint doesn't match the one the peer
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Discovery resolver
|
|
2
|
+
* Discovery resolver - well-known URI fetch + parse, plus the
|
|
3
3
|
* higher-level "resolve a server" orchestrator that produces the
|
|
4
4
|
* `serverDomainPub` a {@link "../handshake/driver".runClient} call
|
|
5
5
|
* needs.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* the resolver uses Node 22+'s global `fetch`.
|
|
10
10
|
*
|
|
11
11
|
* The DNS SRV / TXT lookup leg of §5.1 is intentionally not
|
|
12
|
-
* implemented in this module
|
|
12
|
+
* implemented in this module - it requires `node:dns/promises` and
|
|
13
13
|
* does not cleanly tree-shake into a browser bundle. Callers that
|
|
14
14
|
* need DNS-first discovery wire it in front of {@link resolveServer}
|
|
15
15
|
* and pass an explicit `host` / well-known URL.
|
|
@@ -30,7 +30,7 @@ export function wellKnownUrl(host) {
|
|
|
30
30
|
* Throws on transport failure, non-200 status, oversized body, or
|
|
31
31
|
* structural parse failure.
|
|
32
32
|
*
|
|
33
|
-
* The URL's scheme is NOT enforced
|
|
33
|
+
* The URL's scheme is NOT enforced - production callers must pass an
|
|
34
34
|
* `https://` URL, but tests need to point at a local httptest-style
|
|
35
35
|
* server so this layer stays permissive.
|
|
36
36
|
*/
|
|
@@ -50,7 +50,7 @@ export async function fetchConfiguration(url, opts = {}) {
|
|
|
50
50
|
* `endpoints.domain_keys` in a server's configuration. Returns the
|
|
51
51
|
* parsed document and the cross-checked signing-key public bytes.
|
|
52
52
|
*
|
|
53
|
-
* Throws if the fingerprint cross-check fails
|
|
53
|
+
* Throws if the fingerprint cross-check fails - a peer that trusts
|
|
54
54
|
* the publication channel still MUST confirm `key_id` is the SHA-256
|
|
55
55
|
* fingerprint of `public_key`, otherwise a misconfiguration could
|
|
56
56
|
* swap in a key whose fingerprint doesn't match the one the peer
|
|
@@ -144,7 +144,7 @@ async function fetchTextBounded(url, maxBytes, opts) {
|
|
|
144
144
|
if (!resp.ok) {
|
|
145
145
|
throw new Error(`discovery: GET ${url} returned ${resp.status}`);
|
|
146
146
|
}
|
|
147
|
-
// Permissive content-type check
|
|
147
|
+
// Permissive content-type check - some servers return
|
|
148
148
|
// application/octet-stream for .json paths. We require JSON in the
|
|
149
149
|
// body parse, not in the header.
|
|
150
150
|
const ct = resp.headers.get("content-type") ?? "";
|
package/dist/discovery/txt.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - `c` list comma-separated transport identifiers
|
|
15
15
|
* - `f` list comma-separated optional features
|
|
16
16
|
*
|
|
17
|
-
* Unknown keys MUST be ignored, not rejected
|
|
17
|
+
* Unknown keys MUST be ignored, not rejected - DNS TXT records are
|
|
18
18
|
* a public surface and an upgrading peer might add new keys before
|
|
19
19
|
* a downgrading peer learns about them.
|
|
20
20
|
*
|
package/dist/discovery/txt.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - `c` list comma-separated transport identifiers
|
|
15
15
|
* - `f` list comma-separated optional features
|
|
16
16
|
*
|
|
17
|
-
* Unknown keys MUST be ignored, not rejected
|
|
17
|
+
* Unknown keys MUST be ignored, not rejected - DNS TXT records are
|
|
18
18
|
* a public surface and an upgrading peer might add new keys before
|
|
19
19
|
* a downgrading peer learns about them.
|
|
20
20
|
*
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Signed scope: the `original_enclosure_plaintext` subtree.
|
|
10
10
|
*
|
|
11
11
|
* 2. The FORWARDER's `forwarder_attestation` over the
|
|
12
|
-
* `forwarded_from` block
|
|
12
|
+
* `forwarded_from` block - the inner sender_signature is
|
|
13
13
|
* already populated by step 1, so this signs over canonical
|
|
14
14
|
* bytes that include it. Prefix: `SEMP-FORWARDER-ATTESTATION:`.
|
|
15
15
|
* Signed scope: the entire `forwarded_from` subtree.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Signed scope: the `original_enclosure_plaintext` subtree.
|
|
10
10
|
*
|
|
11
11
|
* 2. The FORWARDER's `forwarder_attestation` over the
|
|
12
|
-
* `forwarded_from` block
|
|
12
|
+
* `forwarded_from` block - the inner sender_signature is
|
|
13
13
|
* already populated by step 1, so this signs over canonical
|
|
14
14
|
* bytes that include it. Prefix: `SEMP-FORWARDER-ATTESTATION:`.
|
|
15
15
|
* Signed scope: the entire `forwarded_from` subtree.
|
|
@@ -20,7 +20,7 @@ export declare const DefaultMaxEnvelopeSize: number;
|
|
|
20
20
|
* Select the size bucket for an unpadded envelope of the given byte
|
|
21
21
|
* size per the default power-of-two curve (4096, 8192, 16384, ...).
|
|
22
22
|
*
|
|
23
|
-
* Throws on negative input or input that exceeds the ceiling
|
|
23
|
+
* Throws on negative input or input that exceeds the ceiling - over-
|
|
24
24
|
* limit envelopes MUST be recomposed; padding is not a remedy for
|
|
25
25
|
* over-limit content.
|
|
26
26
|
*/
|
|
@@ -31,7 +31,7 @@ export declare function selectSizeBucket(unpaddedSize: number, maxEnvelopeSize?:
|
|
|
31
31
|
* in which case the floor relaxes to 1 (a single-domain non-group
|
|
32
32
|
* send reveals only the obvious cardinality and gains no
|
|
33
33
|
* obfuscation from padding to 2). Real counts above 1024 force
|
|
34
|
-
* recomposition into multiple envelopes
|
|
34
|
+
* recomposition into multiple envelopes - the runner returns a
|
|
35
35
|
* sentinel of -1 in that case so callers can detect it.
|
|
36
36
|
*/
|
|
37
37
|
export declare function selectRecipientCountBucket(realRecipients: number, singleDomainNotGroup: boolean): number;
|