@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SEMP Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# semp
|
|
2
|
+
|
|
3
|
+
TypeScript implementation of [SEMP](https://github.com/semp-dev/semp-spec)
|
|
4
|
+
(Sealed Envelope Messaging Protocol). Compiles to plain JavaScript with
|
|
5
|
+
TypeScript declaration files; the published npm package serves both
|
|
6
|
+
JavaScript and TypeScript callers from the same artifact.
|
|
7
|
+
|
|
8
|
+
Targets Node.js (>=20) and modern browsers. The crypto stack is the
|
|
9
|
+
audited [@noble](https://github.com/paulmillr/noble) suite end to end:
|
|
10
|
+
no native bindings, pure-JS, browser-compatible.
|
|
11
|
+
|
|
12
|
+
## Status
|
|
13
|
+
|
|
14
|
+
Pre-1.0 development. Implementation tracks the [`semp-spec`](https://github.com/semp-dev/semp-spec)
|
|
15
|
+
test vectors at `vectors/v1.0.0/`. Conformance is gated on the cross-language
|
|
16
|
+
vectors-runner under `test/vectors/`; a build is interop-ready when the
|
|
17
|
+
runner reports all vectors green.
|
|
18
|
+
|
|
19
|
+
| Layer | Coverage |
|
|
20
|
+
|-------|----------|
|
|
21
|
+
| 1 (cryptographic primitives) | scaffolding |
|
|
22
|
+
| 2 (deterministic protocol) | TODO |
|
|
23
|
+
| 3 (envelope round-trip) | TODO |
|
|
24
|
+
| 4 (handshake messages) | TODO |
|
|
25
|
+
| 5 (signed documents) | TODO |
|
|
26
|
+
|
|
27
|
+
## Repository layout
|
|
28
|
+
|
|
29
|
+
Each `src/<layer>/` mirrors the corresponding semp-go package so anyone
|
|
30
|
+
fluent in one can read the other.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
src/
|
|
34
|
+
crypto/ (Layer 1 primitives: HKDF, HMAC, AEAD, KEM, signatures)
|
|
35
|
+
... (more as layers land)
|
|
36
|
+
test/
|
|
37
|
+
vectors/ (JSON-driven cross-language vectors runner)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Development
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm install
|
|
44
|
+
npm test # run vitest once
|
|
45
|
+
npm run test:watch # watch mode
|
|
46
|
+
npm run typecheck # strict tsc, no emit
|
|
47
|
+
npm run build # emit .js + .d.ts to dist/
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The vectors runner expects `semp-spec/vectors/v1.0.0/` as a sibling
|
|
51
|
+
checkout, or `SEMP_VECTORS_DIR` set explicitly:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
SEMP_VECTORS_DIR=/path/to/semp-spec/vectors/v1.0.0 npm test
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SEMP user address per ENVELOPE.md §2.3.
|
|
3
|
+
*
|
|
4
|
+
* The wire form is `local-part@domain`:
|
|
5
|
+
* - Local-part: Unicode NFC, case-sensitive on the wire, ≤64 bytes.
|
|
6
|
+
* - Domain: A-label (Punycode) per IDNA2008, ASCII-only, lowercase
|
|
7
|
+
* on the wire, ≤253 bytes, ≤63 bytes per DNS label.
|
|
8
|
+
*
|
|
9
|
+
* {@link validateAddress} enforces the canonical form at ingress;
|
|
10
|
+
* {@link canonicalizeAddress} converts possibly-denormalized input
|
|
11
|
+
* (mixed-case domain, U-label domain, non-NFC local-part) to the
|
|
12
|
+
* canonical wire form.
|
|
13
|
+
*
|
|
14
|
+
* IDNA2008 conversion uses Node's built-in `URL.domainToASCII` (which
|
|
15
|
+
* implements WHATWG URL's IDNA, a strict superset of RFC 5891).
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
/** Cap on the composed `local-part@domain` per §2.3.3 / RFC 5321. */
|
|
20
|
+
export declare const MaxAddressLength = 254;
|
|
21
|
+
/** Cap on the local-part per RFC 5321 §4.5.3.1.1. */
|
|
22
|
+
export declare const MaxLocalPartLength = 64;
|
|
23
|
+
/** DNS total-length ceiling per RFC 1035. */
|
|
24
|
+
export declare const MaxDomainLength = 253;
|
|
25
|
+
/** DNS per-label ceiling per RFC 1035. */
|
|
26
|
+
export declare const MaxDomainLabelLength = 63;
|
|
27
|
+
/**
|
|
28
|
+
* Return the local part of `addr` (everything before the final `@`).
|
|
29
|
+
* Returns the entire string if no `@` is present. Operates on raw
|
|
30
|
+
* bytes without validation.
|
|
31
|
+
*/
|
|
32
|
+
export declare function addressLocal(addr: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Return the domain part of `addr` (everything after the final `@`).
|
|
35
|
+
* Returns the empty string if no `@` is present.
|
|
36
|
+
*/
|
|
37
|
+
export declare function addressDomain(addr: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Validate `addr` against the canonical wire form per §2.3:
|
|
40
|
+
*
|
|
41
|
+
* - Non-empty, valid UTF-8 (always true for JS strings — included
|
|
42
|
+
* for symmetry with semp-go).
|
|
43
|
+
* - Composed length ≤ {@link MaxAddressLength} bytes.
|
|
44
|
+
* - No control characters (C0, DEL, C1).
|
|
45
|
+
* - Exactly one `@` separator.
|
|
46
|
+
* - Local-part non-empty, ≤ {@link MaxLocalPartLength} bytes, in
|
|
47
|
+
* Unicode NFC.
|
|
48
|
+
* - Domain non-empty, ≤ {@link MaxDomainLength} bytes, ASCII-only,
|
|
49
|
+
* lowercase, well-formed DNS labels.
|
|
50
|
+
*
|
|
51
|
+
* Throws on the first violation. Pair with {@link canonicalizeAddress}
|
|
52
|
+
* if the input may be denormalized.
|
|
53
|
+
*/
|
|
54
|
+
export declare function validateAddress(addr: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Return `addr` in canonical wire form:
|
|
57
|
+
*
|
|
58
|
+
* - Local-part normalized to Unicode NFC.
|
|
59
|
+
* - Domain converted to A-label (Punycode) per IDNA2008, folded to
|
|
60
|
+
* lowercase.
|
|
61
|
+
*
|
|
62
|
+
* Does NOT enforce length or character bounds; pair with
|
|
63
|
+
* {@link validateAddress} on the returned value when ingesting
|
|
64
|
+
* untrusted input.
|
|
65
|
+
*/
|
|
66
|
+
export declare function canonicalizeAddress(addr: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Report whether `a` and `b` denote the same address after
|
|
69
|
+
* canonicalization. Returns false if either side fails
|
|
70
|
+
* canonicalization.
|
|
71
|
+
*
|
|
72
|
+
* Does NOT collapse visually-similar (confusable) characters.
|
|
73
|
+
* Confusables defense is a UI-layer concern per Unicode Technical
|
|
74
|
+
* Standard #39.
|
|
75
|
+
*/
|
|
76
|
+
export declare function addressEqual(a: string, b: string): boolean;
|
|
77
|
+
//# sourceMappingURL=address.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/brief/address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,qDAAqD;AACrD,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,6CAA6C;AAC7C,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,0CAA0C;AAC1C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAiClD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAc1D"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SEMP user address per ENVELOPE.md §2.3.
|
|
3
|
+
*
|
|
4
|
+
* The wire form is `local-part@domain`:
|
|
5
|
+
* - Local-part: Unicode NFC, case-sensitive on the wire, ≤64 bytes.
|
|
6
|
+
* - Domain: A-label (Punycode) per IDNA2008, ASCII-only, lowercase
|
|
7
|
+
* on the wire, ≤253 bytes, ≤63 bytes per DNS label.
|
|
8
|
+
*
|
|
9
|
+
* {@link validateAddress} enforces the canonical form at ingress;
|
|
10
|
+
* {@link canonicalizeAddress} converts possibly-denormalized input
|
|
11
|
+
* (mixed-case domain, U-label domain, non-NFC local-part) to the
|
|
12
|
+
* canonical wire form.
|
|
13
|
+
*
|
|
14
|
+
* IDNA2008 conversion uses Node's built-in `URL.domainToASCII` (which
|
|
15
|
+
* implements WHATWG URL's IDNA, a strict superset of RFC 5891).
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import { domainToASCII } from "node:url";
|
|
20
|
+
/** Cap on the composed `local-part@domain` per §2.3.3 / RFC 5321. */
|
|
21
|
+
export const MaxAddressLength = 254;
|
|
22
|
+
/** Cap on the local-part per RFC 5321 §4.5.3.1.1. */
|
|
23
|
+
export const MaxLocalPartLength = 64;
|
|
24
|
+
/** DNS total-length ceiling per RFC 1035. */
|
|
25
|
+
export const MaxDomainLength = 253;
|
|
26
|
+
/** DNS per-label ceiling per RFC 1035. */
|
|
27
|
+
export const MaxDomainLabelLength = 63;
|
|
28
|
+
/**
|
|
29
|
+
* Return the local part of `addr` (everything before the final `@`).
|
|
30
|
+
* Returns the entire string if no `@` is present. Operates on raw
|
|
31
|
+
* bytes without validation.
|
|
32
|
+
*/
|
|
33
|
+
export function addressLocal(addr) {
|
|
34
|
+
const at = addr.lastIndexOf("@");
|
|
35
|
+
if (at < 0) {
|
|
36
|
+
return addr;
|
|
37
|
+
}
|
|
38
|
+
return addr.slice(0, at);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Return the domain part of `addr` (everything after the final `@`).
|
|
42
|
+
* Returns the empty string if no `@` is present.
|
|
43
|
+
*/
|
|
44
|
+
export function addressDomain(addr) {
|
|
45
|
+
const at = addr.lastIndexOf("@");
|
|
46
|
+
if (at < 0) {
|
|
47
|
+
return "";
|
|
48
|
+
}
|
|
49
|
+
return addr.slice(at + 1);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Validate `addr` against the canonical wire form per §2.3:
|
|
53
|
+
*
|
|
54
|
+
* - Non-empty, valid UTF-8 (always true for JS strings — included
|
|
55
|
+
* for symmetry with semp-go).
|
|
56
|
+
* - Composed length ≤ {@link MaxAddressLength} bytes.
|
|
57
|
+
* - No control characters (C0, DEL, C1).
|
|
58
|
+
* - Exactly one `@` separator.
|
|
59
|
+
* - Local-part non-empty, ≤ {@link MaxLocalPartLength} bytes, in
|
|
60
|
+
* Unicode NFC.
|
|
61
|
+
* - Domain non-empty, ≤ {@link MaxDomainLength} bytes, ASCII-only,
|
|
62
|
+
* lowercase, well-formed DNS labels.
|
|
63
|
+
*
|
|
64
|
+
* Throws on the first violation. Pair with {@link canonicalizeAddress}
|
|
65
|
+
* if the input may be denormalized.
|
|
66
|
+
*/
|
|
67
|
+
export function validateAddress(addr) {
|
|
68
|
+
if (addr === "") {
|
|
69
|
+
throw new Error("brief: empty address");
|
|
70
|
+
}
|
|
71
|
+
const byteLen = utf8ByteLength(addr);
|
|
72
|
+
if (byteLen > MaxAddressLength) {
|
|
73
|
+
throw new Error(`brief: address exceeds ${MaxAddressLength} bytes`);
|
|
74
|
+
}
|
|
75
|
+
rejectControlChars(addr, "address");
|
|
76
|
+
// SplitN(s, "@", 3) semantics: catch zero-or-multiple `@`.
|
|
77
|
+
const firstAt = addr.indexOf("@");
|
|
78
|
+
if (firstAt < 0) {
|
|
79
|
+
throw new Error("brief: address missing '@' separator");
|
|
80
|
+
}
|
|
81
|
+
const lastAt = addr.lastIndexOf("@");
|
|
82
|
+
if (firstAt !== lastAt) {
|
|
83
|
+
throw new Error("brief: address contains multiple '@' separators");
|
|
84
|
+
}
|
|
85
|
+
const local = addr.slice(0, firstAt);
|
|
86
|
+
const domain = addr.slice(firstAt + 1);
|
|
87
|
+
if (local === "") {
|
|
88
|
+
throw new Error("brief: address has empty local part");
|
|
89
|
+
}
|
|
90
|
+
if (utf8ByteLength(local) > MaxLocalPartLength) {
|
|
91
|
+
throw new Error(`brief: local part exceeds ${MaxLocalPartLength} bytes`);
|
|
92
|
+
}
|
|
93
|
+
if (local.normalize("NFC") !== local) {
|
|
94
|
+
throw new Error("brief: local part is not in Unicode Normalization Form C");
|
|
95
|
+
}
|
|
96
|
+
validateDomain(domain);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Return `addr` in canonical wire form:
|
|
100
|
+
*
|
|
101
|
+
* - Local-part normalized to Unicode NFC.
|
|
102
|
+
* - Domain converted to A-label (Punycode) per IDNA2008, folded to
|
|
103
|
+
* lowercase.
|
|
104
|
+
*
|
|
105
|
+
* Does NOT enforce length or character bounds; pair with
|
|
106
|
+
* {@link validateAddress} on the returned value when ingesting
|
|
107
|
+
* untrusted input.
|
|
108
|
+
*/
|
|
109
|
+
export function canonicalizeAddress(addr) {
|
|
110
|
+
if (addr === "") {
|
|
111
|
+
throw new Error("brief: empty address");
|
|
112
|
+
}
|
|
113
|
+
const firstAt = addr.indexOf("@");
|
|
114
|
+
if (firstAt < 0) {
|
|
115
|
+
throw new Error("brief: address missing '@' separator");
|
|
116
|
+
}
|
|
117
|
+
const lastAt = addr.lastIndexOf("@");
|
|
118
|
+
if (firstAt !== lastAt) {
|
|
119
|
+
throw new Error("brief: address contains multiple '@' separators");
|
|
120
|
+
}
|
|
121
|
+
const local = addr.slice(0, firstAt).normalize("NFC");
|
|
122
|
+
const domain = addr.slice(firstAt + 1);
|
|
123
|
+
const aLabel = domainToASCII(domain);
|
|
124
|
+
if (aLabel === "") {
|
|
125
|
+
throw new Error(`brief: domain ${JSON.stringify(domain)} cannot be converted to A-label`);
|
|
126
|
+
}
|
|
127
|
+
return local + "@" + aLabel.toLowerCase();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Report whether `a` and `b` denote the same address after
|
|
131
|
+
* canonicalization. Returns false if either side fails
|
|
132
|
+
* canonicalization.
|
|
133
|
+
*
|
|
134
|
+
* Does NOT collapse visually-similar (confusable) characters.
|
|
135
|
+
* Confusables defense is a UI-layer concern per Unicode Technical
|
|
136
|
+
* Standard #39.
|
|
137
|
+
*/
|
|
138
|
+
export function addressEqual(a, b) {
|
|
139
|
+
let aa;
|
|
140
|
+
let bb;
|
|
141
|
+
try {
|
|
142
|
+
aa = canonicalizeAddress(a);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
bb = canonicalizeAddress(b);
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
return aa === bb;
|
|
154
|
+
}
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
// Internal helpers
|
|
157
|
+
/** Reject any C0 (U+0000-U+001F), DEL (U+007F), or C1 (U+0080-U+009F). */
|
|
158
|
+
function rejectControlChars(s, field) {
|
|
159
|
+
for (let i = 0; i < s.length; i++) {
|
|
160
|
+
const cp = s.codePointAt(i);
|
|
161
|
+
if (cp === undefined) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (cp < 0x20 || cp === 0x7f || (cp >= 0x80 && cp <= 0x9f)) {
|
|
165
|
+
throw new Error(`brief: ${field} contains control character U+${cp.toString(16).toUpperCase().padStart(4, "0")} at byte ${i}`);
|
|
166
|
+
}
|
|
167
|
+
if (cp > 0xffff) {
|
|
168
|
+
i++; // step past the surrogate pair's low half
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function validateDomain(domain) {
|
|
173
|
+
if (domain === "") {
|
|
174
|
+
throw new Error("brief: address has empty domain");
|
|
175
|
+
}
|
|
176
|
+
if (domain.length > MaxDomainLength) {
|
|
177
|
+
throw new Error(`brief: domain exceeds ${MaxDomainLength} bytes`);
|
|
178
|
+
}
|
|
179
|
+
for (let i = 0; i < domain.length; i++) {
|
|
180
|
+
const c = domain.charCodeAt(i);
|
|
181
|
+
if (c > 0x7f) {
|
|
182
|
+
throw new Error("brief: domain contains non-ASCII octet (A-label required on the wire)");
|
|
183
|
+
}
|
|
184
|
+
if (c >= 0x41 && c <= 0x5a) {
|
|
185
|
+
throw new Error("brief: domain contains uppercase letters (must be lowercase on the wire)");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (domain.startsWith(".") || domain.endsWith(".")) {
|
|
189
|
+
throw new Error("brief: domain has leading or trailing dot");
|
|
190
|
+
}
|
|
191
|
+
if (domain.includes("..")) {
|
|
192
|
+
throw new Error("brief: domain has empty label (consecutive dots)");
|
|
193
|
+
}
|
|
194
|
+
for (const label of domain.split(".")) {
|
|
195
|
+
if (label === "") {
|
|
196
|
+
throw new Error("brief: domain has empty label");
|
|
197
|
+
}
|
|
198
|
+
if (label.length > MaxDomainLabelLength) {
|
|
199
|
+
throw new Error(`brief: domain label ${JSON.stringify(label)} exceeds ${MaxDomainLabelLength} bytes`);
|
|
200
|
+
}
|
|
201
|
+
if (label.startsWith("-") || label.endsWith("-")) {
|
|
202
|
+
throw new Error(`brief: domain label ${JSON.stringify(label)} has leading or trailing hyphen`);
|
|
203
|
+
}
|
|
204
|
+
for (const r of label) {
|
|
205
|
+
if (r === "@" || r === " " || r === "\t") {
|
|
206
|
+
throw new Error(`brief: domain label ${JSON.stringify(label)} contains disallowed character`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function utf8ByteLength(s) {
|
|
212
|
+
if (typeof Buffer !== "undefined") {
|
|
213
|
+
return Buffer.byteLength(s, "utf8");
|
|
214
|
+
}
|
|
215
|
+
return new TextEncoder().encode(s).length;
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src/brief/address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC,qDAAqD;AACrD,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,6CAA6C;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,EAAE,GAAG,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C;QACJ,CAAC;QACD,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,KAAK,CACb,uBAAuB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iCAAiC,CAC9E,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;gBACzC,MAAM,IAAI,KAAK,CACb,uBAAuB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,gCAAgC,CAC7E,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,CAAS;IAC/B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decrypted form of `envelope.brief` per ENVELOPE.md §5.1.
|
|
3
|
+
*
|
|
4
|
+
* The brief is encrypted in transit under K_brief; this module
|
|
5
|
+
* provides the typed shape of the JSON payload after decryption,
|
|
6
|
+
* plus the {@link splitForBCC} helper that materializes BCC
|
|
7
|
+
* recipients into per-recipient envelope copies (CLIENT.md §3.5,
|
|
8
|
+
* ENVELOPE.md §5.3).
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** Decrypted brief payload. */
|
|
13
|
+
export interface Brief {
|
|
14
|
+
/**
|
|
15
|
+
* Globally unique message identifier. Distinct from
|
|
16
|
+
* `postmark.id`, which is a per-transaction routing id.
|
|
17
|
+
*/
|
|
18
|
+
message_id: string;
|
|
19
|
+
/** Full sender address (canonical form per §2.3). */
|
|
20
|
+
from: string;
|
|
21
|
+
/** Primary recipient addresses. */
|
|
22
|
+
to: string[];
|
|
23
|
+
/** Optional carbon copy recipients. */
|
|
24
|
+
cc?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* For an envelope copy delivered to a specific BCC recipient,
|
|
27
|
+
* contains only that recipient's address. MUST be absent from
|
|
28
|
+
* envelope copies delivered to to/cc recipients.
|
|
29
|
+
*/
|
|
30
|
+
bcc?: string[];
|
|
31
|
+
/** Optional address that replies should target instead of `from`. */
|
|
32
|
+
reply_to?: string;
|
|
33
|
+
/** Wall-clock time of message creation at the sender, ISO 8601 UTC. */
|
|
34
|
+
sent_at: string;
|
|
35
|
+
/** Stable identifier of the conversation thread. */
|
|
36
|
+
thread_id?: string;
|
|
37
|
+
/** Group / mailing-list identifier. */
|
|
38
|
+
group_id?: string;
|
|
39
|
+
/** `message_id` of the message being replied to. */
|
|
40
|
+
in_reply_to?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Recipient-server-and-client-visible private metadata extensions.
|
|
43
|
+
*/
|
|
44
|
+
extensions?: Record<string, unknown>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Materialize a {@link Brief} with BCC recipients into the set of
|
|
48
|
+
* per-recipient copies required by CLIENT.md §3.5 and ENVELOPE.md
|
|
49
|
+
* §5.3.
|
|
50
|
+
*
|
|
51
|
+
* SEMP's privacy model forbids server-side BCC stripping: a sending
|
|
52
|
+
* client MUST generate one distinct envelope copy per BCC recipient
|
|
53
|
+
* so that the `bcc` field contains only that recipient's address in
|
|
54
|
+
* each copy, and is absent entirely from the copy delivered to
|
|
55
|
+
* to/cc recipients. The sending server never sees the full BCC
|
|
56
|
+
* list.
|
|
57
|
+
*
|
|
58
|
+
* Returned copies:
|
|
59
|
+
*
|
|
60
|
+
* 1. If `b.bcc` is empty or undefined, returns `[b]` — a single
|
|
61
|
+
* copy, returned unchanged.
|
|
62
|
+
*
|
|
63
|
+
* 2. Otherwise, returns `b.bcc.length + 1` elements:
|
|
64
|
+
* - One "visible" copy for to + cc recipients, with `bcc`
|
|
65
|
+
* removed entirely.
|
|
66
|
+
* - One copy per original BCC recipient, each carrying that
|
|
67
|
+
* single address in `bcc`. All other fields are preserved so
|
|
68
|
+
* each recipient sees the same primary recipient list.
|
|
69
|
+
*
|
|
70
|
+
* The returned briefs share the underlying `extensions` map and
|
|
71
|
+
* address arrays with the input by reference. Callers that mutate
|
|
72
|
+
* a copy independently should clone first.
|
|
73
|
+
*/
|
|
74
|
+
export declare function splitForBCC(b: Brief): Brief[];
|
|
75
|
+
//# sourceMappingURL=brief.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief.d.ts","sourceRoot":"","sources":["../../src/brief/brief.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,+BAA+B;AAC/B,MAAM,WAAW,KAAK;IACpB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IAEb,mCAAmC;IACnC,EAAE,EAAE,MAAM,EAAE,CAAC;IAEb,uCAAuC;IACvC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IAEd;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IAEf,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAEhB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,CAkB7C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decrypted form of `envelope.brief` per ENVELOPE.md §5.1.
|
|
3
|
+
*
|
|
4
|
+
* The brief is encrypted in transit under K_brief; this module
|
|
5
|
+
* provides the typed shape of the JSON payload after decryption,
|
|
6
|
+
* plus the {@link splitForBCC} helper that materializes BCC
|
|
7
|
+
* recipients into per-recipient envelope copies (CLIENT.md §3.5,
|
|
8
|
+
* ENVELOPE.md §5.3).
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Materialize a {@link Brief} with BCC recipients into the set of
|
|
14
|
+
* per-recipient copies required by CLIENT.md §3.5 and ENVELOPE.md
|
|
15
|
+
* §5.3.
|
|
16
|
+
*
|
|
17
|
+
* SEMP's privacy model forbids server-side BCC stripping: a sending
|
|
18
|
+
* client MUST generate one distinct envelope copy per BCC recipient
|
|
19
|
+
* so that the `bcc` field contains only that recipient's address in
|
|
20
|
+
* each copy, and is absent entirely from the copy delivered to
|
|
21
|
+
* to/cc recipients. The sending server never sees the full BCC
|
|
22
|
+
* list.
|
|
23
|
+
*
|
|
24
|
+
* Returned copies:
|
|
25
|
+
*
|
|
26
|
+
* 1. If `b.bcc` is empty or undefined, returns `[b]` — a single
|
|
27
|
+
* copy, returned unchanged.
|
|
28
|
+
*
|
|
29
|
+
* 2. Otherwise, returns `b.bcc.length + 1` elements:
|
|
30
|
+
* - One "visible" copy for to + cc recipients, with `bcc`
|
|
31
|
+
* removed entirely.
|
|
32
|
+
* - One copy per original BCC recipient, each carrying that
|
|
33
|
+
* single address in `bcc`. All other fields are preserved so
|
|
34
|
+
* each recipient sees the same primary recipient list.
|
|
35
|
+
*
|
|
36
|
+
* The returned briefs share the underlying `extensions` map and
|
|
37
|
+
* address arrays with the input by reference. Callers that mutate
|
|
38
|
+
* a copy independently should clone first.
|
|
39
|
+
*/
|
|
40
|
+
export function splitForBCC(b) {
|
|
41
|
+
if (b.bcc === undefined || b.bcc.length === 0) {
|
|
42
|
+
return [b];
|
|
43
|
+
}
|
|
44
|
+
const out = [];
|
|
45
|
+
// Copy 0: visible to/cc recipients. The `bcc` field is removed so
|
|
46
|
+
// the canonical JSON does not include it.
|
|
47
|
+
const visible = { ...b };
|
|
48
|
+
delete visible.bcc;
|
|
49
|
+
out.push(visible);
|
|
50
|
+
// Copies 1..N: one per BCC recipient.
|
|
51
|
+
for (const recipient of b.bcc) {
|
|
52
|
+
out.push({ ...b, bcc: [recipient] });
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=brief.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief.js","sourceRoot":"","sources":["../../src/brief/brief.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA+CH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,WAAW,CAAC,CAAQ;IAClC,IAAI,CAAC,CAAC,GAAG,KAAK,SAAS,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,CAAC,CAAC,CAAC,CAAC;IACb,CAAC;IACD,MAAM,GAAG,GAAY,EAAE,CAAC;IAExB,kEAAkE;IAClE,0CAA0C;IAC1C,MAAM,OAAO,GAAU,EAAE,GAAG,CAAC,EAAE,CAAC;IAChC,OAAO,OAAO,CAAC,GAAG,CAAC;IACnB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAElB,sCAAsC;IACtC,KAAK,MAAM,SAAS,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;QAC9B,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brief layer per ENVELOPE.md §2.3 + §5.1 + §5.3.
|
|
3
|
+
*
|
|
4
|
+
* Address canonicalization, validation, equality, and the typed
|
|
5
|
+
* brief payload shape with the BCC fan-out helper.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
export { MaxAddressLength, MaxDomainLabelLength, MaxDomainLength, MaxLocalPartLength, addressDomain, addressEqual, addressLocal, canonicalizeAddress, validateAddress, } from "./address.js";
|
|
10
|
+
export { type Brief, splitForBCC } from "./brief.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/brief/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brief layer per ENVELOPE.md §2.3 + §5.1 + §5.3.
|
|
3
|
+
*
|
|
4
|
+
* Address canonicalization, validation, equality, and the typed
|
|
5
|
+
* brief payload shape with the BCC fan-out helper.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
export { MaxAddressLength, MaxDomainLabelLength, MaxDomainLength, MaxLocalPartLength, addressDomain, addressEqual, addressLocal, canonicalizeAddress, validateAddress, } from "./address.js";
|
|
10
|
+
export { splitForBCC } from "./brief.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/brief/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAc,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/canonical/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/canonical/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON serialization per ENVELOPE.md §4.3.
|
|
3
|
+
*
|
|
4
|
+
* The canonical form is the byte stream over which signatures and
|
|
5
|
+
* MACs are computed. Two implementations producing different
|
|
6
|
+
* canonical bytes for the same logical document do not interoperate
|
|
7
|
+
* at the seal layer.
|
|
8
|
+
*
|
|
9
|
+
* Rules:
|
|
10
|
+
* - Keys sorted lexicographically at every nesting level.
|
|
11
|
+
* - No insignificant whitespace.
|
|
12
|
+
* - UTF-8 encoding.
|
|
13
|
+
* - Strings escaped per RFC 8259 §7.
|
|
14
|
+
* - Numbers preserved exactly (no reformatting).
|
|
15
|
+
*
|
|
16
|
+
* Per-document elision rules (e.g. blanking `seal.signature`,
|
|
17
|
+
* omitting `postmark.hop_count` and `padding` for envelopes) are
|
|
18
|
+
* applied by callers via {@link marshalWithElision} before this
|
|
19
|
+
* generic marshal sees the value.
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
/** Canonicalize a JSON-serializable value to UTF-8 bytes. */
|
|
24
|
+
export declare function marshal(v: unknown): Uint8Array;
|
|
25
|
+
/**
|
|
26
|
+
* Apply an in-place elision callback to a deep copy of `v`, then
|
|
27
|
+
* canonicalize. The elider can mutate `map[string]any` / `any[]`
|
|
28
|
+
* structures freely — the original is untouched.
|
|
29
|
+
*
|
|
30
|
+
* Use case: envelope canonicalization sets `seal.signature` and
|
|
31
|
+
* `seal.session_mac` to "", omits `postmark.hop_count`, omits
|
|
32
|
+
* `padding` — all by mutating the deep copy before serialization.
|
|
33
|
+
*/
|
|
34
|
+
export declare function marshalWithElision(v: unknown, elide: (clone: unknown) => void): Uint8Array;
|
|
35
|
+
//# sourceMappingURL=marshal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marshal.d.ts","sourceRoot":"","sources":["../../src/canonical/marshal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,6DAA6D;AAC7D,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,UAAU,CAU9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,OAAO,EACV,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAC9B,UAAU,CAQZ"}
|