@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/envelope/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAOL,oBAAoB,EACpB,OAAO,EACP,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,EAIL,YAAY,EACZ,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAKL,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,6BAA6B,EAC7B,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/envelope/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAOL,oBAAoB,EACpB,OAAO,EACP,qBAAqB,EACrB,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,EAIL,YAAY,EACZ,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAKL,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,6BAA6B,EAC7B,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open_any.d.ts","sourceRoot":"","sources":["../../src/envelope/open_any.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"open_any.d.ts","sourceRoot":"","sources":["../../src/envelope/open_any.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,SAAS,EAGf,MAAM,cAAc,CAAC;AAEtB,4DAA4D;AAC5D,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,UAAU,EAAE,UAAU,CAAC;IACvB,uDAAuD;IACvD,SAAS,EAAE,UAAU,CAAC;CACvB;AAED,yDAAyD;AACzD,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,SAAS,EAAE,kBAAkB,CAAC;IAC9B,4DAA4D;IAC5D,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,6DAA6D;AAC7D,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,SAAS,EAAE,kBAAkB,CAAC;IAC9B,gEAAgE;IAChE,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,EACzB,GAAG,EAAE,QAAQ,EACb,UAAU,EAAE,kBAAkB,EAAE,GAC/B,WAAW,CAiCb;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,EACzB,GAAG,EAAE,QAAQ,EACb,UAAU,EAAE,kBAAkB,EAAE,GAC/B,eAAe,CAiCjB"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { openBriefForRecipient, openEnclosureForRecipient, } from "./compose.js";
|
|
12
12
|
/**
|
|
13
13
|
* Walk `candidates` and try each recipient identity against
|
|
14
14
|
* `env.seal.brief_recipients`. Returns the brief plaintext from the
|
|
@@ -25,14 +25,14 @@ export function openBriefAny(suite, env, candidates) {
|
|
|
25
25
|
continue; // not a brief recipient
|
|
26
26
|
}
|
|
27
27
|
try {
|
|
28
|
-
const
|
|
28
|
+
const brief = openBriefForRecipient({
|
|
29
29
|
suite,
|
|
30
30
|
envelope: env,
|
|
31
31
|
recipientKeyId: c.keyId,
|
|
32
32
|
recipientPrivateKey: c.privateKey,
|
|
33
33
|
recipientPublicKey: c.publicKey,
|
|
34
34
|
});
|
|
35
|
-
return { candidate: c, brief
|
|
35
|
+
return { candidate: c, brief };
|
|
36
36
|
}
|
|
37
37
|
catch (err) {
|
|
38
38
|
errors.push(`${c.keyId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -59,14 +59,14 @@ export function openEnclosureAny(suite, env, candidates) {
|
|
|
59
59
|
continue; // not an enclosure recipient
|
|
60
60
|
}
|
|
61
61
|
try {
|
|
62
|
-
const
|
|
62
|
+
const enclosure = openEnclosureForRecipient({
|
|
63
63
|
suite,
|
|
64
64
|
envelope: env,
|
|
65
65
|
recipientKeyId: c.keyId,
|
|
66
66
|
recipientPrivateKey: c.privateKey,
|
|
67
67
|
recipientPublicKey: c.publicKey,
|
|
68
68
|
});
|
|
69
|
-
return { candidate: c, enclosure
|
|
69
|
+
return { candidate: c, enclosure };
|
|
70
70
|
}
|
|
71
71
|
catch (err) {
|
|
72
72
|
errors.push(`${c.keyId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open_any.js","sourceRoot":"","sources":["../../src/envelope/open_any.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAGL,
|
|
1
|
+
{"version":3,"file":"open_any.js","sourceRoot":"","sources":["../../src/envelope/open_any.ts"],"names":[],"mappings":"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"}
|
|
@@ -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
|
*
|
|
@@ -181,7 +181,7 @@ export interface FederationResume {
|
|
|
181
181
|
/**
|
|
182
182
|
* Domain-ownership verifier invoked by the responder during the
|
|
183
183
|
* handshake. `verify` resolves on success; rejects (or throws) on
|
|
184
|
-
* failure
|
|
184
|
+
* failure - the rejection reason is surfaced in
|
|
185
185
|
* {@link DomainVerificationResult.detail}.
|
|
186
186
|
*/
|
|
187
187
|
export interface DomainVerifier {
|
|
@@ -189,7 +189,7 @@ export interface DomainVerifier {
|
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
191
|
* Permissive verifier that accepts every proof. Tests / single-
|
|
192
|
-
* process deployments only
|
|
192
|
+
* process deployments only - production MUST NOT use it.
|
|
193
193
|
*/
|
|
194
194
|
export declare class TrustingDomainVerifier implements DomainVerifier {
|
|
195
195
|
verify(): Promise<void>;
|
|
@@ -197,7 +197,7 @@ export declare class TrustingDomainVerifier implements DomainVerifier {
|
|
|
197
197
|
/**
|
|
198
198
|
* Decide which of two simultaneously-initiated federation handshakes
|
|
199
199
|
* proceeds per SESSION.md §2.5.2. Both peers agree on the winner
|
|
200
|
-
* without external coordination
|
|
200
|
+
* without external coordination - lexicographic compare provides
|
|
201
201
|
* exactly this property.
|
|
202
202
|
*
|
|
203
203
|
* Returns the winning `session_id` (the one that proceeds).
|
|
@@ -246,7 +246,7 @@ export interface FederationInitiatorSession {
|
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
248
|
* Stateful federation initiator. Mirror of `semp-go/handshake.Initiator`.
|
|
249
|
-
* Single-shot
|
|
249
|
+
* Single-shot - discard after success or error.
|
|
250
250
|
*/
|
|
251
251
|
export declare class FederationInitiator {
|
|
252
252
|
private readonly cfg;
|
|
@@ -325,7 +325,7 @@ export interface FederationResponderSession {
|
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
327
327
|
* Stateful federation responder. Mirror of `semp-go/handshake.Responder`.
|
|
328
|
-
* Single-shot
|
|
328
|
+
* Single-shot - discard after success or error.
|
|
329
329
|
*/
|
|
330
330
|
export declare class FederationResponder {
|
|
331
331
|
private readonly cfg;
|
|
@@ -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
|
*
|
|
@@ -32,7 +32,7 @@ import { HandshakePrefix, HandshakeVersion, } from "./messages.js";
|
|
|
32
32
|
export const FederationMessageType = "SEMP_HANDSHAKE";
|
|
33
33
|
/**
|
|
34
34
|
* Permissive verifier that accepts every proof. Tests / single-
|
|
35
|
-
* process deployments only
|
|
35
|
+
* process deployments only - production MUST NOT use it.
|
|
36
36
|
*/
|
|
37
37
|
export class TrustingDomainVerifier {
|
|
38
38
|
async verify() {
|
|
@@ -42,7 +42,7 @@ export class TrustingDomainVerifier {
|
|
|
42
42
|
/**
|
|
43
43
|
* Decide which of two simultaneously-initiated federation handshakes
|
|
44
44
|
* proceeds per SESSION.md §2.5.2. Both peers agree on the winner
|
|
45
|
-
* without external coordination
|
|
45
|
+
* without external coordination - lexicographic compare provides
|
|
46
46
|
* exactly this property.
|
|
47
47
|
*
|
|
48
48
|
* Returns the winning `session_id` (the one that proceeds).
|
|
@@ -54,7 +54,7 @@ export function resolveCollision(idA, idB) {
|
|
|
54
54
|
export const acceptAllPolicies = () => null;
|
|
55
55
|
/**
|
|
56
56
|
* Stateful federation initiator. Mirror of `semp-go/handshake.Initiator`.
|
|
57
|
-
* Single-shot
|
|
57
|
+
* Single-shot - discard after success or error.
|
|
58
58
|
*/
|
|
59
59
|
export class FederationInitiator {
|
|
60
60
|
cfg;
|
|
@@ -374,7 +374,7 @@ export class FederationInitiator {
|
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
* Stateful federation responder. Mirror of `semp-go/handshake.Responder`.
|
|
377
|
-
* Single-shot
|
|
377
|
+
* Single-shot - discard after success or error.
|
|
378
378
|
*/
|
|
379
379
|
export class FederationResponder {
|
|
380
380
|
cfg;
|
|
@@ -48,7 +48,7 @@ export declare function computeFirstContactPrefix(senderDomain: string, recipien
|
|
|
48
48
|
* trailing 32 bytes of the prefix are SHA-256 of the canonical
|
|
49
49
|
* binding input.
|
|
50
50
|
*
|
|
51
|
-
* Does NOT verify the PoW solution itself
|
|
51
|
+
* Does NOT verify the PoW solution itself - pair with
|
|
52
52
|
* `verifyChallengeSolution` from {@link "./pow"} for a full check.
|
|
53
53
|
*/
|
|
54
54
|
export declare function verifyFirstContactBinding(prefix: Uint8Array, senderDomain: string, recipientAddress: string, postmarkId: string): boolean;
|
|
@@ -62,7 +62,7 @@ export function computeFirstContactPrefix(senderDomain, recipientAddress, postma
|
|
|
62
62
|
* trailing 32 bytes of the prefix are SHA-256 of the canonical
|
|
63
63
|
* binding input.
|
|
64
64
|
*
|
|
65
|
-
* Does NOT verify the PoW solution itself
|
|
65
|
+
* Does NOT verify the PoW solution itself - pair with
|
|
66
66
|
* `verifyChallengeSolution` from {@link "./pow"} for a full check.
|
|
67
67
|
*/
|
|
68
68
|
export function verifyFirstContactBinding(prefix, senderDomain, recipientAddress, postmarkId) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Identity-proof composition per HANDSHAKE.md §2.5.
|
|
3
3
|
*
|
|
4
4
|
* The client's CONFIRM message carries an encrypted identity-proof
|
|
5
|
-
* block
|
|
5
|
+
* block - a self-contained JSON object proving control of the
|
|
6
6
|
* client's long-term identity key, encrypted under the freshly
|
|
7
7
|
* derived `K_enc_c2s` so a passive observer sees only opaque
|
|
8
8
|
* ciphertext.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Identity-proof composition per HANDSHAKE.md §2.5.
|
|
3
3
|
*
|
|
4
4
|
* The client's CONFIRM message carries an encrypted identity-proof
|
|
5
|
-
* block
|
|
5
|
+
* block - a self-contained JSON object proving control of the
|
|
6
6
|
* client's long-term identity key, encrypted under the freshly
|
|
7
7
|
* derived `K_enc_c2s` so a passive observer sees only opaque
|
|
8
8
|
* ciphertext.
|
package/dist/handshake/pow.js
CHANGED
|
@@ -45,7 +45,7 @@ export function verifyChallengeSolution(prefix, challengeId, nonceB64, claimedHa
|
|
|
45
45
|
if (nonceB64 === "") {
|
|
46
46
|
return new Error("handshake: empty PoW nonce");
|
|
47
47
|
}
|
|
48
|
-
// Nonce must be valid base64
|
|
48
|
+
// Nonce must be valid base64 - but we accept its bytes as-is in
|
|
49
49
|
// the preimage (the spec hashes the base64 string, not the
|
|
50
50
|
// decoded bytes).
|
|
51
51
|
try {
|