@sempdev/semp 0.4.3
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/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/brief/address.d.ts +77 -0
- package/dist/brief/address.d.ts.map +1 -0
- package/dist/brief/address.js +217 -0
- package/dist/brief/address.js.map +1 -0
- package/dist/brief/brief.d.ts +75 -0
- package/dist/brief/brief.d.ts.map +1 -0
- package/dist/brief/brief.js +56 -0
- package/dist/brief/brief.js.map +1 -0
- package/dist/brief/index.d.ts +11 -0
- package/dist/brief/index.d.ts.map +1 -0
- package/dist/brief/index.js +11 -0
- package/dist/brief/index.js.map +1 -0
- package/dist/canonical/index.d.ts +8 -0
- package/dist/canonical/index.d.ts.map +1 -0
- package/dist/canonical/index.js +8 -0
- package/dist/canonical/index.js.map +1 -0
- package/dist/canonical/marshal.d.ts +35 -0
- package/dist/canonical/marshal.d.ts.map +1 -0
- package/dist/canonical/marshal.js +107 -0
- package/dist/canonical/marshal.js.map +1 -0
- package/dist/clockskew/index.d.ts +52 -0
- package/dist/clockskew/index.d.ts.map +1 -0
- package/dist/clockskew/index.js +62 -0
- package/dist/clockskew/index.js.map +1 -0
- package/dist/closure/closure.d.ts +106 -0
- package/dist/closure/closure.d.ts.map +1 -0
- package/dist/closure/closure.js +152 -0
- package/dist/closure/closure.js.map +1 -0
- package/dist/closure/driver.d.ts +103 -0
- package/dist/closure/driver.d.ts.map +1 -0
- package/dist/closure/driver.js +126 -0
- package/dist/closure/driver.js.map +1 -0
- package/dist/closure/index.d.ts +13 -0
- package/dist/closure/index.d.ts.map +1 -0
- package/dist/closure/index.js +13 -0
- package/dist/closure/index.js.map +1 -0
- package/dist/closure/store.d.ts +80 -0
- package/dist/closure/store.d.ts.map +1 -0
- package/dist/closure/store.js +89 -0
- package/dist/closure/store.js.map +1 -0
- package/dist/crypto/aead.d.ts +29 -0
- package/dist/crypto/aead.d.ts.map +1 -0
- package/dist/crypto/aead.js +48 -0
- package/dist/crypto/aead.js.map +1 -0
- package/dist/crypto/argon2.d.ts +20 -0
- package/dist/crypto/argon2.d.ts.map +1 -0
- package/dist/crypto/argon2.js +28 -0
- package/dist/crypto/argon2.js.map +1 -0
- package/dist/crypto/index.d.ts +14 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +14 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/kdf.d.ts +96 -0
- package/dist/crypto/kdf.d.ts.map +1 -0
- package/dist/crypto/kdf.js +122 -0
- package/dist/crypto/kdf.js.map +1 -0
- package/dist/crypto/kem.d.ts +85 -0
- package/dist/crypto/kem.d.ts.map +1 -0
- package/dist/crypto/kem.js +130 -0
- package/dist/crypto/kem.js.map +1 -0
- package/dist/crypto/mac.d.ts +19 -0
- package/dist/crypto/mac.d.ts.map +1 -0
- package/dist/crypto/mac.js +32 -0
- package/dist/crypto/mac.js.map +1 -0
- package/dist/delivery/ack.d.ts +125 -0
- package/dist/delivery/ack.d.ts.map +1 -0
- package/dist/delivery/ack.js +141 -0
- package/dist/delivery/ack.js.map +1 -0
- package/dist/delivery/blocklist.d.ts +87 -0
- package/dist/delivery/blocklist.d.ts.map +1 -0
- package/dist/delivery/blocklist.js +107 -0
- package/dist/delivery/blocklist.js.map +1 -0
- package/dist/delivery/cancel.d.ts +60 -0
- package/dist/delivery/cancel.d.ts.map +1 -0
- package/dist/delivery/cancel.js +43 -0
- package/dist/delivery/cancel.js.map +1 -0
- package/dist/delivery/disposition.d.ts +106 -0
- package/dist/delivery/disposition.d.ts.map +1 -0
- package/dist/delivery/disposition.js +105 -0
- package/dist/delivery/disposition.js.map +1 -0
- package/dist/delivery/fetch.d.ts +59 -0
- package/dist/delivery/fetch.d.ts.map +1 -0
- package/dist/delivery/fetch.js +47 -0
- package/dist/delivery/fetch.js.map +1 -0
- package/dist/delivery/forwarder.d.ts +106 -0
- package/dist/delivery/forwarder.d.ts.map +1 -0
- package/dist/delivery/forwarder.js +251 -0
- package/dist/delivery/forwarder.js.map +1 -0
- package/dist/delivery/inbox.d.ts +42 -0
- package/dist/delivery/inbox.d.ts.map +1 -0
- package/dist/delivery/inbox.js +68 -0
- package/dist/delivery/inbox.js.map +1 -0
- package/dist/delivery/index.d.ts +31 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +31 -0
- package/dist/delivery/index.js.map +1 -0
- package/dist/delivery/internalroute.d.ts +50 -0
- package/dist/delivery/internalroute.d.ts.map +1 -0
- package/dist/delivery/internalroute.js +23 -0
- package/dist/delivery/internalroute.js.map +1 -0
- package/dist/delivery/pipeline.d.ts +153 -0
- package/dist/delivery/pipeline.d.ts.map +1 -0
- package/dist/delivery/pipeline.js +356 -0
- package/dist/delivery/pipeline.js.map +1 -0
- package/dist/delivery/policy_state.d.ts +105 -0
- package/dist/delivery/policy_state.d.ts.map +1 -0
- package/dist/delivery/policy_state.js +293 -0
- package/dist/delivery/policy_state.js.map +1 -0
- package/dist/delivery/queue.d.ts +47 -0
- package/dist/delivery/queue.d.ts.map +1 -0
- package/dist/delivery/queue.js +33 -0
- package/dist/delivery/queue.js.map +1 -0
- package/dist/delivery/receipt.d.ts +137 -0
- package/dist/delivery/receipt.d.ts.map +1 -0
- package/dist/delivery/receipt.js +181 -0
- package/dist/delivery/receipt.js.map +1 -0
- package/dist/delivery/receipt_store.d.ts +81 -0
- package/dist/delivery/receipt_store.d.ts.map +1 -0
- package/dist/delivery/receipt_store.js +74 -0
- package/dist/delivery/receipt_store.js.map +1 -0
- package/dist/delivery/retry.d.ts +78 -0
- package/dist/delivery/retry.d.ts.map +1 -0
- package/dist/delivery/retry.js +132 -0
- package/dist/delivery/retry.js.map +1 -0
- package/dist/delivery/scheduler.d.ts +156 -0
- package/dist/delivery/scheduler.d.ts.map +1 -0
- package/dist/delivery/scheduler.js +349 -0
- package/dist/delivery/scheduler.js.map +1 -0
- package/dist/delivery/stage_partition.d.ts +87 -0
- package/dist/delivery/stage_partition.d.ts.map +1 -0
- package/dist/delivery/stage_partition.js +122 -0
- package/dist/delivery/stage_partition.js.map +1 -0
- package/dist/delivery/staged_runner.d.ts +100 -0
- package/dist/delivery/staged_runner.d.ts.map +1 -0
- package/dist/delivery/staged_runner.js +277 -0
- package/dist/delivery/staged_runner.js.map +1 -0
- package/dist/delivery/submission.d.ts +72 -0
- package/dist/delivery/submission.d.ts.map +1 -0
- package/dist/delivery/submission.js +58 -0
- package/dist/delivery/submission.js.map +1 -0
- package/dist/delivery/sync.d.ts +68 -0
- package/dist/delivery/sync.d.ts.map +1 -0
- package/dist/delivery/sync.js +99 -0
- package/dist/delivery/sync.js.map +1 -0
- package/dist/delivery/user_policy.d.ts +74 -0
- package/dist/delivery/user_policy.d.ts.map +1 -0
- package/dist/delivery/user_policy.js +140 -0
- package/dist/delivery/user_policy.js.map +1 -0
- package/dist/discovery/cache.d.ts +37 -0
- package/dist/discovery/cache.d.ts.map +1 -0
- package/dist/discovery/cache.js +45 -0
- package/dist/discovery/cache.js.map +1 -0
- package/dist/discovery/configuration.d.ts +97 -0
- package/dist/discovery/configuration.d.ts.map +1 -0
- package/dist/discovery/configuration.js +146 -0
- package/dist/discovery/configuration.js.map +1 -0
- package/dist/discovery/dns.d.ts +56 -0
- package/dist/discovery/dns.d.ts.map +1 -0
- package/dist/discovery/dns.js +120 -0
- package/dist/discovery/dns.js.map +1 -0
- package/dist/discovery/domain_keys.d.ts +62 -0
- package/dist/discovery/domain_keys.d.ts.map +1 -0
- package/dist/discovery/domain_keys.js +89 -0
- package/dist/discovery/domain_keys.js.map +1 -0
- package/dist/discovery/index.d.ts +19 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +19 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/lookup.d.ts +72 -0
- package/dist/discovery/lookup.d.ts.map +1 -0
- package/dist/discovery/lookup.js +121 -0
- package/dist/discovery/lookup.js.map +1 -0
- package/dist/discovery/onion.d.ts +34 -0
- package/dist/discovery/onion.d.ts.map +1 -0
- package/dist/discovery/onion.js +61 -0
- package/dist/discovery/onion.js.map +1 -0
- package/dist/discovery/partition.d.ts +96 -0
- package/dist/discovery/partition.d.ts.map +1 -0
- package/dist/discovery/partition.js +247 -0
- package/dist/discovery/partition.js.map +1 -0
- package/dist/discovery/resolver.d.ts +113 -0
- package/dist/discovery/resolver.d.ts.map +1 -0
- package/dist/discovery/resolver.js +176 -0
- package/dist/discovery/resolver.js.map +1 -0
- package/dist/discovery/txt.d.ts +39 -0
- package/dist/discovery/txt.d.ts.map +1 -0
- package/dist/discovery/txt.js +71 -0
- package/dist/discovery/txt.js.map +1 -0
- package/dist/enclosure/forwarding.d.ts +128 -0
- package/dist/enclosure/forwarding.d.ts.map +1 -0
- package/dist/enclosure/forwarding.js +119 -0
- package/dist/enclosure/forwarding.js.map +1 -0
- package/dist/enclosure/index.d.ts +11 -0
- package/dist/enclosure/index.d.ts.map +1 -0
- package/dist/enclosure/index.js +11 -0
- package/dist/enclosure/index.js.map +1 -0
- package/dist/envelope/buckets.d.ts +38 -0
- package/dist/envelope/buckets.d.ts.map +1 -0
- package/dist/envelope/buckets.js +73 -0
- package/dist/envelope/buckets.js.map +1 -0
- package/dist/envelope/canonical.d.ts +28 -0
- package/dist/envelope/canonical.d.ts.map +1 -0
- package/dist/envelope/canonical.js +54 -0
- package/dist/envelope/canonical.js.map +1 -0
- package/dist/envelope/compose.d.ts +171 -0
- package/dist/envelope/compose.d.ts.map +1 -0
- package/dist/envelope/compose.js +237 -0
- package/dist/envelope/compose.js.map +1 -0
- package/dist/envelope/encode.d.ts +41 -0
- package/dist/envelope/encode.d.ts.map +1 -0
- package/dist/envelope/encode.js +69 -0
- package/dist/envelope/encode.js.map +1 -0
- package/dist/envelope/index.d.ts +20 -0
- package/dist/envelope/index.d.ts.map +1 -0
- package/dist/envelope/index.js +20 -0
- package/dist/envelope/index.js.map +1 -0
- package/dist/envelope/open_any.d.ts +48 -0
- package/dist/envelope/open_any.d.ts.map +1 -0
- package/dist/envelope/open_any.js +81 -0
- package/dist/envelope/open_any.js.map +1 -0
- package/dist/envelope/open_verified.d.ts +59 -0
- package/dist/envelope/open_verified.d.ts.map +1 -0
- package/dist/envelope/open_verified.js +67 -0
- package/dist/envelope/open_verified.js.map +1 -0
- package/dist/envelope/padding.d.ts +55 -0
- package/dist/envelope/padding.d.ts.map +1 -0
- package/dist/envelope/padding.js +162 -0
- package/dist/envelope/padding.js.map +1 -0
- package/dist/envelope/rejection.d.ts +22 -0
- package/dist/envelope/rejection.d.ts.map +1 -0
- package/dist/envelope/rejection.js +30 -0
- package/dist/envelope/rejection.js.map +1 -0
- package/dist/envelope/sendtime.d.ts +49 -0
- package/dist/envelope/sendtime.d.ts.map +1 -0
- package/dist/envelope/sendtime.js +87 -0
- package/dist/envelope/sendtime.js.map +1 -0
- package/dist/envelope/verify.d.ts +29 -0
- package/dist/envelope/verify.d.ts.map +1 -0
- package/dist/envelope/verify.js +90 -0
- package/dist/envelope/verify.js.map +1 -0
- package/dist/extensions/index.d.ts +7 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +7 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/limits.d.ts +101 -0
- package/dist/extensions/limits.d.ts.map +1 -0
- package/dist/extensions/limits.js +175 -0
- package/dist/extensions/limits.js.map +1 -0
- package/dist/handshake/abort.d.ts +49 -0
- package/dist/handshake/abort.d.ts.map +1 -0
- package/dist/handshake/abort.js +82 -0
- package/dist/handshake/abort.js.map +1 -0
- package/dist/handshake/capabilities.d.ts +46 -0
- package/dist/handshake/capabilities.d.ts.map +1 -0
- package/dist/handshake/capabilities.js +114 -0
- package/dist/handshake/capabilities.js.map +1 -0
- package/dist/handshake/client_state.d.ts +186 -0
- package/dist/handshake/client_state.d.ts.map +1 -0
- package/dist/handshake/client_state.js +520 -0
- package/dist/handshake/client_state.js.map +1 -0
- package/dist/handshake/confirm.d.ts +21 -0
- package/dist/handshake/confirm.d.ts.map +1 -0
- package/dist/handshake/confirm.js +27 -0
- package/dist/handshake/confirm.js.map +1 -0
- package/dist/handshake/driver.d.ts +126 -0
- package/dist/handshake/driver.d.ts.map +1 -0
- package/dist/handshake/driver.js +251 -0
- package/dist/handshake/driver.js.map +1 -0
- package/dist/handshake/federation.d.ts +365 -0
- package/dist/handshake/federation.d.ts.map +1 -0
- package/dist/handshake/federation.js +664 -0
- package/dist/handshake/federation.js.map +1 -0
- package/dist/handshake/first_contact.d.ts +57 -0
- package/dist/handshake/first_contact.d.ts.map +1 -0
- package/dist/handshake/first_contact.js +124 -0
- package/dist/handshake/first_contact.js.map +1 -0
- package/dist/handshake/identity.d.ts +101 -0
- package/dist/handshake/identity.d.ts.map +1 -0
- package/dist/handshake/identity.js +117 -0
- package/dist/handshake/identity.js.map +1 -0
- package/dist/handshake/index.d.ts +21 -0
- package/dist/handshake/index.d.ts.map +1 -0
- package/dist/handshake/index.js +21 -0
- package/dist/handshake/index.js.map +1 -0
- package/dist/handshake/messages.d.ts +176 -0
- package/dist/handshake/messages.d.ts.map +1 -0
- package/dist/handshake/messages.js +125 -0
- package/dist/handshake/messages.js.map +1 -0
- package/dist/handshake/pow.d.ts +53 -0
- package/dist/handshake/pow.d.ts.map +1 -0
- package/dist/handshake/pow.js +142 -0
- package/dist/handshake/pow.js.map +1 -0
- package/dist/handshake/resume_driver.d.ts +56 -0
- package/dist/handshake/resume_driver.d.ts.map +1 -0
- package/dist/handshake/resume_driver.js +75 -0
- package/dist/handshake/resume_driver.js.map +1 -0
- package/dist/handshake/server.d.ts +112 -0
- package/dist/handshake/server.d.ts.map +1 -0
- package/dist/handshake/server.js +247 -0
- package/dist/handshake/server.js.map +1 -0
- package/dist/handshake/server_state.d.ts +102 -0
- package/dist/handshake/server_state.d.ts.map +1 -0
- package/dist/handshake/server_state.js +278 -0
- package/dist/handshake/server_state.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/keys/compromise.d.ts +118 -0
- package/dist/keys/compromise.d.ts.map +1 -0
- package/dist/keys/compromise.js +218 -0
- package/dist/keys/compromise.js.map +1 -0
- package/dist/keys/device_certificate.d.ts +166 -0
- package/dist/keys/device_certificate.d.ts.map +1 -0
- package/dist/keys/device_certificate.js +328 -0
- package/dist/keys/device_certificate.js.map +1 -0
- package/dist/keys/device_records.d.ts +175 -0
- package/dist/keys/device_records.d.ts.map +1 -0
- package/dist/keys/device_records.js +418 -0
- package/dist/keys/device_records.js.map +1 -0
- package/dist/keys/directory_cache.d.ts +64 -0
- package/dist/keys/directory_cache.d.ts.map +1 -0
- package/dist/keys/directory_cache.js +98 -0
- package/dist/keys/directory_cache.js.map +1 -0
- package/dist/keys/directory_state.d.ts +79 -0
- package/dist/keys/directory_state.d.ts.map +1 -0
- package/dist/keys/directory_state.js +155 -0
- package/dist/keys/directory_state.js.map +1 -0
- package/dist/keys/index.d.ts +18 -0
- package/dist/keys/index.d.ts.map +1 -0
- package/dist/keys/index.js +18 -0
- package/dist/keys/index.js.map +1 -0
- package/dist/keys/key_revocation.d.ts +61 -0
- package/dist/keys/key_revocation.d.ts.map +1 -0
- package/dist/keys/key_revocation.js +88 -0
- package/dist/keys/key_revocation.js.map +1 -0
- package/dist/keys/request.d.ts +124 -0
- package/dist/keys/request.d.ts.map +1 -0
- package/dist/keys/request.js +130 -0
- package/dist/keys/request.js.map +1 -0
- package/dist/keys/sign.d.ts +49 -0
- package/dist/keys/sign.d.ts.map +1 -0
- package/dist/keys/sign.js +80 -0
- package/dist/keys/sign.js.map +1 -0
- package/dist/keys/signed.d.ts +80 -0
- package/dist/keys/signed.d.ts.map +1 -0
- package/dist/keys/signed.js +138 -0
- package/dist/keys/signed.js.map +1 -0
- package/dist/keys/store.d.ts +138 -0
- package/dist/keys/store.d.ts.map +1 -0
- package/dist/keys/store.js +107 -0
- package/dist/keys/store.js.map +1 -0
- package/dist/largeattachment/crypto.d.ts +47 -0
- package/dist/largeattachment/crypto.d.ts.map +1 -0
- package/dist/largeattachment/crypto.js +235 -0
- package/dist/largeattachment/crypto.js.map +1 -0
- package/dist/largeattachment/enclosure.d.ts +48 -0
- package/dist/largeattachment/enclosure.d.ts.map +1 -0
- package/dist/largeattachment/enclosure.js +102 -0
- package/dist/largeattachment/enclosure.js.map +1 -0
- package/dist/largeattachment/index.d.ts +15 -0
- package/dist/largeattachment/index.d.ts.map +1 -0
- package/dist/largeattachment/index.js +15 -0
- package/dist/largeattachment/index.js.map +1 -0
- package/dist/largeattachment/store.d.ts +36 -0
- package/dist/largeattachment/store.d.ts.map +1 -0
- package/dist/largeattachment/store.js +37 -0
- package/dist/largeattachment/store.js.map +1 -0
- package/dist/largeattachment/types.d.ts +56 -0
- package/dist/largeattachment/types.d.ts.map +1 -0
- package/dist/largeattachment/types.js +31 -0
- package/dist/largeattachment/types.js.map +1 -0
- package/dist/largeattachment/upload.d.ts +62 -0
- package/dist/largeattachment/upload.d.ts.map +1 -0
- package/dist/largeattachment/upload.js +166 -0
- package/dist/largeattachment/upload.js.map +1 -0
- package/dist/migration/index.d.ts +17 -0
- package/dist/migration/index.d.ts.map +1 -0
- package/dist/migration/index.js +17 -0
- package/dist/migration/index.js.map +1 -0
- package/dist/migration/lockout.d.ts +48 -0
- package/dist/migration/lockout.d.ts.map +1 -0
- package/dist/migration/lockout.js +57 -0
- package/dist/migration/lockout.js.map +1 -0
- package/dist/migration/migration.d.ts +48 -0
- package/dist/migration/migration.d.ts.map +1 -0
- package/dist/migration/migration.js +58 -0
- package/dist/migration/migration.js.map +1 -0
- package/dist/migration/notice.d.ts +33 -0
- package/dist/migration/notice.d.ts.map +1 -0
- package/dist/migration/notice.js +85 -0
- package/dist/migration/notice.js.map +1 -0
- package/dist/migration/orchestrate.d.ts +109 -0
- package/dist/migration/orchestrate.d.ts.map +1 -0
- package/dist/migration/orchestrate.js +212 -0
- package/dist/migration/orchestrate.js.map +1 -0
- package/dist/migration/publication_store.d.ts +34 -0
- package/dist/migration/publication_store.d.ts.map +1 -0
- package/dist/migration/publication_store.js +44 -0
- package/dist/migration/publication_store.js.map +1 -0
- package/dist/migration/sign.d.ts +65 -0
- package/dist/migration/sign.d.ts.map +1 -0
- package/dist/migration/sign.js +331 -0
- package/dist/migration/sign.js.map +1 -0
- package/dist/migration/types.d.ts +92 -0
- package/dist/migration/types.d.ts.map +1 -0
- package/dist/migration/types.js +26 -0
- package/dist/migration/types.js.map +1 -0
- package/dist/reasoncodes.d.ts +42 -0
- package/dist/reasoncodes.d.ts.map +1 -0
- package/dist/reasoncodes.js +80 -0
- package/dist/reasoncodes.js.map +1 -0
- package/dist/recovery/bundle.d.ts +34 -0
- package/dist/recovery/bundle.d.ts.map +1 -0
- package/dist/recovery/bundle.js +144 -0
- package/dist/recovery/bundle.js.map +1 -0
- package/dist/recovery/bundle_crypto.d.ts +60 -0
- package/dist/recovery/bundle_crypto.d.ts.map +1 -0
- package/dist/recovery/bundle_crypto.js +179 -0
- package/dist/recovery/bundle_crypto.js.map +1 -0
- package/dist/recovery/bundle_store.d.ts +57 -0
- package/dist/recovery/bundle_store.d.ts.map +1 -0
- package/dist/recovery/bundle_store.js +104 -0
- package/dist/recovery/bundle_store.js.map +1 -0
- package/dist/recovery/index.d.ts +19 -0
- package/dist/recovery/index.d.ts.map +1 -0
- package/dist/recovery/index.js +19 -0
- package/dist/recovery/index.js.map +1 -0
- package/dist/recovery/manifest_crosscheck.d.ts +59 -0
- package/dist/recovery/manifest_crosscheck.d.ts.map +1 -0
- package/dist/recovery/manifest_crosscheck.js +59 -0
- package/dist/recovery/manifest_crosscheck.js.map +1 -0
- package/dist/recovery/shamir.d.ts +51 -0
- package/dist/recovery/shamir.d.ts.map +1 -0
- package/dist/recovery/shamir.js +181 -0
- package/dist/recovery/shamir.js.map +1 -0
- package/dist/recovery/sign.d.ts +61 -0
- package/dist/recovery/sign.d.ts.map +1 -0
- package/dist/recovery/sign.js +359 -0
- package/dist/recovery/sign.js.map +1 -0
- package/dist/recovery/types.d.ts +180 -0
- package/dist/recovery/types.d.ts.map +1 -0
- package/dist/recovery/types.js +31 -0
- package/dist/recovery/types.js.map +1 -0
- package/dist/reputation/abuse_report.d.ts +62 -0
- package/dist/reputation/abuse_report.d.ts.map +1 -0
- package/dist/reputation/abuse_report.js +111 -0
- package/dist/reputation/abuse_report.js.map +1 -0
- package/dist/reputation/bucketize.d.ts +31 -0
- package/dist/reputation/bucketize.d.ts.map +1 -0
- package/dist/reputation/bucketize.js +77 -0
- package/dist/reputation/bucketize.js.map +1 -0
- package/dist/reputation/gossip.d.ts +24 -0
- package/dist/reputation/gossip.d.ts.map +1 -0
- package/dist/reputation/gossip.js +64 -0
- package/dist/reputation/gossip.js.map +1 -0
- package/dist/reputation/gossip_fetch.d.ts +64 -0
- package/dist/reputation/gossip_fetch.d.ts.map +1 -0
- package/dist/reputation/gossip_fetch.js +114 -0
- package/dist/reputation/gossip_fetch.js.map +1 -0
- package/dist/reputation/index.d.ts +20 -0
- package/dist/reputation/index.d.ts.map +1 -0
- package/dist/reputation/index.js +20 -0
- package/dist/reputation/index.js.map +1 -0
- package/dist/reputation/observation_store.d.ts +67 -0
- package/dist/reputation/observation_store.d.ts.map +1 -0
- package/dist/reputation/observation_store.js +171 -0
- package/dist/reputation/observation_store.js.map +1 -0
- package/dist/reputation/pow.d.ts +91 -0
- package/dist/reputation/pow.d.ts.map +1 -0
- package/dist/reputation/pow.js +209 -0
- package/dist/reputation/pow.js.map +1 -0
- package/dist/reputation/sign.d.ts +40 -0
- package/dist/reputation/sign.d.ts.map +1 -0
- package/dist/reputation/sign.js +202 -0
- package/dist/reputation/sign.js.map +1 -0
- package/dist/reputation/types.d.ts +133 -0
- package/dist/reputation/types.d.ts.map +1 -0
- package/dist/reputation/types.js +33 -0
- package/dist/reputation/types.js.map +1 -0
- package/dist/reputation/whois.d.ts +25 -0
- package/dist/reputation/whois.d.ts.map +1 -0
- package/dist/reputation/whois.js +20 -0
- package/dist/reputation/whois.js.map +1 -0
- package/dist/seal/index.d.ts +8 -0
- package/dist/seal/index.d.ts.map +1 -0
- package/dist/seal/index.js +8 -0
- package/dist/seal/index.js.map +1 -0
- package/dist/seal/wrap.d.ts +74 -0
- package/dist/seal/wrap.d.ts.map +1 -0
- package/dist/seal/wrap.js +213 -0
- package/dist/seal/wrap.js.map +1 -0
- package/dist/session/dispatcher.d.ts +65 -0
- package/dist/session/dispatcher.d.ts.map +1 -0
- package/dist/session/dispatcher.js +96 -0
- package/dist/session/dispatcher.js.map +1 -0
- package/dist/session/index.d.ts +15 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +15 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/rekey.d.ts +108 -0
- package/dist/session/rekey.d.ts.map +1 -0
- package/dist/session/rekey.js +207 -0
- package/dist/session/rekey.js.map +1 -0
- package/dist/session/rekey_seal.d.ts +66 -0
- package/dist/session/rekey_seal.d.ts.map +1 -0
- package/dist/session/rekey_seal.js +153 -0
- package/dist/session/rekey_seal.js.map +1 -0
- package/dist/session/resume.d.ts +125 -0
- package/dist/session/resume.d.ts.map +1 -0
- package/dist/session/resume.js +263 -0
- package/dist/session/resume.js.map +1 -0
- package/dist/session/session.d.ts +136 -0
- package/dist/session/session.d.ts.map +1 -0
- package/dist/session/session.js +188 -0
- package/dist/session/session.js.map +1 -0
- package/dist/transparency/index.d.ts +13 -0
- package/dist/transparency/index.d.ts.map +1 -0
- package/dist/transparency/index.js +13 -0
- package/dist/transparency/index.js.map +1 -0
- package/dist/transparency/log.d.ts +61 -0
- package/dist/transparency/log.d.ts.map +1 -0
- package/dist/transparency/log.js +133 -0
- package/dist/transparency/log.js.map +1 -0
- package/dist/transparency/merkle.d.ts +59 -0
- package/dist/transparency/merkle.d.ts.map +1 -0
- package/dist/transparency/merkle.js +314 -0
- package/dist/transparency/merkle.js.map +1 -0
- package/dist/transparency/sign.d.ts +48 -0
- package/dist/transparency/sign.d.ts.map +1 -0
- package/dist/transparency/sign.js +140 -0
- package/dist/transparency/sign.js.map +1 -0
- package/dist/transparency/types.d.ts +97 -0
- package/dist/transparency/types.d.ts.map +1 -0
- package/dist/transparency/types.js +25 -0
- package/dist/transparency/types.js.map +1 -0
- package/dist/transport/h2.d.ts +163 -0
- package/dist/transport/h2.d.ts.map +1 -0
- package/dist/transport/h2.js +397 -0
- package/dist/transport/h2.js.map +1 -0
- package/dist/transport/index.d.ts +15 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +15 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/memory.d.ts +21 -0
- package/dist/transport/memory.d.ts.map +1 -0
- package/dist/transport/memory.js +112 -0
- package/dist/transport/memory.js.map +1 -0
- package/dist/transport/transport.d.ts +54 -0
- package/dist/transport/transport.d.ts.map +1 -0
- package/dist/transport/transport.js +20 -0
- package/dist/transport/transport.js.map +1 -0
- package/dist/transport/ws.d.ts +40 -0
- package/dist/transport/ws.d.ts.map +1 -0
- package/dist/transport/ws.js +204 -0
- package/dist/transport/ws.js.map +1 -0
- package/package.json +147 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discovery resolver — well-known URI fetch + parse, plus the
|
|
3
|
+
* higher-level "resolve a server" orchestrator that produces the
|
|
4
|
+
* `serverDomainPub` a {@link "../handshake/driver".runClient} call
|
|
5
|
+
* needs.
|
|
6
|
+
*
|
|
7
|
+
* The resolver is fetch-injectable so tests can stub the HTTPS
|
|
8
|
+
* round-trips; production callers omit the `fetchImpl` option and
|
|
9
|
+
* the resolver uses Node 22+'s global `fetch`.
|
|
10
|
+
*
|
|
11
|
+
* The DNS SRV / TXT lookup leg of §5.1 is intentionally not
|
|
12
|
+
* implemented in this module — it requires `node:dns/promises` and
|
|
13
|
+
* does not cleanly tree-shake into a browser bundle. Callers that
|
|
14
|
+
* need DNS-first discovery wire it in front of {@link resolveServer}
|
|
15
|
+
* and pass an explicit `host` / well-known URL.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import { type Configuration } from "./configuration.js";
|
|
20
|
+
import { type DomainKeys, type KeyBlock, decodeKeyBlockPublic, verifyDomainKeyFingerprint } from "./domain_keys.js";
|
|
21
|
+
/**
|
|
22
|
+
* Minimal subset of the WHATWG fetch surface this module depends on.
|
|
23
|
+
* Both Node 22+ and browsers ship `fetch` matching this shape. Tests
|
|
24
|
+
* pass a fake to drive deterministic responses.
|
|
25
|
+
*/
|
|
26
|
+
export type FetchLike = (input: string, init?: {
|
|
27
|
+
method?: string;
|
|
28
|
+
headers?: Record<string, string>;
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
ok: boolean;
|
|
32
|
+
status: number;
|
|
33
|
+
headers: {
|
|
34
|
+
get(name: string): string | null;
|
|
35
|
+
};
|
|
36
|
+
text(): Promise<string>;
|
|
37
|
+
}>;
|
|
38
|
+
/** Options shared by every fetch in this module. */
|
|
39
|
+
export interface FetchOptions {
|
|
40
|
+
/** Override the fetch implementation. Defaults to `globalThis.fetch`. */
|
|
41
|
+
fetchImpl?: FetchLike;
|
|
42
|
+
/** Optional cancellation signal. */
|
|
43
|
+
signal?: AbortSignal;
|
|
44
|
+
/**
|
|
45
|
+
* Per-request timeout in milliseconds. Defaults to 10 seconds —
|
|
46
|
+
* matches semp-go's `FetchConfiguration` default.
|
|
47
|
+
*/
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
}
|
|
50
|
+
/** Build the canonical well-known URL for a given hostname. */
|
|
51
|
+
export declare function wellKnownUrl(host: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* GET the well-known configuration document and return it parsed.
|
|
54
|
+
* Throws on transport failure, non-200 status, oversized body, or
|
|
55
|
+
* structural parse failure.
|
|
56
|
+
*
|
|
57
|
+
* The URL's scheme is NOT enforced — production callers must pass an
|
|
58
|
+
* `https://` URL, but tests need to point at a local httptest-style
|
|
59
|
+
* server so this layer stays permissive.
|
|
60
|
+
*/
|
|
61
|
+
export declare function fetchConfiguration(url: string, opts?: FetchOptions): Promise<Configuration>;
|
|
62
|
+
/**
|
|
63
|
+
* GET the domain-keys document at the URL advertised as
|
|
64
|
+
* `endpoints.domain_keys` in a server's configuration. Returns the
|
|
65
|
+
* parsed document and the cross-checked signing-key public bytes.
|
|
66
|
+
*
|
|
67
|
+
* Throws if the fingerprint cross-check fails — a peer that trusts
|
|
68
|
+
* the publication channel still MUST confirm `key_id` is the SHA-256
|
|
69
|
+
* fingerprint of `public_key`, otherwise a misconfiguration could
|
|
70
|
+
* swap in a key whose fingerprint doesn't match the one the peer
|
|
71
|
+
* cached.
|
|
72
|
+
*/
|
|
73
|
+
export declare function fetchDomainKeys(url: string, opts?: FetchOptions): Promise<{
|
|
74
|
+
domainKeys: DomainKeys;
|
|
75
|
+
signingPub: Uint8Array;
|
|
76
|
+
encryptionPub: Uint8Array;
|
|
77
|
+
}>;
|
|
78
|
+
/** Result of {@link resolveServer}. */
|
|
79
|
+
export interface ResolvedServer {
|
|
80
|
+
/** The full configuration document. */
|
|
81
|
+
configuration: Configuration;
|
|
82
|
+
/** Parsed domain-keys document. */
|
|
83
|
+
domainKeys: DomainKeys;
|
|
84
|
+
/** 32-byte Ed25519 domain signing public key. */
|
|
85
|
+
signingPub: Uint8Array;
|
|
86
|
+
/** Lowercase-hex SHA-256 fingerprint of `signingPub`. */
|
|
87
|
+
signingKeyId: string;
|
|
88
|
+
/** 32-byte X25519 domain encryption public key. */
|
|
89
|
+
encryptionPub: Uint8Array;
|
|
90
|
+
/** Lowercase-hex SHA-256 fingerprint of `encryptionPub`. */
|
|
91
|
+
encryptionKeyId: string;
|
|
92
|
+
}
|
|
93
|
+
/** Inputs to {@link resolveServer}. */
|
|
94
|
+
export interface ResolveServerOptions extends FetchOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Override the configuration URL. When omitted, the resolver uses
|
|
97
|
+
* `https://<domain>/.well-known/semp/configuration` per §3 / §5.5.
|
|
98
|
+
* Callers that have already done DNS SRV discovery pass the SRV
|
|
99
|
+
* target host instead.
|
|
100
|
+
*/
|
|
101
|
+
configurationUrl?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* High-level resolver: fetch the configuration, then fetch the
|
|
105
|
+
* domain-keys at `endpoints.domain_keys`, then return the structured
|
|
106
|
+
* result. The `signingPub` field is what
|
|
107
|
+
* {@link "../handshake/driver".runClient} needs as its
|
|
108
|
+
* `serverDomainPub` config.
|
|
109
|
+
*/
|
|
110
|
+
export declare function resolveServer(domain: string, opts?: ResolveServerOptions): Promise<ResolvedServer>;
|
|
111
|
+
export { decodeKeyBlockPublic, verifyDomainKeyFingerprint };
|
|
112
|
+
export type { Configuration, DomainKeys, KeyBlock };
|
|
113
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/discovery/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,QAAQ,EAEb,oBAAoB,EAEpB,0BAA0B,EAC3B,MAAM,kBAAkB,CAAC;AAE1B;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CACtB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KAC/E,OAAO,CAAC;IACX,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC9C,IAAI,IAAI,OAAO,CA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oBAAoB,EAAE,0BAA0B,EAAE,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discovery resolver — well-known URI fetch + parse, plus the
|
|
3
|
+
* higher-level "resolve a server" orchestrator that produces the
|
|
4
|
+
* `serverDomainPub` a {@link "../handshake/driver".runClient} call
|
|
5
|
+
* needs.
|
|
6
|
+
*
|
|
7
|
+
* The resolver is fetch-injectable so tests can stub the HTTPS
|
|
8
|
+
* round-trips; production callers omit the `fetchImpl` option and
|
|
9
|
+
* the resolver uses Node 22+'s global `fetch`.
|
|
10
|
+
*
|
|
11
|
+
* The DNS SRV / TXT lookup leg of §5.1 is intentionally not
|
|
12
|
+
* implemented in this module — it requires `node:dns/promises` and
|
|
13
|
+
* does not cleanly tree-shake into a browser bundle. Callers that
|
|
14
|
+
* need DNS-first discovery wire it in front of {@link resolveServer}
|
|
15
|
+
* and pass an explicit `host` / well-known URL.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import { WellKnownMaxBytes, WellKnownPath, parseConfiguration, } from "./configuration.js";
|
|
20
|
+
import { DomainKeysMaxBytes, decodeKeyBlockPublic, parseDomainKeys, verifyDomainKeyFingerprint, } from "./domain_keys.js";
|
|
21
|
+
/** Build the canonical well-known URL for a given hostname. */
|
|
22
|
+
export function wellKnownUrl(host) {
|
|
23
|
+
if (host === "") {
|
|
24
|
+
throw new Error("discovery: empty host");
|
|
25
|
+
}
|
|
26
|
+
return `https://${host}${WellKnownPath}`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* GET the well-known configuration document and return it parsed.
|
|
30
|
+
* Throws on transport failure, non-200 status, oversized body, or
|
|
31
|
+
* structural parse failure.
|
|
32
|
+
*
|
|
33
|
+
* The URL's scheme is NOT enforced — production callers must pass an
|
|
34
|
+
* `https://` URL, but tests need to point at a local httptest-style
|
|
35
|
+
* server so this layer stays permissive.
|
|
36
|
+
*/
|
|
37
|
+
export async function fetchConfiguration(url, opts = {}) {
|
|
38
|
+
const body = await fetchTextBounded(url, WellKnownMaxBytes, opts);
|
|
39
|
+
let parsed;
|
|
40
|
+
try {
|
|
41
|
+
parsed = JSON.parse(body);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
throw new Error(`discovery: configuration parse: ${err instanceof Error ? err.message : String(err)}`);
|
|
45
|
+
}
|
|
46
|
+
return parseConfiguration(parsed);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* GET the domain-keys document at the URL advertised as
|
|
50
|
+
* `endpoints.domain_keys` in a server's configuration. Returns the
|
|
51
|
+
* parsed document and the cross-checked signing-key public bytes.
|
|
52
|
+
*
|
|
53
|
+
* Throws if the fingerprint cross-check fails — a peer that trusts
|
|
54
|
+
* the publication channel still MUST confirm `key_id` is the SHA-256
|
|
55
|
+
* fingerprint of `public_key`, otherwise a misconfiguration could
|
|
56
|
+
* swap in a key whose fingerprint doesn't match the one the peer
|
|
57
|
+
* cached.
|
|
58
|
+
*/
|
|
59
|
+
export async function fetchDomainKeys(url, opts = {}) {
|
|
60
|
+
const body = await fetchTextBounded(url, DomainKeysMaxBytes, opts);
|
|
61
|
+
let parsed;
|
|
62
|
+
try {
|
|
63
|
+
parsed = JSON.parse(body);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
throw new Error(`discovery: domain_keys parse: ${err instanceof Error ? err.message : String(err)}`);
|
|
67
|
+
}
|
|
68
|
+
const domainKeys = parseDomainKeys(parsed);
|
|
69
|
+
if (!verifyDomainKeyFingerprint(domainKeys.signing_key)) {
|
|
70
|
+
throw new Error("discovery: domain_keys.signing_key.key_id does not match SHA-256(public_key)");
|
|
71
|
+
}
|
|
72
|
+
if (!verifyDomainKeyFingerprint(domainKeys.encryption_key)) {
|
|
73
|
+
throw new Error("discovery: domain_keys.encryption_key.key_id does not match SHA-256(public_key)");
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
domainKeys,
|
|
77
|
+
signingPub: decodeKeyBlockPublic(domainKeys.signing_key),
|
|
78
|
+
encryptionPub: decodeKeyBlockPublic(domainKeys.encryption_key),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* High-level resolver: fetch the configuration, then fetch the
|
|
83
|
+
* domain-keys at `endpoints.domain_keys`, then return the structured
|
|
84
|
+
* result. The `signingPub` field is what
|
|
85
|
+
* {@link "../handshake/driver".runClient} needs as its
|
|
86
|
+
* `serverDomainPub` config.
|
|
87
|
+
*/
|
|
88
|
+
export async function resolveServer(domain, opts = {}) {
|
|
89
|
+
if (domain === "") {
|
|
90
|
+
throw new Error("discovery: empty domain");
|
|
91
|
+
}
|
|
92
|
+
const configUrl = opts.configurationUrl ?? wellKnownUrl(domain);
|
|
93
|
+
const configuration = await fetchConfiguration(configUrl, opts);
|
|
94
|
+
const domainKeysUrl = configuration.endpoints.domain_keys;
|
|
95
|
+
if (typeof domainKeysUrl !== "string" || domainKeysUrl === "") {
|
|
96
|
+
throw new Error("discovery: configuration missing endpoints.domain_keys");
|
|
97
|
+
}
|
|
98
|
+
const { domainKeys, signingPub, encryptionPub } = await fetchDomainKeys(domainKeysUrl, opts);
|
|
99
|
+
return {
|
|
100
|
+
configuration,
|
|
101
|
+
domainKeys,
|
|
102
|
+
signingPub,
|
|
103
|
+
signingKeyId: domainKeys.signing_key.key_id,
|
|
104
|
+
encryptionPub,
|
|
105
|
+
encryptionKeyId: domainKeys.encryption_key.key_id,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
// HTTP plumbing
|
|
110
|
+
async function fetchTextBounded(url, maxBytes, opts) {
|
|
111
|
+
if (url === "") {
|
|
112
|
+
throw new Error("discovery: empty URL");
|
|
113
|
+
}
|
|
114
|
+
const fetchImpl = opts.fetchImpl ?? defaultFetch();
|
|
115
|
+
// Compose a timeout-aware abort signal. The runtime supports
|
|
116
|
+
// AbortSignal.timeout when present; otherwise we wire it manually.
|
|
117
|
+
const externalSignal = opts.signal;
|
|
118
|
+
const timeoutMs = opts.timeoutMs ?? 10_000;
|
|
119
|
+
const timeoutController = new AbortController();
|
|
120
|
+
const timer = setTimeout(() => timeoutController.abort(), timeoutMs);
|
|
121
|
+
const externalListener = () => timeoutController.abort();
|
|
122
|
+
if (externalSignal !== undefined) {
|
|
123
|
+
if (externalSignal.aborted) {
|
|
124
|
+
timeoutController.abort();
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
externalSignal.addEventListener("abort", externalListener, { once: true });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
let resp;
|
|
131
|
+
try {
|
|
132
|
+
resp = await fetchImpl(url, {
|
|
133
|
+
method: "GET",
|
|
134
|
+
headers: { Accept: "application/json" },
|
|
135
|
+
signal: timeoutController.signal,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
clearTimeout(timer);
|
|
140
|
+
if (externalSignal !== undefined) {
|
|
141
|
+
externalSignal.removeEventListener("abort", externalListener);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (!resp.ok) {
|
|
145
|
+
throw new Error(`discovery: GET ${url} returned ${resp.status}`);
|
|
146
|
+
}
|
|
147
|
+
// Permissive content-type check — some servers return
|
|
148
|
+
// application/octet-stream for .json paths. We require JSON in the
|
|
149
|
+
// body parse, not in the header.
|
|
150
|
+
const ct = resp.headers.get("content-type") ?? "";
|
|
151
|
+
if (ct !== "" &&
|
|
152
|
+
!ct.toLowerCase().includes("json") &&
|
|
153
|
+
!ct.toLowerCase().includes("octet-stream")) {
|
|
154
|
+
throw new Error(`discovery: GET ${url}: unexpected content-type ${ct}`);
|
|
155
|
+
}
|
|
156
|
+
const body = await resp.text();
|
|
157
|
+
// Use UTF-8 byte length; JS strings are UTF-16 internally but the
|
|
158
|
+
// wire-side cap is in bytes. Buffer.byteLength is constant-time.
|
|
159
|
+
const byteLen = typeof Buffer !== "undefined"
|
|
160
|
+
? Buffer.byteLength(body, "utf8")
|
|
161
|
+
: new TextEncoder().encode(body).length;
|
|
162
|
+
if (byteLen > maxBytes) {
|
|
163
|
+
throw new Error(`discovery: GET ${url}: body exceeds ${maxBytes} bytes (got ${byteLen})`);
|
|
164
|
+
}
|
|
165
|
+
return body;
|
|
166
|
+
}
|
|
167
|
+
function defaultFetch() {
|
|
168
|
+
const f = globalThis.fetch;
|
|
169
|
+
if (f === undefined) {
|
|
170
|
+
throw new Error("discovery: globalThis.fetch is undefined. Pass a fetchImpl option, or run on Node 22+ / a browser.");
|
|
171
|
+
}
|
|
172
|
+
return f;
|
|
173
|
+
}
|
|
174
|
+
// Re-export helpers for callers that prefer the lower-level pieces.
|
|
175
|
+
export { decodeKeyBlockPublic, verifyDomainKeyFingerprint };
|
|
176
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/discovery/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAEL,iBAAiB,EACjB,aAAa,EACb,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AA8B1B,+DAA+D;AAC/D,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,WAAW,IAAI,GAAG,aAAa,EAAE,CAAC;AAC3C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAW,EACX,OAAqB,EAAE;IAEvB,MAAM,IAAI,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+
* The TXT record advertises a domain's SEMP capabilities under
|
|
5
|
+
* semicolon-separated `key=value` pairs:
|
|
6
|
+
*
|
|
7
|
+
* ```
|
|
8
|
+
* v=semp1;pq=ready;c=ws,h2,quic;f=groups,threads,reactions
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Known keys:
|
|
12
|
+
* - `v` string protocol version
|
|
13
|
+
* - `pq` string PQ readiness signal
|
|
14
|
+
* - `c` list comma-separated transport identifiers
|
|
15
|
+
* - `f` list comma-separated optional features
|
|
16
|
+
*
|
|
17
|
+
* Unknown keys MUST be ignored, not rejected — DNS TXT records are
|
|
18
|
+
* a public surface and an upgrading peer might add new keys before
|
|
19
|
+
* a downgrading peer learns about them.
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
/** Parsed shape of a `_semp.<domain>` TXT record. */
|
|
24
|
+
export interface TXTCapabilities {
|
|
25
|
+
v?: string;
|
|
26
|
+
pq?: string;
|
|
27
|
+
c?: string[];
|
|
28
|
+
f?: string[];
|
|
29
|
+
/** Keys present in the record but not recognized by this parser. */
|
|
30
|
+
_ignored_unknown: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse a TXT capability record. Unknown keys are collected into
|
|
34
|
+
* `_ignored_unknown` rather than rejected. Empty segments and
|
|
35
|
+
* malformed `k=v` pairs are silently dropped (DISCOVERY.md §8.1
|
|
36
|
+
* treats DNS TXT as best-effort).
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseTXTCapabilities(record: string): TXTCapabilities;
|
|
39
|
+
//# sourceMappingURL=txt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"txt.d.ts","sourceRoot":"","sources":["../../src/discovery/txt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qDAAqD;AACrD,MAAM,WAAW,eAAe;IAC9B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IACb,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IACb,oEAAoE;IACpE,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAmCpE"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DNS TXT capability-record parsing per DISCOVERY.md §8.1.
|
|
3
|
+
*
|
|
4
|
+
* The TXT record advertises a domain's SEMP capabilities under
|
|
5
|
+
* semicolon-separated `key=value` pairs:
|
|
6
|
+
*
|
|
7
|
+
* ```
|
|
8
|
+
* v=semp1;pq=ready;c=ws,h2,quic;f=groups,threads,reactions
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Known keys:
|
|
12
|
+
* - `v` string protocol version
|
|
13
|
+
* - `pq` string PQ readiness signal
|
|
14
|
+
* - `c` list comma-separated transport identifiers
|
|
15
|
+
* - `f` list comma-separated optional features
|
|
16
|
+
*
|
|
17
|
+
* Unknown keys MUST be ignored, not rejected — DNS TXT records are
|
|
18
|
+
* a public surface and an upgrading peer might add new keys before
|
|
19
|
+
* a downgrading peer learns about them.
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Parse a TXT capability record. Unknown keys are collected into
|
|
25
|
+
* `_ignored_unknown` rather than rejected. Empty segments and
|
|
26
|
+
* malformed `k=v` pairs are silently dropped (DISCOVERY.md §8.1
|
|
27
|
+
* treats DNS TXT as best-effort).
|
|
28
|
+
*/
|
|
29
|
+
export function parseTXTCapabilities(record) {
|
|
30
|
+
const out = { _ignored_unknown: [] };
|
|
31
|
+
if (record.length === 0) {
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
for (const segment of record.split(";")) {
|
|
35
|
+
const trimmed = segment.trim();
|
|
36
|
+
if (trimmed.length === 0) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const eq = trimmed.indexOf("=");
|
|
40
|
+
if (eq < 1) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const key = trimmed.slice(0, eq);
|
|
44
|
+
const value = trimmed.slice(eq + 1);
|
|
45
|
+
switch (key) {
|
|
46
|
+
case "v":
|
|
47
|
+
out.v = value;
|
|
48
|
+
break;
|
|
49
|
+
case "pq":
|
|
50
|
+
out.pq = value;
|
|
51
|
+
break;
|
|
52
|
+
case "c":
|
|
53
|
+
out.c = splitCSV(value);
|
|
54
|
+
break;
|
|
55
|
+
case "f":
|
|
56
|
+
out.f = splitCSV(value);
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
out._ignored_unknown.push(key);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
function splitCSV(s) {
|
|
66
|
+
if (s.length === 0) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
return s.split(",").map((x) => x.trim()).filter((x) => x.length > 0);
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=txt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"txt.js","sourceRoot":"","sources":["../../src/discovery/txt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAYH;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,MAAM,GAAG,GAAoB,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC;IACtD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC;IACb,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,OAAO,C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|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forwarding compose per ENVELOPE.md §6.6.
|
|
3
|
+
*
|
|
4
|
+
* A forwarded enclosure carries three signatures, layered:
|
|
5
|
+
*
|
|
6
|
+
* 1. The ORIGINAL sender's `sender_signature` over their inner
|
|
7
|
+
* enclosure (subject, content_type, body, attachments,
|
|
8
|
+
* extensions). Prefix: `SEMP-ENCLOSURE-SENDER:`.
|
|
9
|
+
* Signed scope: the `original_enclosure_plaintext` subtree.
|
|
10
|
+
*
|
|
11
|
+
* 2. The FORWARDER's `forwarder_attestation` over the
|
|
12
|
+
* `forwarded_from` block — the inner sender_signature is
|
|
13
|
+
* already populated by step 1, so this signs over canonical
|
|
14
|
+
* bytes that include it. Prefix: `SEMP-FORWARDER-ATTESTATION:`.
|
|
15
|
+
* Signed scope: the entire `forwarded_from` subtree.
|
|
16
|
+
*
|
|
17
|
+
* 3. The FORWARDER acting as outer sender: `sender_signature`
|
|
18
|
+
* over the outer enclosure. Prefix: `SEMP-ENCLOSURE-SENDER:`.
|
|
19
|
+
* Signed scope: the entire outer enclosure object.
|
|
20
|
+
*
|
|
21
|
+
* The verify path (handlers-wave4.ts) walks these three steps in
|
|
22
|
+
* reverse to verify.
|
|
23
|
+
*
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
26
|
+
/** A keyref for a sender identity (`{algorithm, key_id, value}` style). */
|
|
27
|
+
interface IdentitySigBlock {
|
|
28
|
+
algorithm: "ed25519";
|
|
29
|
+
key_id: string;
|
|
30
|
+
value: string;
|
|
31
|
+
}
|
|
32
|
+
/** Inner sender's enclosure plaintext (the original message body). */
|
|
33
|
+
export interface InnerEnclosurePlaintext {
|
|
34
|
+
subject: string;
|
|
35
|
+
content_type: string;
|
|
36
|
+
body: Record<string, string>;
|
|
37
|
+
attachments?: unknown[];
|
|
38
|
+
extensions?: Record<string, unknown>;
|
|
39
|
+
/** Set to null for an inner (un-forwarded) enclosure. */
|
|
40
|
+
forwarded_from?: null;
|
|
41
|
+
}
|
|
42
|
+
/** Outer enclosure plaintext (forwarder's own added content). */
|
|
43
|
+
export interface OuterEnclosurePlaintext {
|
|
44
|
+
subject: string;
|
|
45
|
+
content_type: string;
|
|
46
|
+
body: Record<string, string>;
|
|
47
|
+
attachments?: unknown[];
|
|
48
|
+
extensions?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
/** Reference to the original envelope's seal + postmark. */
|
|
51
|
+
export interface OriginalEnvelopeRef {
|
|
52
|
+
/** seal.algorithm + seal.key_id of the original envelope. */
|
|
53
|
+
original_seal: {
|
|
54
|
+
algorithm: string;
|
|
55
|
+
key_id: string;
|
|
56
|
+
};
|
|
57
|
+
/** Pinned postmark fields from the original envelope. */
|
|
58
|
+
original_postmark: {
|
|
59
|
+
id: string;
|
|
60
|
+
from_domain: string;
|
|
61
|
+
to_domain: string;
|
|
62
|
+
expires: string;
|
|
63
|
+
session_id: string;
|
|
64
|
+
};
|
|
65
|
+
/** Original sender address (`alice@a.example`). */
|
|
66
|
+
original_sender_address: string;
|
|
67
|
+
}
|
|
68
|
+
/** Inputs to {@link composeForwarded}. */
|
|
69
|
+
export interface ComposeForwardedInput {
|
|
70
|
+
/** Inner sender's 32-byte Ed25519 secret seed. */
|
|
71
|
+
innerSenderSeed: Uint8Array;
|
|
72
|
+
/** Inner sender's identity key_id. */
|
|
73
|
+
innerSenderKeyId: string;
|
|
74
|
+
/** Inner enclosure plaintext (no sender_signature yet). */
|
|
75
|
+
innerEnclosurePlaintext: InnerEnclosurePlaintext;
|
|
76
|
+
/** Forwarder's 32-byte Ed25519 secret seed (used twice: for the
|
|
77
|
+
* forwarder_attestation AND for the outer sender_signature). */
|
|
78
|
+
forwarderSeed: Uint8Array;
|
|
79
|
+
/** Forwarder's identity key_id. */
|
|
80
|
+
forwarderKeyId: string;
|
|
81
|
+
/** Outer enclosure plaintext (no sender_signature yet). */
|
|
82
|
+
outerEnclosurePlaintext: OuterEnclosurePlaintext;
|
|
83
|
+
/** Pinned reference to the original envelope. */
|
|
84
|
+
originalEnvelope: OriginalEnvelopeRef;
|
|
85
|
+
/** ISO 8601 timestamp when the forwarder received the original. */
|
|
86
|
+
receivedAt: string;
|
|
87
|
+
}
|
|
88
|
+
/** Fully-signed outer enclosure, ready to wrap as an envelope payload. */
|
|
89
|
+
export interface SignedForwardedEnclosure {
|
|
90
|
+
subject: string;
|
|
91
|
+
content_type: string;
|
|
92
|
+
body: Record<string, string>;
|
|
93
|
+
attachments: unknown[];
|
|
94
|
+
forwarded_from: {
|
|
95
|
+
original_enclosure_plaintext: InnerEnclosurePlaintext & {
|
|
96
|
+
sender_signature: IdentitySigBlock;
|
|
97
|
+
};
|
|
98
|
+
original_seal: OriginalEnvelopeRef["original_seal"];
|
|
99
|
+
original_postmark: OriginalEnvelopeRef["original_postmark"];
|
|
100
|
+
original_sender_address: string;
|
|
101
|
+
received_at: string;
|
|
102
|
+
forwarder_attestation: IdentitySigBlock;
|
|
103
|
+
};
|
|
104
|
+
extensions: Record<string, unknown>;
|
|
105
|
+
sender_signature: IdentitySigBlock;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Compose a 3-signature forwarded enclosure. Returns the
|
|
109
|
+
* fully-signed object whose canonical bytes match the spec.
|
|
110
|
+
*
|
|
111
|
+
* Step 1: sign the inner enclosure with the original sender's
|
|
112
|
+
* identity key. The signed inner becomes
|
|
113
|
+
* `forwarded_from.original_enclosure_plaintext`.
|
|
114
|
+
*
|
|
115
|
+
* Step 2: assemble the `forwarded_from` block with the signed
|
|
116
|
+
* inner, original_seal/postmark/address, received_at, and a
|
|
117
|
+
* `forwarder_attestation` placeholder. Sign the block with the
|
|
118
|
+
* forwarder's identity key under the
|
|
119
|
+
* SEMP-FORWARDER-ATTESTATION: prefix.
|
|
120
|
+
*
|
|
121
|
+
* Step 3: assemble the outer enclosure with the signed
|
|
122
|
+
* forwarded_from block and a `sender_signature` placeholder.
|
|
123
|
+
* Sign with the forwarder's identity key under the
|
|
124
|
+
* SEMP-ENCLOSURE-SENDER: prefix.
|
|
125
|
+
*/
|
|
126
|
+
export declare function composeForwarded(input: ComposeForwardedInput): SignedForwardedEnclosure;
|
|
127
|
+
export {};
|
|
128
|
+
//# sourceMappingURL=forwarding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forwarding.d.ts","sourceRoot":"","sources":["../../src/enclosure/forwarding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,2EAA2E;AAC3E,UAAU,gBAAgB;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,sEAAsE;AACtE,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,yDAAyD;IACzD,cAAc,CAAC,EAAE,IAAI,CAAC;CACvB;AAED,iEAAiE;AACjE,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,4DAA4D;AAC5D,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,aAAa,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,yDAAyD;IACzD,iBAAi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