@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,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delivery disposition data per DELIVERY.md §3.2 + CLIENT.md §4.5.7.
|
|
3
|
+
*
|
|
4
|
+
* The `delivery-disposition` sync kind is the control signal a
|
|
5
|
+
* staged device emits to tell the home server whether a held
|
|
6
|
+
* envelope should advance to the next stage or be suppressed.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/** The literal `kind` string identifying a delivery-disposition sync marker. */
|
|
11
|
+
export const DispositionKind = "delivery-disposition";
|
|
12
|
+
/** Recommended reason tags per CLIENT.md §4.5.7. Operators MAY define more. */
|
|
13
|
+
export const DispositionReasonSpam = "spam";
|
|
14
|
+
export const DispositionReasonAccepted = "accepted";
|
|
15
|
+
export const DispositionReasonPolicy = "policy";
|
|
16
|
+
export const DispositionReasonOther = "other";
|
|
17
|
+
/**
|
|
18
|
+
* Validate `d` is structurally well-formed per CLIENT.md §4.5.7.
|
|
19
|
+
* Does NOT verify authentication; the home server verifies §3.2.5
|
|
20
|
+
* (session belongs to `device_id`) at receipt.
|
|
21
|
+
*/
|
|
22
|
+
export function validateDisposition(d) {
|
|
23
|
+
if (d === undefined || d === null) {
|
|
24
|
+
throw new Error("delivery: nil disposition");
|
|
25
|
+
}
|
|
26
|
+
if (d.kind !== DispositionKind) {
|
|
27
|
+
throw new Error(`delivery: disposition kind ${JSON.stringify(d.kind)}, want ${JSON.stringify(DispositionKind)}`);
|
|
28
|
+
}
|
|
29
|
+
if (d.source_envelope_id === "") {
|
|
30
|
+
throw new Error("delivery: disposition missing source_envelope_id");
|
|
31
|
+
}
|
|
32
|
+
if (d.device_id === "") {
|
|
33
|
+
throw new Error("delivery: disposition missing device_id");
|
|
34
|
+
}
|
|
35
|
+
if (d.disposition === undefined || d.disposition === "") {
|
|
36
|
+
throw new Error("delivery: disposition missing decision");
|
|
37
|
+
}
|
|
38
|
+
if (d.disposition !== "advance" && d.disposition !== "suppress") {
|
|
39
|
+
throw new Error(`delivery: disposition decision ${JSON.stringify(d.disposition)} is not a valid value`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Apply the §3.2.3 conservative aggregation rule across the
|
|
44
|
+
* dispositions collected at one stage:
|
|
45
|
+
*
|
|
46
|
+
* - If any disposition is `suppress`, return `"suppress"`.
|
|
47
|
+
* - Otherwise return `"advance"` (covers "any advance" and "no
|
|
48
|
+
* dispositions at all" via §3.2.4 fail-open on timeout).
|
|
49
|
+
*
|
|
50
|
+
* Does NOT itself enforce the §3.2.5 authentication rules; the
|
|
51
|
+
* caller filters out late or off-stage dispositions before
|
|
52
|
+
* aggregating.
|
|
53
|
+
*/
|
|
54
|
+
export function aggregateDispositions(ds) {
|
|
55
|
+
for (const d of ds) {
|
|
56
|
+
if (d.disposition === "suppress") {
|
|
57
|
+
return "suppress";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return "advance";
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Recommended stage timeout per DELIVERY.md §3.2.2. Operators MAY
|
|
64
|
+
* configure longer windows.
|
|
65
|
+
*/
|
|
66
|
+
export const DefaultStageTimeoutMs = 30_000;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the wait at the current stage MUST terminate per §3.2.2.
|
|
69
|
+
* Either every device at the stage has emitted a disposition, or
|
|
70
|
+
* the deadline has passed.
|
|
71
|
+
*
|
|
72
|
+
* Does NOT return the outcome; the caller follows up with
|
|
73
|
+
* {@link aggregateDispositions} to compute that.
|
|
74
|
+
*
|
|
75
|
+
* @param stage - the current stage record
|
|
76
|
+
* @param now - current wall-clock
|
|
77
|
+
* @param deadline - ISO 8601 UTC string; empty means "no deadline"
|
|
78
|
+
*/
|
|
79
|
+
export function isStageComplete(stage, now, deadline) {
|
|
80
|
+
if (stage === undefined || stage === null) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
if (stage.pending_device_ids.length === 0) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
if (deadline !== "") {
|
|
87
|
+
const ms = Date.parse(deadline);
|
|
88
|
+
if (!Number.isNaN(ms) && now.getTime() >= ms) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// All pending devices have emitted? Build a set of devices
|
|
93
|
+
// already represented in `dispositions` and check.
|
|
94
|
+
const seen = new Set();
|
|
95
|
+
for (const d of stage.dispositions) {
|
|
96
|
+
seen.add(d.device_id);
|
|
97
|
+
}
|
|
98
|
+
for (const id of stage.pending_device_ids) {
|
|
99
|
+
if (!seen.has(id)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=disposition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposition.js","sourceRoot":"","sources":["../../src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B,EAAE,CAAC;QAC1C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SEMP_FETCH wire shapes — the demo-only client → home-server inbox
|
|
3
|
+
* pull protocol per CLIENT.md §3.
|
|
4
|
+
*
|
|
5
|
+
* HANDSHAKE.md §4.6 explicitly leaves the client wakeup mechanism
|
|
6
|
+
* outside the scope of the spec: "How a server notifies a client
|
|
7
|
+
* that incoming messages are waiting is outside the scope of this
|
|
8
|
+
* specification. Implementations MAY use persistent WebSocket
|
|
9
|
+
* connections, long polling, or platform notification services such
|
|
10
|
+
* as APNs or FCM."
|
|
11
|
+
*
|
|
12
|
+
* `SEMP_FETCH` is the simplest possible such mechanism: the client,
|
|
13
|
+
* after completing the handshake, sends a single `SEMP_FETCH`
|
|
14
|
+
* request and the server responds with the contents of the client's
|
|
15
|
+
* inbox. It is fit for demo and test purposes only; a real
|
|
16
|
+
* deployment would use a long-lived notification stream or platform
|
|
17
|
+
* push.
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
/** Wire-level type discriminator. */
|
|
22
|
+
export declare const FetchType = "SEMP_FETCH";
|
|
23
|
+
/** Schema version. */
|
|
24
|
+
export declare const FetchVersion = "1.0.0";
|
|
25
|
+
/** Discriminator for which fetch message variant this is. */
|
|
26
|
+
export type FetchStep = "request" | "response";
|
|
27
|
+
/** Sent by the client to pull every waiting envelope from the inbox. */
|
|
28
|
+
export interface FetchRequest {
|
|
29
|
+
type: typeof FetchType;
|
|
30
|
+
step: "request";
|
|
31
|
+
version: string;
|
|
32
|
+
}
|
|
33
|
+
/** Construct a {@link FetchRequest} with the protocol version pre-populated. */
|
|
34
|
+
export declare function newFetchRequest(): FetchRequest;
|
|
35
|
+
/**
|
|
36
|
+
* Server's response carrying the envelopes being delivered. Each
|
|
37
|
+
* element of `envelopes` is the base64-encoded canonical JSON of a
|
|
38
|
+
* single SEMP envelope (the same bytes the sender produced; the
|
|
39
|
+
* recipient runs `decodeEnvelope` and `openBriefAny` /
|
|
40
|
+
* `openEnclosureAny` on each).
|
|
41
|
+
*
|
|
42
|
+
* `drained` reports whether the server returned every envelope it
|
|
43
|
+
* had queued for the recipient. The demo server always sets this to
|
|
44
|
+
* `true` because the inbox is unbounded; production implementations
|
|
45
|
+
* might paginate and set `drained === false`.
|
|
46
|
+
*/
|
|
47
|
+
export interface FetchResponse {
|
|
48
|
+
type: typeof FetchType;
|
|
49
|
+
step: "response";
|
|
50
|
+
version: string;
|
|
51
|
+
/** Base64-encoded envelope payloads. */
|
|
52
|
+
envelopes: string[];
|
|
53
|
+
drained: boolean;
|
|
54
|
+
/** ISO 8601 UTC. */
|
|
55
|
+
timestamp: string;
|
|
56
|
+
}
|
|
57
|
+
/** Construct a fully-populated {@link FetchResponse}. */
|
|
58
|
+
export declare function newFetchResponse(envelopesB64: string[], nowFn?: () => Date): FetchResponse;
|
|
59
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/delivery/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,qCAAqC;AACrC,eAAO,MAAM,SAAS,eAAe,CAAC;AAEtC,sBAAsB;AACtB,eAAO,MAAM,YAAY,UAAU,CAAC;AAEpC,6DAA6D;AAC7D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAE/C,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,SAAS,CAAC;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,gFAAgF;AAChF,wBAAgB,eAAe,IAAI,YAAY,CAM9C;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,SAAS,CAAC;IACvB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EAAE,EACtB,KAAK,GAAE,MAAM,IAAuB,GACnC,aAAa,CASf"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SEMP_FETCH wire shapes — the demo-only client → home-server inbox
|
|
3
|
+
* pull protocol per CLIENT.md §3.
|
|
4
|
+
*
|
|
5
|
+
* HANDSHAKE.md §4.6 explicitly leaves the client wakeup mechanism
|
|
6
|
+
* outside the scope of the spec: "How a server notifies a client
|
|
7
|
+
* that incoming messages are waiting is outside the scope of this
|
|
8
|
+
* specification. Implementations MAY use persistent WebSocket
|
|
9
|
+
* connections, long polling, or platform notification services such
|
|
10
|
+
* as APNs or FCM."
|
|
11
|
+
*
|
|
12
|
+
* `SEMP_FETCH` is the simplest possible such mechanism: the client,
|
|
13
|
+
* after completing the handshake, sends a single `SEMP_FETCH`
|
|
14
|
+
* request and the server responds with the contents of the client's
|
|
15
|
+
* inbox. It is fit for demo and test purposes only; a real
|
|
16
|
+
* deployment would use a long-lived notification stream or platform
|
|
17
|
+
* push.
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
/** Wire-level type discriminator. */
|
|
22
|
+
export const FetchType = "SEMP_FETCH";
|
|
23
|
+
/** Schema version. */
|
|
24
|
+
export const FetchVersion = "1.0.0";
|
|
25
|
+
/** Construct a {@link FetchRequest} with the protocol version pre-populated. */
|
|
26
|
+
export function newFetchRequest() {
|
|
27
|
+
return {
|
|
28
|
+
type: FetchType,
|
|
29
|
+
step: "request",
|
|
30
|
+
version: FetchVersion,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Construct a fully-populated {@link FetchResponse}. */
|
|
34
|
+
export function newFetchResponse(envelopesB64, nowFn = () => new Date()) {
|
|
35
|
+
return {
|
|
36
|
+
type: FetchType,
|
|
37
|
+
step: "response",
|
|
38
|
+
version: FetchVersion,
|
|
39
|
+
envelopes: envelopesB64,
|
|
40
|
+
drained: true,
|
|
41
|
+
timestamp: isoSecond(nowFn()),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function isoSecond(d) {
|
|
45
|
+
return d.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/delivery/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,qCAAqC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAC;AAEtC,sBAAsB;AACtB,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAYpC,gFAAgF;AAChF,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,YAAY;KACtB,CAAC;AACJ,CAAC;AAyBD,yDAAyD;AACzD,MAAM,UAAU,gBAAgB,CAC9B,YAAsB,EACtB,QAAoB,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;IAEpC,OAAO;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,YAAY;QACvB,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;KAC9B,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,CAAO;IACxB,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Federation forwarder per DELIVERY.md §5 and HANDSHAKE.md §5.
|
|
3
|
+
*
|
|
4
|
+
* Establishes and caches federation sessions to remote peers and
|
|
5
|
+
* forwards envelopes across them. Each `(localDomain, peerDomain)`
|
|
6
|
+
* pair gets at most one live session at a time; the forwarder
|
|
7
|
+
* re-runs the federation handshake if the cached session has
|
|
8
|
+
* expired or been torn down.
|
|
9
|
+
*
|
|
10
|
+
* On forward, the forwarder:
|
|
11
|
+
*
|
|
12
|
+
* 1. Updates `postmark.session_id` to reference the federation
|
|
13
|
+
* session id (so the peer's receive pipeline matches).
|
|
14
|
+
* 2. Re-signs the envelope with the local domain key and
|
|
15
|
+
* recomputes `seal.session_mac` under the federation
|
|
16
|
+
* session's `K_env_mac`.
|
|
17
|
+
* 3. Sends the encoded envelope over the federation transport.
|
|
18
|
+
* 4. Returns the peer's parsed {@link SubmissionResponse}.
|
|
19
|
+
*
|
|
20
|
+
* The original sender's domain proof of provenance does NOT need
|
|
21
|
+
* to be preserved separately — in the SEMP architecture the
|
|
22
|
+
* sender's home server and the federation initiator are the SAME
|
|
23
|
+
* server, so re-signing with the local domain key is functionally
|
|
24
|
+
* identical to "the sender's domain signed this envelope".
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
import { type Envelope } from "../envelope/index.js";
|
|
29
|
+
import { type Capabilities, type FederationPolicy } from "../handshake/index.js";
|
|
30
|
+
import type { Transport } from "../transport/index.js";
|
|
31
|
+
import type { SubmissionResponse } from "./submission.js";
|
|
32
|
+
/** Per-peer routing information. */
|
|
33
|
+
export interface PeerConfig {
|
|
34
|
+
/** Peer's domain (e.g. `"b.example"`). */
|
|
35
|
+
domain: string;
|
|
36
|
+
/**
|
|
37
|
+
* Federation endpoint URL (e.g. `"ws://127.0.0.1:18082/v1/federate"`).
|
|
38
|
+
* The forwarder passes this verbatim to {@link Dialer}.
|
|
39
|
+
*/
|
|
40
|
+
endpoint: string;
|
|
41
|
+
/**
|
|
42
|
+
* Peer's long-term Ed25519 signing public key. Used by the
|
|
43
|
+
* federation Initiator to verify the peer's response / accepted
|
|
44
|
+
* messages.
|
|
45
|
+
*/
|
|
46
|
+
domainSigningPub: Uint8Array;
|
|
47
|
+
}
|
|
48
|
+
/** Domain → {@link PeerConfig} map. */
|
|
49
|
+
export declare class PeerRegistry {
|
|
50
|
+
private readonly peers;
|
|
51
|
+
put(cfg: PeerConfig): void;
|
|
52
|
+
lookup(domain: string): PeerConfig | null;
|
|
53
|
+
}
|
|
54
|
+
/** Opens a transport to a peer's federation endpoint. */
|
|
55
|
+
export type Dialer = (endpoint: string) => Promise<Transport>;
|
|
56
|
+
/** Inputs to {@link Forwarder}. */
|
|
57
|
+
export interface ForwarderConfig {
|
|
58
|
+
/** Local server's domain. */
|
|
59
|
+
localDomain: string;
|
|
60
|
+
/** Stable id of the local server instance. */
|
|
61
|
+
localServerID: string;
|
|
62
|
+
/** Local 32-byte Ed25519 secret seed. */
|
|
63
|
+
localDomainSeed: Uint8Array;
|
|
64
|
+
/** Static peer registry. */
|
|
65
|
+
peers: PeerRegistry;
|
|
66
|
+
/** Transport dialer. */
|
|
67
|
+
dial: Dialer;
|
|
68
|
+
/**
|
|
69
|
+
* Capabilities advertised on outbound federation handshakes.
|
|
70
|
+
* Defaults to `{ encryption_algorithms: ["x25519-chacha20-poly1305"], extensions: [] }`.
|
|
71
|
+
*/
|
|
72
|
+
capabilities?: Capabilities;
|
|
73
|
+
/** Policy hook. Defaults to `acceptAllPolicies`. */
|
|
74
|
+
policyAcceptor?: (policy: FederationPolicy) => string | null;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Federation forwarder.
|
|
78
|
+
*
|
|
79
|
+
* `forward()` is concurrency-safe: per-peer wire access is
|
|
80
|
+
* serialized by a software lock so concurrent calls don't
|
|
81
|
+
* interleave on the same stream. Use {@link Forwarder.close} on
|
|
82
|
+
* shutdown to tear down every cached session.
|
|
83
|
+
*/
|
|
84
|
+
export declare class Forwarder {
|
|
85
|
+
private readonly cfg;
|
|
86
|
+
private readonly sessions;
|
|
87
|
+
private readonly connecting;
|
|
88
|
+
constructor(cfg: ForwarderConfig);
|
|
89
|
+
/**
|
|
90
|
+
* Re-bind `seal.session_mac` under the federation session's
|
|
91
|
+
* `K_env_mac` and ship `env` across the cached session for
|
|
92
|
+
* `peerDomain`. Returns the peer's parsed submission response.
|
|
93
|
+
*
|
|
94
|
+
* Opens a federation session lazily on first call per peer.
|
|
95
|
+
*/
|
|
96
|
+
forward(peerDomain: string, env: Envelope): Promise<SubmissionResponse>;
|
|
97
|
+
/** Tear down every cached session. Call on shutdown. */
|
|
98
|
+
close(): Promise<void>;
|
|
99
|
+
/** Diagnostic: peer domains with a live cached session. */
|
|
100
|
+
cachedPeers(): string[];
|
|
101
|
+
private getSession;
|
|
102
|
+
private openSession;
|
|
103
|
+
private forwardOnSession;
|
|
104
|
+
private dropSession;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=forwarder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forwarder.d.ts","sourceRoot":"","sources":["../../src/delivery/forwarder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,EACL,KAAK,QAAQ,EAGd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAK1D,oCAAoC;AACpC,MAA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IAAI,CAAC;IAY5B,2DAA2D;IAC3D,WAAW,IAAI,MAAM,EAAE;YAMT,UAAU;YAkBV,WAAW;YAyDX,gBAAgB;IAqD9B,OAAO,CAAC,WAAW;CAUpB"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Federation forwarder per DELIVERY.md §5 and HANDSHAKE.md §5.
|
|
3
|
+
*
|
|
4
|
+
* Establishes and caches federation sessions to remote peers and
|
|
5
|
+
* forwards envelopes across them. Each `(localDomain, peerDomain)`
|
|
6
|
+
* pair gets at most one live session at a time; the forwarder
|
|
7
|
+
* re-runs the federation handshake if the cached session has
|
|
8
|
+
* expired or been torn down.
|
|
9
|
+
*
|
|
10
|
+
* On forward, the forwarder:
|
|
11
|
+
*
|
|
12
|
+
* 1. Updates `postmark.session_id` to reference the federation
|
|
13
|
+
* session id (so the peer's receive pipeline matches).
|
|
14
|
+
* 2. Re-signs the envelope with the local domain key and
|
|
15
|
+
* recomputes `seal.session_mac` under the federation
|
|
16
|
+
* session's `K_env_mac`.
|
|
17
|
+
* 3. Sends the encoded envelope over the federation transport.
|
|
18
|
+
* 4. Returns the peer's parsed {@link SubmissionResponse}.
|
|
19
|
+
*
|
|
20
|
+
* The original sender's domain proof of provenance does NOT need
|
|
21
|
+
* to be preserved separately — in the SEMP architecture the
|
|
22
|
+
* sender's home server and the federation initiator are the SAME
|
|
23
|
+
* server, so re-signing with the local domain key is functionally
|
|
24
|
+
* identical to "the sender's domain signed this envelope".
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
import { marshal as canonicalMarshal } from "../canonical/index.js";
|
|
29
|
+
import { computeMAC } from "../crypto/index.js";
|
|
30
|
+
import { canonicalEnvelopeFor, encodeEnvelope, } from "../envelope/index.js";
|
|
31
|
+
import { sign as ed25519Sign } from "../keys/index.js";
|
|
32
|
+
import { FederationInitiator, } from "../handshake/index.js";
|
|
33
|
+
/** Domain-separation prefix for the seal signature, per §4.3. */
|
|
34
|
+
const EnvelopePrefix = "SEMP-ENVELOPE:";
|
|
35
|
+
/** Domain → {@link PeerConfig} map. */
|
|
36
|
+
export class PeerRegistry {
|
|
37
|
+
peers = new Map();
|
|
38
|
+
put(cfg) {
|
|
39
|
+
if (cfg.domain === "") {
|
|
40
|
+
throw new Error("delivery: PeerConfig missing domain");
|
|
41
|
+
}
|
|
42
|
+
this.peers.set(cfg.domain, { ...cfg });
|
|
43
|
+
}
|
|
44
|
+
lookup(domain) {
|
|
45
|
+
return this.peers.get(domain) ?? null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Federation forwarder.
|
|
50
|
+
*
|
|
51
|
+
* `forward()` is concurrency-safe: per-peer wire access is
|
|
52
|
+
* serialized by a software lock so concurrent calls don't
|
|
53
|
+
* interleave on the same stream. Use {@link Forwarder.close} on
|
|
54
|
+
* shutdown to tear down every cached session.
|
|
55
|
+
*/
|
|
56
|
+
export class Forwarder {
|
|
57
|
+
cfg;
|
|
58
|
+
sessions = new Map();
|
|
59
|
+
connecting = new Map();
|
|
60
|
+
constructor(cfg) {
|
|
61
|
+
if (cfg.localDomain === "") {
|
|
62
|
+
throw new Error("delivery: forwarder empty localDomain");
|
|
63
|
+
}
|
|
64
|
+
if (cfg.localServerID === "") {
|
|
65
|
+
throw new Error("delivery: forwarder empty localServerID");
|
|
66
|
+
}
|
|
67
|
+
if (cfg.localDomainSeed.length === 0) {
|
|
68
|
+
throw new Error("delivery: forwarder empty localDomainSeed");
|
|
69
|
+
}
|
|
70
|
+
this.cfg = cfg;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Re-bind `seal.session_mac` under the federation session's
|
|
74
|
+
* `K_env_mac` and ship `env` across the cached session for
|
|
75
|
+
* `peerDomain`. Returns the peer's parsed submission response.
|
|
76
|
+
*
|
|
77
|
+
* Opens a federation session lazily on first call per peer.
|
|
78
|
+
*/
|
|
79
|
+
async forward(peerDomain, env) {
|
|
80
|
+
const cfg = this.cfg.peers.lookup(peerDomain);
|
|
81
|
+
if (cfg === null) {
|
|
82
|
+
throw new Error(`delivery: forwarder: unknown peer ${peerDomain}`);
|
|
83
|
+
}
|
|
84
|
+
const fs = await this.getSession(cfg);
|
|
85
|
+
try {
|
|
86
|
+
return await this.forwardOnSession(fs, env);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
// Drop the session on transport-layer failure; next call
|
|
90
|
+
// re-handshakes.
|
|
91
|
+
this.dropSession(peerDomain);
|
|
92
|
+
throw err;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** Tear down every cached session. Call on shutdown. */
|
|
96
|
+
async close() {
|
|
97
|
+
const sessions = Array.from(this.sessions.values());
|
|
98
|
+
this.sessions.clear();
|
|
99
|
+
for (const fs of sessions) {
|
|
100
|
+
try {
|
|
101
|
+
await fs.transport.close();
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// best-effort
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** Diagnostic: peer domains with a live cached session. */
|
|
109
|
+
cachedPeers() {
|
|
110
|
+
return Array.from(this.sessions.keys()).sort();
|
|
111
|
+
}
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
async getSession(cfg) {
|
|
114
|
+
const cached = this.sessions.get(cfg.domain);
|
|
115
|
+
if (cached !== undefined) {
|
|
116
|
+
return cached;
|
|
117
|
+
}
|
|
118
|
+
// Coalesce concurrent connects so we don't open two sessions to
|
|
119
|
+
// the same peer in parallel.
|
|
120
|
+
const inflight = this.connecting.get(cfg.domain);
|
|
121
|
+
if (inflight !== undefined) {
|
|
122
|
+
return inflight;
|
|
123
|
+
}
|
|
124
|
+
const p = this.openSession(cfg).finally(() => {
|
|
125
|
+
this.connecting.delete(cfg.domain);
|
|
126
|
+
});
|
|
127
|
+
this.connecting.set(cfg.domain, p);
|
|
128
|
+
return p;
|
|
129
|
+
}
|
|
130
|
+
async openSession(cfg) {
|
|
131
|
+
const transport = await this.cfg.dial(cfg.endpoint);
|
|
132
|
+
const initiator = new FederationInitiator({
|
|
133
|
+
suite: "x25519-chacha20-poly1305",
|
|
134
|
+
capabilities: this.cfg.capabilities ?? {
|
|
135
|
+
encryption_algorithms: ["x25519-chacha20-poly1305"],
|
|
136
|
+
extensions: [],
|
|
137
|
+
},
|
|
138
|
+
localDomain: this.cfg.localDomain,
|
|
139
|
+
localServerID: this.cfg.localServerID,
|
|
140
|
+
localDomainSeed: this.cfg.localDomainSeed,
|
|
141
|
+
peerDomainPubLookup: (d) => {
|
|
142
|
+
if (d !== cfg.domain) {
|
|
143
|
+
throw new Error(`forwarder: peer domain pub lookup for unknown domain ${d}`);
|
|
144
|
+
}
|
|
145
|
+
return cfg.domainSigningPub;
|
|
146
|
+
},
|
|
147
|
+
peerDomain: cfg.domain,
|
|
148
|
+
domainProof: { method: "test-trust", data: this.cfg.localDomain },
|
|
149
|
+
...(this.cfg.policyAcceptor !== undefined
|
|
150
|
+
? { policyAcceptor: this.cfg.policyAcceptor }
|
|
151
|
+
: {}),
|
|
152
|
+
});
|
|
153
|
+
try {
|
|
154
|
+
const initBytes = initiator.init();
|
|
155
|
+
await transport.send(initBytes);
|
|
156
|
+
const respBytes = await transport.receive();
|
|
157
|
+
if (respBytes === null) {
|
|
158
|
+
throw new Error("forwarder: connection closed waiting for response");
|
|
159
|
+
}
|
|
160
|
+
const confirmBytes = initiator.onResponse(respBytes);
|
|
161
|
+
await transport.send(confirmBytes);
|
|
162
|
+
const acceptedBytes = await transport.receive();
|
|
163
|
+
if (acceptedBytes === null) {
|
|
164
|
+
throw new Error("forwarder: connection closed waiting for accepted");
|
|
165
|
+
}
|
|
166
|
+
initiator.onAccepted(acceptedBytes);
|
|
167
|
+
const session = initiator.session();
|
|
168
|
+
const fs = {
|
|
169
|
+
transport,
|
|
170
|
+
session,
|
|
171
|
+
wireMu: { locked: false },
|
|
172
|
+
};
|
|
173
|
+
this.sessions.set(cfg.domain, fs);
|
|
174
|
+
return fs;
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
try {
|
|
178
|
+
await transport.close();
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
// already closed
|
|
182
|
+
}
|
|
183
|
+
throw err;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async forwardOnSession(fs, env) {
|
|
187
|
+
// Serialize wire access — JS run-to-completion makes this a soft
|
|
188
|
+
// latch sufficient for the single-thread model.
|
|
189
|
+
while (fs.wireMu.locked) {
|
|
190
|
+
await new Promise((r) => setTimeout(r, 0));
|
|
191
|
+
}
|
|
192
|
+
fs.wireMu.locked = true;
|
|
193
|
+
try {
|
|
194
|
+
// Update postmark.session_id so the peer's pipeline matches.
|
|
195
|
+
env.postmark.session_id = fs.session.sessionId;
|
|
196
|
+
// Re-sign with our local domain key + re-MAC under federation
|
|
197
|
+
// K_env_mac. Both proofs cover the SAME canonical bytes (with
|
|
198
|
+
// signature + mac blanked).
|
|
199
|
+
env.seal.signature = "";
|
|
200
|
+
env.seal.session_mac = "";
|
|
201
|
+
const canonical = canonicalEnvelopeFor(env);
|
|
202
|
+
const signingInput = concat(new TextEncoder().encode(EnvelopePrefix), canonical);
|
|
203
|
+
env.seal.signature = base64Encode(ed25519Sign(this.cfg.localDomainSeed, signingInput));
|
|
204
|
+
env.seal.session_mac = base64Encode(computeMAC(fs.session.keys.envMAC, canonical));
|
|
205
|
+
const wire = encodeEnvelope(env);
|
|
206
|
+
await fs.transport.send(wire);
|
|
207
|
+
const respBytes = await fs.transport.receive();
|
|
208
|
+
if (respBytes === null) {
|
|
209
|
+
throw new Error("forwarder: connection closed waiting for federation response");
|
|
210
|
+
}
|
|
211
|
+
const parsed = JSON.parse(new TextDecoder().decode(respBytes));
|
|
212
|
+
if (typeof parsed !== "object" ||
|
|
213
|
+
parsed === null ||
|
|
214
|
+
Array.isArray(parsed)) {
|
|
215
|
+
throw new Error("forwarder: federation response is not a JSON object");
|
|
216
|
+
}
|
|
217
|
+
return parsed;
|
|
218
|
+
}
|
|
219
|
+
finally {
|
|
220
|
+
fs.wireMu.locked = false;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
dropSession(peerDomain) {
|
|
224
|
+
const fs = this.sessions.get(peerDomain);
|
|
225
|
+
if (fs === undefined) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
this.sessions.delete(peerDomain);
|
|
229
|
+
fs.transport.close().catch(() => {
|
|
230
|
+
// best-effort
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
void canonicalMarshal;
|
|
235
|
+
function concat(a, b) {
|
|
236
|
+
const out = new Uint8Array(a.length + b.length);
|
|
237
|
+
out.set(a, 0);
|
|
238
|
+
out.set(b, a.length);
|
|
239
|
+
return out;
|
|
240
|
+
}
|
|
241
|
+
function base64Encode(b) {
|
|
242
|
+
if (typeof Buffer !== "undefined") {
|
|
243
|
+
return Buffer.from(b).toString("base64");
|
|
244
|
+
}
|
|
245
|
+
let bin = "";
|
|
246
|
+
for (let i = 0; i < b.length; i++) {
|
|
247
|
+
bin += String.fromCharCode(b[i] ?? 0);
|
|
248
|
+
}
|
|
249
|
+
return btoa(bin);
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=forwarder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forwarder.js","sourceRoot":"","sources":["../../src/delivery/forwarder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAEL,oBAAoB,EACpB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,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AC,EAAE,CAAC,CAAC,CAAC;IACd,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IACrB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,YAAY,CAAC,CAAa;IACjC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference per-user envelope inbox — minimal in-memory FIFO.
|
|
3
|
+
*
|
|
4
|
+
* Intended for in-process tests, embedded servers, and the
|
|
5
|
+
* reference {@link "./fetch".FetchResponse} producer. NOT a
|
|
6
|
+
* production storage layer:
|
|
7
|
+
*
|
|
8
|
+
* - No persistence: process restart loses all queued envelopes.
|
|
9
|
+
* - No fairness controls, no per-address access control, no
|
|
10
|
+
* retention rules.
|
|
11
|
+
* - Concurrency boundary is single-process; multi-writer use is
|
|
12
|
+
* safe under the JavaScript run-to-completion model but not
|
|
13
|
+
* across worker threads.
|
|
14
|
+
*
|
|
15
|
+
* Production deployments MUST back this with a durable store,
|
|
16
|
+
* retention rules, fairness controls, and per-address access
|
|
17
|
+
* control — none of which are present here.
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
/** Default maximum per-address queue depth. */
|
|
22
|
+
export declare const DefaultMaxQueueDepth = 10000;
|
|
23
|
+
/** Reference in-memory inbox keyed by canonical user@domain string. */
|
|
24
|
+
export declare class Inbox {
|
|
25
|
+
private readonly queues;
|
|
26
|
+
private readonly maxDepth;
|
|
27
|
+
constructor(maxDepth?: number);
|
|
28
|
+
/**
|
|
29
|
+
* Append `payload` to the queue for `address`. If the queue is at
|
|
30
|
+
* its maximum depth, the oldest entry is dropped to make room.
|
|
31
|
+
*/
|
|
32
|
+
store(address: string, payload: Uint8Array): void;
|
|
33
|
+
/**
|
|
34
|
+
* Return every queued envelope for `address` and clear the queue.
|
|
35
|
+
* Returns an empty array when the address has no waiting
|
|
36
|
+
* envelopes.
|
|
37
|
+
*/
|
|
38
|
+
drain(address: string): Uint8Array[];
|
|
39
|
+
/** Number of waiting envelopes for `address`. */
|
|
40
|
+
pending(address: string): number;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=inbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/delivery/inbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+CAA+C;AAC/C,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C,uEAAuE;AACvE,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;IAC1D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,QAAQ,GAAE,MAA6B;IAQnD;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI;IAejD;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,EAAE;IAMpC,iDAAiD;IACjD,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAGjC"}
|