@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
package/dist/envelope/buckets.js
CHANGED
|
@@ -20,7 +20,7 @@ export const DefaultMaxEnvelopeSize = 25 * 1024 * 1024;
|
|
|
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
|
*/
|
|
@@ -51,7 +51,7 @@ export function selectSizeBucket(unpaddedSize, maxEnvelopeSize) {
|
|
|
51
51
|
* in which case the floor relaxes to 1 (a single-domain non-group
|
|
52
52
|
* send reveals only the obvious cardinality and gains no
|
|
53
53
|
* obfuscation from padding to 2). Real counts above 1024 force
|
|
54
|
-
* recomposition into multiple envelopes
|
|
54
|
+
* recomposition into multiple envelopes - the runner returns a
|
|
55
55
|
* sentinel of -1 in that case so callers can detect it.
|
|
56
56
|
*/
|
|
57
57
|
export function selectRecipientCountBucket(realRecipients, singleDomainNotGroup) {
|
|
@@ -130,7 +130,7 @@ export interface Envelope {
|
|
|
130
130
|
*/
|
|
131
131
|
export declare function compose(input: ComposeInput): Envelope;
|
|
132
132
|
/**
|
|
133
|
-
* Compute the §4.3 canonical envelope bytes
|
|
133
|
+
* Compute the §4.3 canonical envelope bytes - signature and
|
|
134
134
|
* session_mac blanked, hop_count and padding omitted.
|
|
135
135
|
*/
|
|
136
136
|
export declare function canonicalEnvelopeFor(envelope: unknown): Uint8Array;
|
|
@@ -162,7 +162,7 @@ export interface OpenedEnvelope {
|
|
|
162
162
|
* returns the parsed plaintexts. Throws if the recipient slot is
|
|
163
163
|
* absent or the AEAD tag does not verify.
|
|
164
164
|
*
|
|
165
|
-
* Does NOT verify seal.signature or seal.session_mac
|
|
165
|
+
* Does NOT verify seal.signature or seal.session_mac - those are
|
|
166
166
|
* the routing-server / receiving-server checks per §7.2 and live
|
|
167
167
|
* on the server side. {@link verifySealSignature} and
|
|
168
168
|
* {@link verifySessionMAC} are the corresponding verifier helpers.
|
package/dist/envelope/compose.js
CHANGED
|
@@ -89,10 +89,10 @@ export function compose(input) {
|
|
|
89
89
|
//
|
|
90
90
|
// Wire-shape rules:
|
|
91
91
|
// postmark.extensions and seal.extensions DEFAULT to {} when
|
|
92
|
-
// the caller doesn't pass them
|
|
92
|
+
// the caller doesn't pass them - these slots are always
|
|
93
93
|
// present on the wire (some routers depend on the keys
|
|
94
94
|
// existing as a marker even when empty).
|
|
95
|
-
// Top-level extensions DEFAULTS to absent
|
|
95
|
+
// Top-level extensions DEFAULTS to absent - the spec treats
|
|
96
96
|
// it as truly optional.
|
|
97
97
|
const postmark = {
|
|
98
98
|
...input.postmark,
|
|
@@ -131,7 +131,7 @@ export function compose(input) {
|
|
|
131
131
|
return env;
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
|
-
* Compute the §4.3 canonical envelope bytes
|
|
134
|
+
* Compute the §4.3 canonical envelope bytes - signature and
|
|
135
135
|
* session_mac blanked, hop_count and padding omitted.
|
|
136
136
|
*/
|
|
137
137
|
export function canonicalEnvelopeFor(envelope) {
|
|
@@ -161,7 +161,7 @@ export function canonicalEnvelopeFor(envelope) {
|
|
|
161
161
|
* returns the parsed plaintexts. Throws if the recipient slot is
|
|
162
162
|
* absent or the AEAD tag does not verify.
|
|
163
163
|
*
|
|
164
|
-
* Does NOT verify seal.signature or seal.session_mac
|
|
164
|
+
* Does NOT verify seal.signature or seal.session_mac - those are
|
|
165
165
|
* the routing-server / receiving-server checks per §7.2 and live
|
|
166
166
|
* on the server side. {@link verifySealSignature} and
|
|
167
167
|
* {@link verifySessionMAC} are the corresponding verifier helpers.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* (`Content-Type: application/semp-envelope`) and for storage as a
|
|
7
7
|
* `.semp` file.
|
|
8
8
|
*
|
|
9
|
-
* `encodeEnvelope` does NOT produce the canonical form
|
|
9
|
+
* `encodeEnvelope` does NOT produce the canonical form - use
|
|
10
10
|
* {@link "./canonical".canonicalEnvelopeBytes} for the byte stream
|
|
11
11
|
* consumed by signature and MAC computation.
|
|
12
12
|
*
|
|
@@ -19,7 +19,7 @@ export declare const EnvelopeMIMEType = "application/semp-envelope";
|
|
|
19
19
|
export declare const EnvelopeFileExtension = ".semp";
|
|
20
20
|
/**
|
|
21
21
|
* Wire JSON serialization of `env`. UTF-8, no BOM, no trailing
|
|
22
|
-
* newline
|
|
22
|
+
* newline - the byte sequence is suitable for transport bodies and
|
|
23
23
|
* for direct `.semp` file content.
|
|
24
24
|
*/
|
|
25
25
|
export declare function encodeEnvelope(env: Envelope): Uint8Array;
|
package/dist/envelope/encode.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* (`Content-Type: application/semp-envelope`) and for storage as a
|
|
7
7
|
* `.semp` file.
|
|
8
8
|
*
|
|
9
|
-
* `encodeEnvelope` does NOT produce the canonical form
|
|
9
|
+
* `encodeEnvelope` does NOT produce the canonical form - use
|
|
10
10
|
* {@link "./canonical".canonicalEnvelopeBytes} for the byte stream
|
|
11
11
|
* consumed by signature and MAC computation.
|
|
12
12
|
*
|
|
@@ -18,11 +18,11 @@ export const EnvelopeMIMEType = "application/semp-envelope";
|
|
|
18
18
|
export const EnvelopeFileExtension = ".semp";
|
|
19
19
|
/**
|
|
20
20
|
* Wire JSON serialization of `env`. UTF-8, no BOM, no trailing
|
|
21
|
-
* newline
|
|
21
|
+
* newline - the byte sequence is suitable for transport bodies and
|
|
22
22
|
* for direct `.semp` file content.
|
|
23
23
|
*/
|
|
24
24
|
export function encodeEnvelope(env) {
|
|
25
|
-
// Plain JSON
|
|
25
|
+
// Plain JSON - NOT canonical. Used for transport, not signing.
|
|
26
26
|
return new TextEncoder().encode(JSON.stringify(env));
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* 3. Walk the supplied recipient candidates and open the brief +
|
|
11
11
|
* enclosure for the first matching device key.
|
|
12
12
|
*
|
|
13
|
-
* `openAndVerify` does NOT run `seal.session_mac`
|
|
13
|
+
* `openAndVerify` does NOT run `seal.session_mac` - that is the
|
|
14
14
|
* routing-server / receiving-server check between adjacent SEMP
|
|
15
15
|
* peers; the recipient client uses {@link "./verify".verifySessionMAC}
|
|
16
16
|
* separately when it has access to the K_env_mac.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* 3. Walk the supplied recipient candidates and open the brief +
|
|
11
11
|
* enclosure for the first matching device key.
|
|
12
12
|
*
|
|
13
|
-
* `openAndVerify` does NOT run `seal.session_mac`
|
|
13
|
+
* `openAndVerify` does NOT run `seal.session_mac` - that is the
|
|
14
14
|
* routing-server / receiving-server check between adjacent SEMP
|
|
15
15
|
* peers; the recipient client uses {@link "./verify".verifySessionMAC}
|
|
16
16
|
* separately when it has access to the K_env_mac.
|
|
@@ -35,7 +35,7 @@ export interface PadConfig {
|
|
|
35
35
|
/**
|
|
36
36
|
* Populate `env.padding` so that `JSON.stringify(env)` lands on
|
|
37
37
|
* exactly the size of the chosen bucket. Safe to call before OR
|
|
38
|
-
* after `compose` populates `seal.signature` / `seal.session_mac`
|
|
38
|
+
* after `compose` populates `seal.signature` / `seal.session_mac` -
|
|
39
39
|
* if either is empty, fillPadding temporarily substitutes a
|
|
40
40
|
* fixed-length placeholder for measurement so the post-sign size
|
|
41
41
|
* is correct either way.
|
|
@@ -47,7 +47,7 @@ export declare function fillPadding(env: Envelope, cfg?: PadConfig): number;
|
|
|
47
47
|
/**
|
|
48
48
|
* Build a string of exactly `targetLen` base64-alphabet characters,
|
|
49
49
|
* drawn from a CSPRNG. The bulk is a base64 encoding of CSPRNG
|
|
50
|
-
* bytes; the final 1
|
|
50
|
+
* bytes; the final 1-3 characters (when targetLen is not reachable
|
|
51
51
|
* by `btoa` 4-character chunks) are CSPRNG-seeded alphabet
|
|
52
52
|
* characters appended for length alignment per §2.4.2.
|
|
53
53
|
*/
|
package/dist/envelope/padding.js
CHANGED
|
@@ -28,7 +28,7 @@ const Base64AlphabetFillers = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw
|
|
|
28
28
|
/**
|
|
29
29
|
* Populate `env.padding` so that `JSON.stringify(env)` lands on
|
|
30
30
|
* exactly the size of the chosen bucket. Safe to call before OR
|
|
31
|
-
* after `compose` populates `seal.signature` / `seal.session_mac`
|
|
31
|
+
* after `compose` populates `seal.signature` / `seal.session_mac` -
|
|
32
32
|
* if either is empty, fillPadding temporarily substitutes a
|
|
33
33
|
* fixed-length placeholder for measurement so the post-sign size
|
|
34
34
|
* is correct either way.
|
|
@@ -83,7 +83,7 @@ export function fillPadding(env, cfg = {}) {
|
|
|
83
83
|
/**
|
|
84
84
|
* Build a string of exactly `targetLen` base64-alphabet characters,
|
|
85
85
|
* drawn from a CSPRNG. The bulk is a base64 encoding of CSPRNG
|
|
86
|
-
* bytes; the final 1
|
|
86
|
+
* bytes; the final 1-3 characters (when targetLen is not reachable
|
|
87
87
|
* by `btoa` 4-character chunks) are CSPRNG-seeded alphabet
|
|
88
88
|
* characters appended for length alignment per §2.4.2.
|
|
89
89
|
*/
|
|
@@ -96,7 +96,7 @@ export function buildPaddingValue(targetLen, rand = defaultRand) {
|
|
|
96
96
|
}
|
|
97
97
|
// base64 emits 4 chars per 3 input bytes. Pick the largest
|
|
98
98
|
// multiple of 4 ≤ targetLen as the base64-encoded portion; the
|
|
99
|
-
// remainder (0
|
|
99
|
+
// remainder (0-3 chars) is filled from the alphabet pool.
|
|
100
100
|
const baseChars = targetLen - (targetLen % 4);
|
|
101
101
|
const inputBytes = (baseChars / 4) * 3;
|
|
102
102
|
const out = [];
|
|
@@ -15,7 +15,7 @@ import { type Envelope } from "./compose.js";
|
|
|
15
15
|
* true when the Ed25519 signature over the canonical envelope bytes
|
|
16
16
|
* (prefixed with `SEMP-ENVELOPE:`) verifies. Does NOT cross-check
|
|
17
17
|
* that the supplied public key actually belongs to the
|
|
18
|
-
* `postmark.from_domain`
|
|
18
|
+
* `postmark.from_domain` - that lookup is the caller's responsibility.
|
|
19
19
|
*/
|
|
20
20
|
export declare function verifySealSignature(env: Envelope, senderDomainPub: Uint8Array): boolean;
|
|
21
21
|
/**
|
package/dist/envelope/verify.js
CHANGED
|
@@ -19,7 +19,7 @@ const EnvelopePrefix = "SEMP-ENVELOPE:";
|
|
|
19
19
|
* true when the Ed25519 signature over the canonical envelope bytes
|
|
20
20
|
* (prefixed with `SEMP-ENVELOPE:`) verifies. Does NOT cross-check
|
|
21
21
|
* that the supplied public key actually belongs to the
|
|
22
|
-
* `postmark.from_domain`
|
|
22
|
+
* `postmark.from_domain` - that lookup is the caller's responsibility.
|
|
23
23
|
*/
|
|
24
24
|
export function verifySealSignature(env, senderDomainPub) {
|
|
25
25
|
if (env.seal?.signature === undefined || env.seal.signature === "") {
|
|
@@ -4,4 +4,5 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
export { type Entry, type Layer, type Map, type RegistryEntry, KeyError, MaxKeyLength, NamespacePrefixCore, Registry, SizeError, UnsupportedError, maxBytesFor, validate, validateKey, validateSize, } from "./limits.js";
|
|
7
|
+
export { type ValidationFailureCode, type ValidationFailureItem, type ValidationFailureRejection, DefinitionPathPrefix, newValidationFailureRejection, } from "./validation_failure.js";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,KAAK,EACV,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,aAAa,EAClB,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,KAAK,EACV,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,aAAa,EAClB,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,yBAAyB,CAAC"}
|
package/dist/extensions/index.js
CHANGED
|
@@ -4,4 +4,5 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
export { KeyError, MaxKeyLength, NamespacePrefixCore, Registry, SizeError, UnsupportedError, maxBytesFor, validate, validateKey, validateSize, } from "./limits.js";
|
|
7
|
+
export { DefinitionPathPrefix, newValidationFailureRejection, } from "./validation_failure.js";
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAKL,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAKL,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EAIL,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,yBAAyB,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* ```
|
|
9
9
|
*
|
|
10
10
|
* Per-layer byte-size ceilings (§4) are enforced before signature
|
|
11
|
-
* verification
|
|
11
|
+
* verification - an over-large `extensions` map MUST be rejected
|
|
12
12
|
* outright, regardless of any signature it might carry.
|
|
13
13
|
*
|
|
14
14
|
* Required extensions a recipient does not understand MUST be
|
|
@@ -90,7 +90,7 @@ export declare function validateKey(key: string): Error | null;
|
|
|
90
90
|
* ({@link SizeError})
|
|
91
91
|
*
|
|
92
92
|
* Non-required (`required: false`) extensions are passed through
|
|
93
|
-
* unconditionally
|
|
93
|
+
* unconditionally - the receiver is free to ignore them.
|
|
94
94
|
*/
|
|
95
95
|
export declare function validate(registry: Registry | null, layer: Layer, m: Map | null | undefined): Error | null;
|
|
96
96
|
/**
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* ```
|
|
9
9
|
*
|
|
10
10
|
* Per-layer byte-size ceilings (§4) are enforced before signature
|
|
11
|
-
* verification
|
|
11
|
+
* verification - an over-large `extensions` map MUST be rejected
|
|
12
12
|
* outright, regardless of any signature it might carry.
|
|
13
13
|
*
|
|
14
14
|
* Required extensions a recipient does not understand MUST be
|
|
@@ -121,7 +121,7 @@ export function validateKey(key) {
|
|
|
121
121
|
* ({@link SizeError})
|
|
122
122
|
*
|
|
123
123
|
* Non-required (`required: false`) extensions are passed through
|
|
124
|
-
* unconditionally
|
|
124
|
+
* unconditionally - the receiver is free to ignore them.
|
|
125
125
|
*/
|
|
126
126
|
export function validate(registry, layer, m) {
|
|
127
127
|
if (m === null || m === undefined || Object.keys(m).length === 0) {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical URL path prefix at which an extension's definition
|
|
3
|
+
* document is published per EXTENSIONS.md §3.5 and RFC 8615. The
|
|
4
|
+
* full URL is
|
|
5
|
+
* "https://<host>" + DefinitionPathPrefix + "<name>.json"
|
|
6
|
+
* where <name> is the namespace-prefixed identifier such as
|
|
7
|
+
* "semp.dev/foo" or "vendor.example.com/feature1".
|
|
8
|
+
*/
|
|
9
|
+
export declare const DefinitionPathPrefix = "/.well-known/semp-extensions/";
|
|
10
|
+
/**
|
|
11
|
+
* Extension validation failure reporting per EXTENSIONS.md §3.9.3.
|
|
12
|
+
*
|
|
13
|
+
* Runtime validation failures across one or more extensions in an
|
|
14
|
+
* envelope are reported with the `extension_unsupported` reason
|
|
15
|
+
* code and an `errors` array carrying per-extension diagnostics.
|
|
16
|
+
* Implementations MAY stop at the first failure and report a
|
|
17
|
+
* single-entry array or continue and report all failures.
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
/** Defined validation_failure diagnostics per §3.9.3 table. */
|
|
22
|
+
export type ValidationFailureCode = "definition_unfetchable" | "definition_signature_invalid" | "data_schema_mismatch" | "placement_violation" | "authority_violation" | "dependency_unsatisfied" | "conflict_present";
|
|
23
|
+
/** Single entry in the §3.9.3 `errors` array. */
|
|
24
|
+
export interface ValidationFailureItem {
|
|
25
|
+
extension: string;
|
|
26
|
+
validation_failure: ValidationFailureCode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Envelope-rejection wire shape carrying one or more extension
|
|
30
|
+
* validation failures. The reason_code is always
|
|
31
|
+
* `extension_unsupported`; per-rule diagnostics live in
|
|
32
|
+
* `errors[i].validation_failure`.
|
|
33
|
+
*/
|
|
34
|
+
export interface ValidationFailureRejection {
|
|
35
|
+
type: "SEMP_ENVELOPE";
|
|
36
|
+
step: "rejected";
|
|
37
|
+
version: string;
|
|
38
|
+
reason_code: "extension_unsupported";
|
|
39
|
+
reason: string;
|
|
40
|
+
errors: ValidationFailureItem[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Wrap one or more validation failures in the §3.9.3 envelope
|
|
44
|
+
* rejection. The reason defaults to "Extension validation failed"
|
|
45
|
+
* when omitted.
|
|
46
|
+
*/
|
|
47
|
+
export declare function newValidationFailureRejection(items: ValidationFailureItem[], reason?: string): ValidationFailureRejection;
|
|
48
|
+
//# sourceMappingURL=validation_failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation_failure.d.ts","sourceRoot":"","sources":["../../src/extensions/validation_failure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,kCAAkC,CAAC;AAEpE;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,MAAM,qBAAqB,GAC7B,wBAAwB,GACxB,8BAA8B,GAC9B,sBAAsB,GACtB,qBAAqB,GACrB,qBAAqB,GACrB,wBAAwB,GACxB,kBAAkB,CAAC;AAEvB,iDAAiD;AACjD,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,qBAAqB,CAAC;CAC3C;AAED;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,uBAAuB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,qBAAqB,EAAE,EAC9B,MAAM,SAAgC,GACrC,0BAA0B,CAS5B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical URL path prefix at which an extension's definition
|
|
3
|
+
* document is published per EXTENSIONS.md §3.5 and RFC 8615. The
|
|
4
|
+
* full URL is
|
|
5
|
+
* "https://<host>" + DefinitionPathPrefix + "<name>.json"
|
|
6
|
+
* where <name> is the namespace-prefixed identifier such as
|
|
7
|
+
* "semp.dev/foo" or "vendor.example.com/feature1".
|
|
8
|
+
*/
|
|
9
|
+
export const DefinitionPathPrefix = "/.well-known/semp-extensions/";
|
|
10
|
+
/**
|
|
11
|
+
* Wrap one or more validation failures in the §3.9.3 envelope
|
|
12
|
+
* rejection. The reason defaults to "Extension validation failed"
|
|
13
|
+
* when omitted.
|
|
14
|
+
*/
|
|
15
|
+
export function newValidationFailureRejection(items, reason = "Extension validation failed") {
|
|
16
|
+
return {
|
|
17
|
+
type: "SEMP_ENVELOPE",
|
|
18
|
+
step: "rejected",
|
|
19
|
+
version: "1.0.0",
|
|
20
|
+
reason_code: "extension_unsupported",
|
|
21
|
+
reason,
|
|
22
|
+
errors: items,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=validation_failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation_failure.js","sourceRoot":"","sources":["../../src/extensions/validation_failure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AA6CpE;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAC3C,KAA8B,EAC9B,MAAM,GAAG,6BAA6B;IAEtC,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,uBAAuB;QACpC,MAAM;QACN,MAAM,EAAE,KAAK;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -30,7 +30,7 @@ export declare function isChallengeInvalid(err: unknown): err is ChallengeInvali
|
|
|
30
30
|
/**
|
|
31
31
|
* Build an unsigned client-initiator abort message per §2.2a.6.
|
|
32
32
|
*
|
|
33
|
-
* The wire shape is `party: "client"` with no `server_signature`
|
|
33
|
+
* The wire shape is `party: "client"` with no `server_signature` -
|
|
34
34
|
* the initiator has not authenticated to the server at this point
|
|
35
35
|
* and MUST NOT do so as part of an abort.
|
|
36
36
|
*
|
package/dist/handshake/abort.js
CHANGED
|
@@ -38,7 +38,7 @@ export function isChallengeInvalid(err) {
|
|
|
38
38
|
/**
|
|
39
39
|
* Build an unsigned client-initiator abort message per §2.2a.6.
|
|
40
40
|
*
|
|
41
|
-
* The wire shape is `party: "client"` with no `server_signature`
|
|
41
|
+
* The wire shape is `party: "client"` with no `server_signature` -
|
|
42
42
|
* the initiator has not authenticated to the server at this point
|
|
43
43
|
* and MUST NOT do so as part of an abort.
|
|
44
44
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Mirror of `semp-go/handshake.Client`: a state machine the caller
|
|
5
5
|
* drives over a transport. The class never performs network I/O
|
|
6
|
-
* directly
|
|
6
|
+
* directly - the caller moves bytes between this object and the
|
|
7
7
|
* underlying transport.
|
|
8
8
|
*
|
|
9
9
|
* Lifecycle:
|
|
@@ -90,7 +90,7 @@ export interface HandshakeClientSession {
|
|
|
90
90
|
export { HandshakeRejectedError };
|
|
91
91
|
/**
|
|
92
92
|
* Stateful handshake client. One instance handles exactly one
|
|
93
|
-
* handshake
|
|
93
|
+
* handshake - discard after success or error. Re-using an instance
|
|
94
94
|
* is a programming error (the state machine is single-shot).
|
|
95
95
|
*/
|
|
96
96
|
export declare class HandshakeClient {
|
|
@@ -109,7 +109,7 @@ export declare class HandshakeClient {
|
|
|
109
109
|
private serverIdProofSignature;
|
|
110
110
|
private resumptionSecret;
|
|
111
111
|
private resumeNonce;
|
|
112
|
-
/** Final session
|
|
112
|
+
/** Final session - populated by {@link onAccepted}. */
|
|
113
113
|
private finalSession;
|
|
114
114
|
constructor(cfg: HandshakeClientConfig);
|
|
115
115
|
/**
|
|
@@ -124,12 +124,12 @@ export declare class HandshakeClient {
|
|
|
124
124
|
*
|
|
125
125
|
* Throws {@link ChallengeInvalidError} when the difficulty
|
|
126
126
|
* exceeds the protocol cap or the challenge has already
|
|
127
|
-
* expired
|
|
127
|
+
* expired - the caller follows up with a §2.2a.6 client abort.
|
|
128
128
|
*/
|
|
129
129
|
onChallenge(data: Uint8Array): Promise<Uint8Array>;
|
|
130
130
|
/**
|
|
131
131
|
* Process the server's RESPONSE, derive session keys, and produce
|
|
132
|
-
* CONFIRM bytes per §2.3
|
|
132
|
+
* CONFIRM bytes per §2.3 - §2.5. The ephemeral private key is
|
|
133
133
|
* zeroed before return.
|
|
134
134
|
*/
|
|
135
135
|
onResponse(data: Uint8Array): Uint8Array;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Mirror of `semp-go/handshake.Client`: a state machine the caller
|
|
5
5
|
* drives over a transport. The class never performs network I/O
|
|
6
|
-
* directly
|
|
6
|
+
* directly - the caller moves bytes between this object and the
|
|
7
7
|
* underlying transport.
|
|
8
8
|
*
|
|
9
9
|
* Lifecycle:
|
|
@@ -55,7 +55,7 @@ const POW_HARDCAP = MaxPoWDifficulty;
|
|
|
55
55
|
export { HandshakeRejectedError };
|
|
56
56
|
/**
|
|
57
57
|
* Stateful handshake client. One instance handles exactly one
|
|
58
|
-
* handshake
|
|
58
|
+
* handshake - discard after success or error. Re-using an instance
|
|
59
59
|
* is a programming error (the state machine is single-shot).
|
|
60
60
|
*/
|
|
61
61
|
export class HandshakeClient {
|
|
@@ -78,7 +78,7 @@ export class HandshakeClient {
|
|
|
78
78
|
// Resume state (HANDSHAKE.md §2.8).
|
|
79
79
|
resumptionSecret = null;
|
|
80
80
|
resumeNonce = null;
|
|
81
|
-
/** Final session
|
|
81
|
+
/** Final session - populated by {@link onAccepted}. */
|
|
82
82
|
finalSession = null;
|
|
83
83
|
constructor(cfg) {
|
|
84
84
|
if (cfg.suite !== "x25519-chacha20-poly1305" &&
|
|
@@ -151,7 +151,7 @@ export class HandshakeClient {
|
|
|
151
151
|
*
|
|
152
152
|
* Throws {@link ChallengeInvalidError} when the difficulty
|
|
153
153
|
* exceeds the protocol cap or the challenge has already
|
|
154
|
-
* expired
|
|
154
|
+
* expired - the caller follows up with a §2.2a.6 client abort.
|
|
155
155
|
*/
|
|
156
156
|
async onChallenge(data) {
|
|
157
157
|
if (this.initCanonical === null) {
|
|
@@ -206,7 +206,7 @@ export class HandshakeClient {
|
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* Process the server's RESPONSE, derive session keys, and produce
|
|
209
|
-
* CONFIRM bytes per §2.3
|
|
209
|
+
* CONFIRM bytes per §2.3 - §2.5. The ephemeral private key is
|
|
210
210
|
* zeroed before return.
|
|
211
211
|
*/
|
|
212
212
|
onResponse(data) {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
/**
|
|
12
12
|
* Compute SHA-256 over the concatenation of canonical(message_1)
|
|
13
13
|
* and canonical(message_2). The caller MUST pass the canonical
|
|
14
|
-
* bytes
|
|
15
|
-
* ENVELOPE.md §4.3
|
|
14
|
+
* bytes - sorted keys, no insignificant whitespace, as defined in
|
|
15
|
+
* ENVELOPE.md §4.3 - not the wire-format bytes.
|
|
16
16
|
*
|
|
17
17
|
* The output is the 32-byte digest the client signs as part of its
|
|
18
18
|
* identity proof.
|
|
@@ -12,8 +12,8 @@ import { sha256 } from "@noble/hashes/sha2.js";
|
|
|
12
12
|
/**
|
|
13
13
|
* Compute SHA-256 over the concatenation of canonical(message_1)
|
|
14
14
|
* and canonical(message_2). The caller MUST pass the canonical
|
|
15
|
-
* bytes
|
|
16
|
-
* ENVELOPE.md §4.3
|
|
15
|
+
* bytes - sorted keys, no insignificant whitespace, as defined in
|
|
16
|
+
* ENVELOPE.md §4.3 - not the wire-format bytes.
|
|
17
17
|
*
|
|
18
18
|
* The output is the 32-byte digest the client signs as part of its
|
|
19
19
|
* identity proof.
|
|
@@ -76,7 +76,7 @@ export interface ClientConfig {
|
|
|
76
76
|
* AEAD-Seal under K_enc_c2s with AAD = session_id.
|
|
77
77
|
*
|
|
78
78
|
* When omitted (the default), the driver leaves identity_proof
|
|
79
|
-
* empty
|
|
79
|
+
* empty - the higher-level client wraps runClient with its
|
|
80
80
|
* own auth supply.
|
|
81
81
|
*/
|
|
82
82
|
identity?: {
|
|
@@ -131,7 +131,7 @@ export declare class HandshakeRejectedError extends Error {
|
|
|
131
131
|
*
|
|
132
132
|
* On error the transport is closed so the peer's pending `receive`
|
|
133
133
|
* unblocks. Successful completion leaves the transport owned by
|
|
134
|
-
* the returned Session
|
|
134
|
+
* the returned Session - closing the Session closes the transport.
|
|
135
135
|
*/
|
|
136
136
|
export declare function runClient(transport: Transport, config: ClientConfig): Promise<Session>;
|
|
137
137
|
//# sourceMappingURL=driver.d.ts.map
|
package/dist/handshake/driver.js
CHANGED
|
@@ -59,7 +59,7 @@ export class HandshakeRejectedError extends Error {
|
|
|
59
59
|
*
|
|
60
60
|
* On error the transport is closed so the peer's pending `receive`
|
|
61
61
|
* unblocks. Successful completion leaves the transport owned by
|
|
62
|
-
* the returned Session
|
|
62
|
+
* the returned Session - closing the Session closes the transport.
|
|
63
63
|
*/
|
|
64
64
|
export async function runClient(transport, config) {
|
|
65
65
|
if (config.suite !== "x25519-chacha20-poly1305" &&
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Federation handshake (server ↔ server) per HANDSHAKE.md §5.
|
|
3
3
|
*
|
|
4
4
|
* Two servers establish a federation session by exchanging four
|
|
5
|
-
* messages
|
|
5
|
+
* messages - symmetric in shape to the client handshake but with
|
|
6
6
|
* domain identity in plaintext on both sides plus a domain-proof
|
|
7
7
|
* verification step:
|
|
8
8
|
*
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { type SessionKeys } from "../crypto/index.js";
|
|
25
25
|
import { type Capabilities, type Negotiated, type ResumptionTicket } from "./messages.js";
|
|
26
|
+
/**
|
|
27
|
+
* Algorithm suites the federation handshake supports. Mirrors the
|
|
28
|
+
* client handshake's {@link "./driver".HandshakeSuite}.
|
|
29
|
+
*/
|
|
30
|
+
export type FederationSuite = "x25519-chacha20-poly1305" | "pq-kyber768-x25519";
|
|
26
31
|
/** Wire-level discriminators (shared with the client handshake). */
|
|
27
32
|
export declare const FederationMessageType = "SEMP_HANDSHAKE";
|
|
28
33
|
/**
|
|
@@ -181,7 +186,7 @@ export interface FederationResume {
|
|
|
181
186
|
/**
|
|
182
187
|
* Domain-ownership verifier invoked by the responder during the
|
|
183
188
|
* handshake. `verify` resolves on success; rejects (or throws) on
|
|
184
|
-
* failure
|
|
189
|
+
* failure - the rejection reason is surfaced in
|
|
185
190
|
* {@link DomainVerificationResult.detail}.
|
|
186
191
|
*/
|
|
187
192
|
export interface DomainVerifier {
|
|
@@ -189,7 +194,7 @@ export interface DomainVerifier {
|
|
|
189
194
|
}
|
|
190
195
|
/**
|
|
191
196
|
* Permissive verifier that accepts every proof. Tests / single-
|
|
192
|
-
* process deployments only
|
|
197
|
+
* process deployments only - production MUST NOT use it.
|
|
193
198
|
*/
|
|
194
199
|
export declare class TrustingDomainVerifier implements DomainVerifier {
|
|
195
200
|
verify(): Promise<void>;
|
|
@@ -197,7 +202,7 @@ export declare class TrustingDomainVerifier implements DomainVerifier {
|
|
|
197
202
|
/**
|
|
198
203
|
* Decide which of two simultaneously-initiated federation handshakes
|
|
199
204
|
* proceeds per SESSION.md §2.5.2. Both peers agree on the winner
|
|
200
|
-
* without external coordination
|
|
205
|
+
* without external coordination - lexicographic compare provides
|
|
201
206
|
* exactly this property.
|
|
202
207
|
*
|
|
203
208
|
* Returns the winning `session_id` (the one that proceeds).
|
|
@@ -209,8 +214,15 @@ export type PolicyAcceptor = (policy: FederationPolicy) => string | null;
|
|
|
209
214
|
export declare const acceptAllPolicies: PolicyAcceptor;
|
|
210
215
|
/** Configuration for {@link FederationInitiator}. */
|
|
211
216
|
export interface FederationInitiatorConfig {
|
|
212
|
-
/**
|
|
213
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Algorithm suite. Either `"x25519-chacha20-poly1305"` (baseline)
|
|
219
|
+
* or `"pq-kyber768-x25519"` (hybrid post-quantum); the latter
|
|
220
|
+
* generates a 1216-byte hybrid ephemeral pub and decapsulates the
|
|
221
|
+
* responder's 1120-byte hybrid KEM ciphertext per ENVELOPE.md
|
|
222
|
+
* §4.4.1. The negotiated suite recorded on the wire is taken from
|
|
223
|
+
* this field; for multi-suite operators, run multiple initiators.
|
|
224
|
+
*/
|
|
225
|
+
suite: FederationSuite;
|
|
214
226
|
/** Capability set to advertise. */
|
|
215
227
|
capabilities: Capabilities;
|
|
216
228
|
/** Initiator's own domain. */
|
|
@@ -246,7 +258,7 @@ export interface FederationInitiatorSession {
|
|
|
246
258
|
}
|
|
247
259
|
/**
|
|
248
260
|
* Stateful federation initiator. Mirror of `semp-go/handshake.Initiator`.
|
|
249
|
-
* Single-shot
|
|
261
|
+
* Single-shot - discard after success or error.
|
|
250
262
|
*/
|
|
251
263
|
export declare class FederationInitiator {
|
|
252
264
|
private readonly cfg;
|
|
@@ -293,7 +305,13 @@ export declare class FederationInitiator {
|
|
|
293
305
|
}
|
|
294
306
|
/** Configuration for {@link FederationResponder}. */
|
|
295
307
|
export interface FederationResponderConfig {
|
|
296
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Algorithm suite. Either `"x25519-chacha20-poly1305"` (baseline)
|
|
310
|
+
* or `"pq-kyber768-x25519"` (hybrid post-quantum). The responder
|
|
311
|
+
* accepts only this suite during negotiation; multi-suite support
|
|
312
|
+
* requires running multiple responders.
|
|
313
|
+
*/
|
|
314
|
+
suite: FederationSuite;
|
|
297
315
|
capabilities: Capabilities;
|
|
298
316
|
/** Responder's own domain. */
|
|
299
317
|
localDomain: string;
|
|
@@ -325,7 +343,7 @@ export interface FederationResponderSession {
|
|
|
325
343
|
}
|
|
326
344
|
/**
|
|
327
345
|
* Stateful federation responder. Mirror of `semp-go/handshake.Responder`.
|
|
328
|
-
* Single-shot
|
|
346
|
+
* Single-shot - discard after success or error.
|
|
329
347
|
*/
|
|
330
348
|
export declare class FederationResponder {
|
|
331
349
|
private readonly cfg;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"federation.d.ts","sourceRoot":"","sources":["../../src/handshake/federation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EACL,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"federation.d.ts","sourceRoot":"","sources":["../../src/handshake/federation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EACL,KAAK,WAAW,EASjB,MAAM,oBAAoB,CAAC;AAW5B,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,gBAAgB,EAGtB,MAAM,eAAe,CAAC;AAEvB;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,0BAA0B,GAC1B,oBAAoB,CAAC;AAEzB,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,aAAa,GACb,YAAY;AACd,wEAAwE;GACtE,YAAY,CAAC;AAEjB,uCAAuC;AACvC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yDAAyD;AACzD,MAAM,WAAW,wBAAwB;IACvC,yEAAyE;IACzE,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;IAC/C,yDAAyD;IACzD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,mDAAmD;AACnD,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iCAAiC;IACjC,cAAc,EAAE,SAAS,GAAG,QAAQ,CA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