spec-3nweb-server 1.8.4 → 1.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci-linux.yml +50 -0
- package/.gitlab-ci-mac.yml +29 -0
- package/.gitlab-ci-windows.yml +29 -0
- package/.gitlab-ci.yml +63 -0
- package/build/3nstorage/routes/owner/archive-obj-version.js +2 -2
- package/build/3nstorage/routes/owner/cancel-trans.js +2 -2
- package/build/3nstorage/routes/owner/delete-obj.js +2 -2
- package/build/3nstorage/routes/owner/get-current-obj.js +3 -4
- package/build/3nstorage/routes/owner/param-setter.js +2 -6
- package/build/asmail/routes/config/param-setter.js +2 -2
- package/build/asmail/routes/delivery/finalize-delivery.js +2 -2
- package/build/asmail/routes/delivery/put-obj.js +2 -2
- package/build/asmail/routes/delivery/sender-authorization.js +2 -2
- package/build/asmail/routes/retrieval/remove-message.js +2 -2
- package/build/cli/signup-cmd.js +0 -1
- package/build/lib-server/routes/sessions/close.js +2 -2
- package/build/lib-server/routes/sessions/mid-auth.js +2 -5
- package/build/main.js +12 -15
- package/build/mock/tls-options.js +46 -44
- package/build/signup/routes/add.js +4 -4
- package/build/tests/admin-proto/signup.d.ts +1 -0
- package/build/tests/admin-proto/signup.js +235 -0
- package/build/tests/jasmine.d.ts +1 -0
- package/build/tests/jasmine.js +32 -0
- package/build/tests/libs-for-tests/3nstorage.d.ts +22 -0
- package/build/tests/libs-for-tests/3nstorage.js +123 -0
- package/build/tests/libs-for-tests/asmail.d.ts +22 -0
- package/build/tests/libs-for-tests/asmail.js +179 -0
- package/build/tests/libs-for-tests/assert.d.ts +1 -0
- package/build/tests/libs-for-tests/assert.js +26 -0
- package/build/tests/libs-for-tests/async-jasmine.d.ts +7 -0
- package/build/tests/libs-for-tests/async-jasmine.js +77 -0
- package/build/tests/libs-for-tests/bytes-equal.d.ts +1 -0
- package/build/tests/libs-for-tests/bytes-equal.js +34 -0
- package/build/tests/libs-for-tests/json-copy.d.ts +1 -0
- package/build/tests/libs-for-tests/json-copy.js +45 -0
- package/build/tests/libs-for-tests/json-equal.d.ts +4 -0
- package/build/tests/libs-for-tests/json-equal.js +67 -0
- package/build/tests/libs-for-tests/mailerid.d.ts +13 -0
- package/build/tests/libs-for-tests/mailerid.js +114 -0
- package/build/tests/libs-for-tests/pkl.d.ts +28 -0
- package/build/tests/libs-for-tests/pkl.js +89 -0
- package/build/tests/libs-for-tests/server-components/3nstorage.d.ts +20 -0
- package/build/tests/libs-for-tests/server-components/3nstorage.js +200 -0
- package/build/tests/libs-for-tests/server-components/admin.d.ts +6 -0
- package/build/tests/libs-for-tests/server-components/admin.js +43 -0
- package/build/tests/libs-for-tests/server-components/asmail.d.ts +16 -0
- package/build/tests/libs-for-tests/server-components/asmail.js +143 -0
- package/build/tests/libs-for-tests/server-components/component.d.ts +13 -0
- package/build/tests/libs-for-tests/server-components/component.js +77 -0
- package/build/tests/libs-for-tests/server-components/mailerid.d.ts +10 -0
- package/build/tests/libs-for-tests/server-components/mailerid.js +103 -0
- package/build/tests/libs-for-tests/server-runner.d.ts +15 -0
- package/build/tests/libs-for-tests/server-runner.js +69 -0
- package/build/tests/libs-for-tests/spec-assembly.d.ts +6 -0
- package/build/tests/libs-for-tests/spec-assembly.js +55 -0
- package/build/tests/libs-for-tests/ws-utils.d.ts +3 -0
- package/build/tests/libs-for-tests/ws-utils.js +59 -0
- package/build/tests/libs-for-tests/xhr-utils.d.ts +61 -0
- package/build/tests/libs-for-tests/xhr-utils.js +154 -0
- package/build/tests/protocols/3nstorage/owner/specs/archive-obj-ver.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/archive-obj-ver.js +84 -0
- package/build/tests/protocols/3nstorage/owner/specs/archive-root-ver.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/archive-root-ver.js +78 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-archive-obj-ver.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-archive-obj-ver.js +83 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-archive-root-ver.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-archive-root-ver.js +77 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-obj.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-obj.js +75 -0
- package/build/tests/protocols/3nstorage/owner/specs/events.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/events.js +91 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-current-obj.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-current-obj.js +269 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-current-root.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-current-root.js +262 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-obj-status.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-obj-status.js +79 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-root-status.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-root-status.js +72 -0
- package/build/tests/protocols/3nstorage/owner/specs/put-current-obj.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/put-current-obj.js +287 -0
- package/build/tests/protocols/3nstorage/owner/specs/put-current-root.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/put-current-root.js +274 -0
- package/build/tests/protocols/3nstorage/owner/specs/trans-cancel-root.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/trans-cancel-root.js +73 -0
- package/build/tests/protocols/3nstorage/owner/specs/trans-cancel.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/trans-cancel.js +72 -0
- package/build/tests/protocols/3nstorage/owner/test-utils.d.ts +14 -0
- package/build/tests/protocols/3nstorage/owner/test-utils.js +54 -0
- package/build/tests/protocols/3nstorage/owner.d.ts +1 -0
- package/build/tests/protocols/3nstorage/owner.js +138 -0
- package/build/tests/protocols/asmail/config.d.ts +1 -0
- package/build/tests/protocols/asmail/config.js +117 -0
- package/build/tests/protocols/asmail/delivery/specs/finalize-delivery.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/finalize-delivery.js +60 -0
- package/build/tests/protocols/asmail/delivery/specs/provide-recipient-pubkey.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/provide-recipient-pubkey.js +68 -0
- package/build/tests/protocols/asmail/delivery/specs/put-metadata.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/put-metadata.js +83 -0
- package/build/tests/protocols/asmail/delivery/specs/put-obj.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/put-obj.js +123 -0
- package/build/tests/protocols/asmail/delivery/specs/restart-session.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/restart-session.js +79 -0
- package/build/tests/protocols/asmail/delivery/specs/start-session.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/start-session.js +64 -0
- package/build/tests/protocols/asmail/delivery/test-utils.d.ts +16 -0
- package/build/tests/protocols/asmail/delivery/test-utils.js +46 -0
- package/build/tests/protocols/asmail/delivery.d.ts +1 -0
- package/build/tests/protocols/asmail/delivery.js +46 -0
- package/build/tests/protocols/asmail/retrieval/specs/events.d.ts +2 -0
- package/build/tests/protocols/asmail/retrieval/specs/events.js +62 -0
- package/build/tests/protocols/asmail/retrieval/specs/get-message-meta.d.ts +2 -0
- package/build/tests/protocols/asmail/retrieval/specs/get-message-meta.js +70 -0
- package/build/tests/protocols/asmail/retrieval/specs/get-message-obj.d.ts +2 -0
- package/build/tests/protocols/asmail/retrieval/specs/get-message-obj.js +166 -0
- package/build/tests/protocols/asmail/retrieval/specs/list-messages.d.ts +2 -0
- package/build/tests/protocols/asmail/retrieval/specs/list-messages.js +96 -0
- package/build/tests/protocols/asmail/retrieval/specs/remove-message.d.ts +2 -0
- package/build/tests/protocols/asmail/retrieval/specs/remove-message.js +66 -0
- package/build/tests/protocols/asmail/retrieval/test-utils.d.ts +17 -0
- package/build/tests/protocols/asmail/retrieval/test-utils.js +46 -0
- package/build/tests/protocols/asmail/retrieval.d.ts +1 -0
- package/build/tests/protocols/asmail/retrieval.js +92 -0
- package/build/tests/protocols/mailerid.d.ts +1 -0
- package/build/tests/protocols/mailerid.js +210 -0
- package/build/tests/shared-checks/check-mid-login.d.ts +2 -0
- package/build/tests/shared-checks/check-mid-login.js +131 -0
- package/build/tests/shared-checks/requests.d.ts +20 -0
- package/build/tests/shared-checks/requests.js +123 -0
- package/package.json +1 -1
- package/packing/create-deb.sh +57 -0
- package/packing/deb/lib/systemd/system/3nweb.service +11 -0
- package/packing/deb/postinst +44 -0
- package/packing/deb/usr/share/doc/3nweb-server/conf-for-postinstall.yaml +19 -0
- package/packing/deb/usr/share/doc/3nweb-server/copyright +22 -0
- package/publish-task.sh +10 -0
- package/push-to-github.sh +105 -0
- package/ts-code/3nstorage/3nstorage-app.ts +99 -0
- package/ts-code/3nstorage/owner.ts +178 -0
- package/ts-code/3nstorage/resources/sessions.ts +37 -0
- package/ts-code/3nstorage/resources/store.ts +896 -0
- package/ts-code/3nstorage/resources/users.ts +258 -0
- package/ts-code/3nstorage/routes/owner/archive-obj-version.ts +73 -0
- package/ts-code/3nstorage/routes/owner/cancel-trans.ts +58 -0
- package/ts-code/3nstorage/routes/owner/delete-obj.ts +103 -0
- package/ts-code/3nstorage/routes/owner/get-archived-obj-ver.ts +111 -0
- package/ts-code/3nstorage/routes/owner/get-current-obj.ts +122 -0
- package/ts-code/3nstorage/routes/owner/get-obj-status.ts +55 -0
- package/ts-code/3nstorage/routes/owner/param-getter.ts +51 -0
- package/ts-code/3nstorage/routes/owner/param-setter.ts +50 -0
- package/ts-code/3nstorage/routes/owner/put-current-obj.ts +284 -0
- package/ts-code/3nstorage/routes/owner/session-params.ts +49 -0
- package/ts-code/3nstorage/shared.ts +43 -0
- package/ts-code/asmail/asmail-app.ts +91 -0
- package/ts-code/asmail/config.ts +96 -0
- package/ts-code/asmail/delivery.ts +94 -0
- package/ts-code/asmail/resources/delivery-sessions.ts +118 -0
- package/ts-code/asmail/resources/inbox.ts +696 -0
- package/ts-code/asmail/resources/recipients.ts +495 -0
- package/ts-code/asmail/resources/sessions.ts +37 -0
- package/ts-code/asmail/retrieval.ts +96 -0
- package/ts-code/asmail/routes/config/param-getter.ts +49 -0
- package/ts-code/asmail/routes/config/param-setter.ts +49 -0
- package/ts-code/asmail/routes/delivery/finalize-delivery.ts +50 -0
- package/ts-code/asmail/routes/delivery/pre-flight.ts +132 -0
- package/ts-code/asmail/routes/delivery/provide-recipient-pubkey.ts +58 -0
- package/ts-code/asmail/routes/delivery/put-metadata.ts +94 -0
- package/ts-code/asmail/routes/delivery/put-obj.ts +166 -0
- package/ts-code/asmail/routes/delivery/restart-session.ts +130 -0
- package/ts-code/asmail/routes/delivery/sender-authorization.ts +81 -0
- package/ts-code/asmail/routes/delivery/start-session.ts +151 -0
- package/ts-code/asmail/routes/retrieval/get-message-meta.ts +53 -0
- package/ts-code/asmail/routes/retrieval/get-message-obj.ts +109 -0
- package/ts-code/asmail/routes/retrieval/list-messages.ts +70 -0
- package/ts-code/asmail/routes/retrieval/remove-message.ts +47 -0
- package/ts-code/cli/index.ts +82 -0
- package/ts-code/cli/run-cmd.ts +81 -0
- package/ts-code/cli/show-sample-config.ts +78 -0
- package/ts-code/cli/signup-cmd.ts +229 -0
- package/ts-code/cli/user-cmd.ts +68 -0
- package/ts-code/cli/utils.ts +105 -0
- package/ts-code/config/default-confs.ts +22 -0
- package/ts-code/config/from-yaml.ts +35 -0
- package/ts-code/config/letsencrypt.ts +77 -0
- package/ts-code/config/signup.ts +137 -0
- package/ts-code/lib-common/admin-api/signup.ts +120 -0
- package/ts-code/lib-common/assert.ts +22 -0
- package/ts-code/lib-common/async-fs-node.ts +656 -0
- package/ts-code/lib-common/buffer-utils.ts +124 -0
- package/ts-code/lib-common/byte-streaming/common.ts +166 -0
- package/ts-code/lib-common/bytes-equal.ts +25 -0
- package/ts-code/lib-common/canonical-address.ts +92 -0
- package/ts-code/lib-common/exceptions/error.ts +44 -0
- package/ts-code/lib-common/exceptions/file.ts +84 -0
- package/ts-code/lib-common/exceptions/http.ts +69 -0
- package/ts-code/lib-common/ipc/generic-ipc.ts +750 -0
- package/ts-code/lib-common/ipc/ws-ipc.ts +117 -0
- package/ts-code/lib-common/json-equal.ts +55 -0
- package/ts-code/lib-common/json-utils.ts +130 -0
- package/ts-code/lib-common/jwkeys.ts +246 -0
- package/ts-code/lib-common/map-of-sets.ts +60 -0
- package/ts-code/lib-common/mid-sigs-NaCl-Ed.ts +677 -0
- package/ts-code/lib-common/objs-on-disk/file-layout.ts +480 -0
- package/ts-code/lib-common/objs-on-disk/obj-file.ts +325 -0
- package/ts-code/lib-common/objs-on-disk/utils.ts +201 -0
- package/ts-code/lib-common/objs-on-disk/v1-obj-file-format.ts +329 -0
- package/ts-code/lib-common/processes.ts +501 -0
- package/ts-code/lib-common/random-node.ts +79 -0
- package/ts-code/lib-common/service-api/3nstorage/owner.ts +559 -0
- package/ts-code/lib-common/service-api/3nstorage/root-route.ts +22 -0
- package/ts-code/lib-common/service-api/asmail/config.ts +144 -0
- package/ts-code/lib-common/service-api/asmail/delivery.ts +250 -0
- package/ts-code/lib-common/service-api/asmail/retrieval.ts +238 -0
- package/ts-code/lib-common/service-api/asmail/root-route.ts +22 -0
- package/ts-code/lib-common/service-api/ipc-api.ts +44 -0
- package/ts-code/lib-common/service-api/locker.ts +44 -0
- package/ts-code/lib-common/service-api/mailer-id/login.ts +80 -0
- package/ts-code/lib-common/service-api/mailer-id/provisioning.ts +64 -0
- package/ts-code/lib-common/service-api/mailer-id/root-route.ts +25 -0
- package/ts-code/lib-common/service-api/pub-key-login.ts +75 -0
- package/ts-code/lib-common/service-api/web-socket-base.ts +87 -0
- package/ts-code/lib-common/session-encryptor.ts +54 -0
- package/ts-code/lib-common/time-window-cache.ts +74 -0
- package/ts-code/lib-common/transferable.d.ts +30 -0
- package/ts-code/lib-server/conf-util.ts +35 -0
- package/ts-code/lib-server/mid-access.ts +45 -0
- package/ts-code/lib-server/middleware/body-parsers.ts +248 -0
- package/ts-code/lib-server/middleware/error-handler.ts +79 -0
- package/ts-code/lib-server/pkl-access.ts +46 -0
- package/ts-code/lib-server/resources/dns.ts +151 -0
- package/ts-code/lib-server/resources/mailerid-authorizer.ts +115 -0
- package/ts-code/lib-server/resources/mem-backed-sessions-factory.ts +132 -0
- package/ts-code/lib-server/resources/server-data-folders.ts +160 -0
- package/ts-code/lib-server/resources/server-key-for-pkl-challenge.ts +41 -0
- package/ts-code/lib-server/resources/sessions.ts +232 -0
- package/ts-code/lib-server/resources/user-files.ts +147 -0
- package/ts-code/lib-server/routes/pub-key-login/complete-exchange.ts +63 -0
- package/ts-code/lib-server/routes/pub-key-login/start-exchange.ts +189 -0
- package/ts-code/lib-server/routes/sessions/close.ts +27 -0
- package/ts-code/lib-server/routes/sessions/mid-auth.ts +77 -0
- package/ts-code/lib-server/routes/sessions/start.ts +116 -0
- package/ts-code/lib-server/web-sockets/app.ts +339 -0
- package/ts-code/lib-server/web-sockets/server-events.ts +63 -0
- package/ts-code/lib.ts +29 -0
- package/ts-code/locker/locker-app.ts +60 -0
- package/ts-code/locker/resources/lockers.ts +17 -0
- package/ts-code/locker/resources/sessions.ts +37 -0
- package/ts-code/locker/routes/create-locker.ts +47 -0
- package/ts-code/mailerId/mailerId-app.ts +107 -0
- package/ts-code/mailerId/resources/certifier.ts +181 -0
- package/ts-code/mailerId/resources/sessions.ts +44 -0
- package/ts-code/mailerId/resources/users.ts +88 -0
- package/ts-code/mailerId/routes/certify.ts +68 -0
- package/ts-code/main.ts +304 -0
- package/ts-code/mock/dns.ts +106 -0
- package/ts-code/mock/mock-as-child-proc.ts +130 -0
- package/ts-code/mock/node-child-ipc.ts +69 -0
- package/ts-code/mock/run-in-proc.ts +111 -0
- package/ts-code/mock/tls-options.ts +73 -0
- package/ts-code/services.ts +138 -0
- package/ts-code/signup/resources/users.ts +429 -0
- package/ts-code/signup/routes/add.ts +65 -0
- package/ts-code/signup/routes/get-available-addresses.ts +49 -0
- package/ts-code/signup/routes/get-available-domains.ts +45 -0
- package/ts-code/signup/signup-app.ts +54 -0
- package/ts-code/signup/signup-tokens.ts +148 -0
- package/ts-code/tests/admin-proto/signup.ts +277 -0
- package/ts-code/tests/jasmine.ts +37 -0
- package/ts-code/tests/libs-for-tests/3nstorage.ts +144 -0
- package/ts-code/tests/libs-for-tests/asmail.ts +220 -0
- package/ts-code/tests/libs-for-tests/assert.ts +22 -0
- package/ts-code/tests/libs-for-tests/async-jasmine.ts +89 -0
- package/ts-code/tests/libs-for-tests/bytes-equal.ts +25 -0
- package/ts-code/tests/libs-for-tests/json-copy.ts +38 -0
- package/ts-code/tests/libs-for-tests/json-equal.ts +55 -0
- package/ts-code/tests/libs-for-tests/mailerid.ts +123 -0
- package/ts-code/tests/libs-for-tests/pkl.ts +127 -0
- package/ts-code/tests/libs-for-tests/server-components/3nstorage.ts +206 -0
- package/ts-code/tests/libs-for-tests/server-components/admin.ts +49 -0
- package/ts-code/tests/libs-for-tests/server-components/asmail.ts +152 -0
- package/ts-code/tests/libs-for-tests/server-components/component.ts +90 -0
- package/ts-code/tests/libs-for-tests/server-components/mailerid.ts +114 -0
- package/ts-code/tests/libs-for-tests/server-runner.ts +82 -0
- package/ts-code/tests/libs-for-tests/spec-assembly.ts +60 -0
- package/ts-code/tests/libs-for-tests/ws-utils.ts +61 -0
- package/ts-code/tests/libs-for-tests/xhr-utils.ts +179 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/archive-obj-ver.ts +100 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/archive-root-ver.ts +91 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/delete-archive-obj-ver.ts +99 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/delete-archive-root-ver.ts +90 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/delete-obj.ts +84 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/events.ts +125 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/get-current-obj.ts +298 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/get-current-root.ts +290 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/get-obj-status.ts +88 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/get-root-status.ts +80 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/put-current-obj.ts +366 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/put-current-root.ts +329 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/trans-cancel-root.ts +86 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/trans-cancel.ts +86 -0
- package/ts-code/tests/protocols/3nstorage/owner/test-utils.ts +72 -0
- package/ts-code/tests/protocols/3nstorage/owner.ts +198 -0
- package/ts-code/tests/protocols/asmail/config.ts +172 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/finalize-delivery.ts +69 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/provide-recipient-pubkey.ts +88 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/put-metadata.ts +102 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/put-obj.ts +156 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/restart-session.ts +97 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/start-session.ts +79 -0
- package/ts-code/tests/protocols/asmail/delivery/test-utils.ts +64 -0
- package/ts-code/tests/protocols/asmail/delivery.ts +56 -0
- package/ts-code/tests/protocols/asmail/retrieval/specs/events.ts +78 -0
- package/ts-code/tests/protocols/asmail/retrieval/specs/get-message-meta.ts +80 -0
- package/ts-code/tests/protocols/asmail/retrieval/specs/get-message-obj.ts +197 -0
- package/ts-code/tests/protocols/asmail/retrieval/specs/list-messages.ts +110 -0
- package/ts-code/tests/protocols/asmail/retrieval/specs/remove-message.ts +74 -0
- package/ts-code/tests/protocols/asmail/retrieval/test-utils.ts +60 -0
- package/ts-code/tests/protocols/asmail/retrieval.ts +115 -0
- package/ts-code/tests/protocols/mailerid.ts +271 -0
- package/ts-code/tests/shared-checks/check-mid-login.ts +164 -0
- package/ts-code/tests/shared-checks/requests.ts +135 -0
- package/ts-code/tsconfig.json +11 -0
- package/ts-code/web3n.d.ts +1068 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016 - 2017, 2019, 2025 3NSoft Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.specs = void 0;
|
|
20
|
+
const async_jasmine_1 = require("../../../../libs-for-tests/async-jasmine");
|
|
21
|
+
const test_utils_1 = require("../test-utils");
|
|
22
|
+
const xhr_utils_1 = require("../../../../libs-for-tests/xhr-utils");
|
|
23
|
+
const url_1 = require("url");
|
|
24
|
+
const delivery_1 = require("../../../../../lib-common/service-api/asmail/delivery");
|
|
25
|
+
const requests_1 = require("../../../../shared-checks/requests");
|
|
26
|
+
const asmail_1 = require("../../../../libs-for-tests/asmail");
|
|
27
|
+
const json_copy_1 = require("../../../../libs-for-tests/json-copy");
|
|
28
|
+
exports.specs = {
|
|
29
|
+
description: `Request to put message object's segments`
|
|
30
|
+
};
|
|
31
|
+
const obj1 = test_utils_1.msg.msgObjs[0];
|
|
32
|
+
const obj2 = test_utils_1.msg.msgObjs[1];
|
|
33
|
+
exports.specs.definition = (setup) => (() => {
|
|
34
|
+
let user2;
|
|
35
|
+
let deliveryUrl;
|
|
36
|
+
let fstReqOpts;
|
|
37
|
+
let sndReqOpts;
|
|
38
|
+
let maxChunkSize;
|
|
39
|
+
(0, async_jasmine_1.beforeEachAsync)(async () => {
|
|
40
|
+
user2 = setup().user2;
|
|
41
|
+
deliveryUrl = await setup().asmailServer.getDeliveryUrl();
|
|
42
|
+
const sessInfo = await (0, asmail_1.startMsgDelivery)(deliveryUrl, { recipient: user2.id }, { pid: test_utils_1.msg.cryptoMeta.pid, objIds: [obj1.objId, obj2.objId] });
|
|
43
|
+
maxChunkSize = sessInfo.maxChunkSize;
|
|
44
|
+
fstReqOpts = {
|
|
45
|
+
url: (0, url_1.resolve)(deliveryUrl, delivery_1.msgObj.firstPutReqUrlEnd(obj1.objId, { header: obj1.header.length })),
|
|
46
|
+
method: 'PUT',
|
|
47
|
+
sessionId: sessInfo.sessionId
|
|
48
|
+
};
|
|
49
|
+
sndReqOpts = {
|
|
50
|
+
url: (0, url_1.resolve)(deliveryUrl, delivery_1.msgObj.secondPutReqUrlEnd(obj1.objId, { ofs: 0 })),
|
|
51
|
+
method: 'PUT',
|
|
52
|
+
sessionId: sessInfo.sessionId
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
(0, async_jasmine_1.itAsync)('fails for unknown object, in initial put request', async () => {
|
|
56
|
+
const opts = (0, json_copy_1.copy)(fstReqOpts);
|
|
57
|
+
opts.url = (0, url_1.resolve)(deliveryUrl, delivery_1.msgObj.firstPutReqUrlEnd('unknown-obj', { header: obj1.header.length, last: true }));
|
|
58
|
+
const rep = await (0, xhr_utils_1.doBinaryRequest)(opts, [obj1.header, obj1.segs]);
|
|
59
|
+
expect(rep.status).withContext('status for unknown object').toBe(delivery_1.msgObj.SC.unknownObj);
|
|
60
|
+
});
|
|
61
|
+
(0, async_jasmine_1.itAsync)('fails for unknown object, in secondary put request', async () => {
|
|
62
|
+
const opts = (0, json_copy_1.copy)(sndReqOpts);
|
|
63
|
+
opts.url = (0, url_1.resolve)(deliveryUrl, delivery_1.msgObj.secondPutReqUrlEnd('unknown-obj', { ofs: 0, last: true }));
|
|
64
|
+
const rep = await (0, xhr_utils_1.doBinaryRequest)(opts, obj1.segs);
|
|
65
|
+
expect(rep.status).withContext('status for unknown object').toBe(delivery_1.msgObj.SC.unknownObj);
|
|
66
|
+
});
|
|
67
|
+
(0, async_jasmine_1.itAsync)('will not work outside of a valid session', async () => {
|
|
68
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(fstReqOpts);
|
|
69
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(sndReqOpts);
|
|
70
|
+
});
|
|
71
|
+
(0, async_jasmine_1.itAsync)('first request is limited by session parameter', async () => {
|
|
72
|
+
const opts = (0, json_copy_1.copy)(fstReqOpts);
|
|
73
|
+
opts.url = (0, url_1.resolve)(deliveryUrl, delivery_1.msgObj.firstPutReqUrlEnd(obj1.objId, { header: 100, last: true }));
|
|
74
|
+
await (0, requests_1.expectNonAcceptanceOfLongBody)(opts, 'application/octet-stream', maxChunkSize + 100);
|
|
75
|
+
});
|
|
76
|
+
(0, async_jasmine_1.itAsync)('second request is limited by session parameter', async () => {
|
|
77
|
+
const opts = (0, json_copy_1.copy)(fstReqOpts);
|
|
78
|
+
opts.url = (0, url_1.resolve)(deliveryUrl, delivery_1.msgObj.firstPutReqUrlEnd(obj1.objId, { header: obj1.header.length }));
|
|
79
|
+
const rep = await (0, xhr_utils_1.doBinaryRequest)(opts, obj1.header);
|
|
80
|
+
opts.url = (0, url_1.resolve)(deliveryUrl, delivery_1.msgObj.secondPutReqUrlEnd(obj1.objId, { ofs: 0 }));
|
|
81
|
+
await (0, requests_1.expectNonAcceptanceOfLongBody)(opts, 'application/octet-stream', maxChunkSize + 100);
|
|
82
|
+
});
|
|
83
|
+
(0, async_jasmine_1.itAsync)(`writes whole object in one request`, async () => {
|
|
84
|
+
const opts = (0, json_copy_1.copy)(fstReqOpts);
|
|
85
|
+
opts.url = (0, url_1.resolve)(deliveryUrl, delivery_1.msgObj.firstPutReqUrlEnd(obj1.objId, { header: obj1.header.length, last: true }));
|
|
86
|
+
let rep = await (0, xhr_utils_1.doBinaryRequest)(opts, [obj1.header, obj1.segs]);
|
|
87
|
+
expect(rep.status).withContext('status for successful writing of segments bytes').toBe(delivery_1.msgObj.SC.ok);
|
|
88
|
+
});
|
|
89
|
+
(0, async_jasmine_1.itAsync)(`writes object in several requests`, async () => {
|
|
90
|
+
// first request, to start transmission
|
|
91
|
+
const opts = (0, json_copy_1.copy)(fstReqOpts);
|
|
92
|
+
opts.url = (0, url_1.resolve)(deliveryUrl, delivery_1.msgObj.firstPutReqUrlEnd(obj2.objId, { header: obj2.header.length }));
|
|
93
|
+
// we send only header here, but we may send some segment bytes as well
|
|
94
|
+
const rep = await (0, xhr_utils_1.doBinaryRequest)(opts, obj2.header);
|
|
95
|
+
expect(rep.status).withContext('status for successful writing of segments bytes').toBe(delivery_1.msgObj.SC.ok);
|
|
96
|
+
// following requests
|
|
97
|
+
for (let ofs = 0; ofs < obj2.segs.length; ofs += 512) {
|
|
98
|
+
const chunk = obj2.segs.subarray(ofs, ofs + 512);
|
|
99
|
+
const last = ((ofs + chunk.length) === obj2.segs.length);
|
|
100
|
+
opts.url = (0, url_1.resolve)(deliveryUrl, delivery_1.msgObj.secondPutReqUrlEnd(obj2.objId, { ofs, last }));
|
|
101
|
+
const rep = await (0, xhr_utils_1.doBinaryRequest)(opts, chunk);
|
|
102
|
+
expect(rep.status).withContext('status for successful writing of segments bytes').toBe(delivery_1.msgObj.SC.ok);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
(0, async_jasmine_1.itAsync)(`should not work, if metadata hasn't been sent, yet`, async () => {
|
|
106
|
+
const opts = (0, json_copy_1.copy)(fstReqOpts);
|
|
107
|
+
opts.sessionId = (await (0, asmail_1.startMsgDeliverySession)(deliveryUrl, { recipient: user2.id })).sessionId;
|
|
108
|
+
let rep = await (0, xhr_utils_1.doBinaryRequest)(opts, obj1.header);
|
|
109
|
+
expect(rep.status).withContext('status for sending object bytes before sending message metadata').toBe(delivery_1.ERR_SC.earlyReq);
|
|
110
|
+
opts.url = sndReqOpts.url;
|
|
111
|
+
rep = await (0, xhr_utils_1.doBinaryRequest)(opts, obj1.header);
|
|
112
|
+
expect(rep.status).withContext('status for sending object bytes before sending message metadata').toBe(delivery_1.ERR_SC.earlyReq);
|
|
113
|
+
});
|
|
114
|
+
(0, async_jasmine_1.itAsync)('will not accept bad type', async () => {
|
|
115
|
+
await (0, requests_1.expectNonAcceptanceOfBadType)(fstReqOpts, 'application/octet-stream', obj1.segs);
|
|
116
|
+
await (0, requests_1.expectNonAcceptanceOfBadType)(sndReqOpts, 'application/octet-stream', obj1.segs);
|
|
117
|
+
});
|
|
118
|
+
(0, async_jasmine_1.itAsync)('requires messagedelivery session', async () => {
|
|
119
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(fstReqOpts, true);
|
|
120
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(sndReqOpts, true);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2017 3NSoft, 2025 Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.specs = void 0;
|
|
20
|
+
const async_jasmine_1 = require("../../../../libs-for-tests/async-jasmine");
|
|
21
|
+
const test_utils_1 = require("../test-utils");
|
|
22
|
+
const xhr_utils_1 = require("../../../../libs-for-tests/xhr-utils");
|
|
23
|
+
const url_1 = require("url");
|
|
24
|
+
const delivery_1 = require("../../../../../lib-common/service-api/asmail/delivery");
|
|
25
|
+
const requests_1 = require("../../../../shared-checks/requests");
|
|
26
|
+
exports.specs = {
|
|
27
|
+
description: 'Request to restart message delivery session'
|
|
28
|
+
};
|
|
29
|
+
exports.specs.definition = (setup) => (() => {
|
|
30
|
+
let user2;
|
|
31
|
+
let initialSession;
|
|
32
|
+
let reqOpts;
|
|
33
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
34
|
+
user2 = setup().user2;
|
|
35
|
+
const deliveryUrl = await setup().asmailServer.getDeliveryUrl();
|
|
36
|
+
initialSession = await (0, test_utils_1.startSessionAndSendMsgObjs)(deliveryUrl, user2.id, test_utils_1.msg);
|
|
37
|
+
reqOpts = {
|
|
38
|
+
url: (0, url_1.resolve)(deliveryUrl, delivery_1.sessionRestart.URL_END),
|
|
39
|
+
method: 'POST',
|
|
40
|
+
responseType: 'json'
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
(0, async_jasmine_1.itAsync)('with ok reply returns session parameters (id, etc.)', async () => {
|
|
44
|
+
const req = {
|
|
45
|
+
recipient: user2.id,
|
|
46
|
+
msgId: initialSession.msgId
|
|
47
|
+
};
|
|
48
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
49
|
+
expect(rep.status).withContext('successful session start status').toBe(delivery_1.sessionRestart.SC.ok);
|
|
50
|
+
expect(typeof rep.data.sessionId).toBe('string');
|
|
51
|
+
expect(rep.data.sessionId.length).toBeGreaterThan(0);
|
|
52
|
+
expect(rep.data.maxMsgLength).toBe(initialSession.maxMsgLength);
|
|
53
|
+
expect(rep.data.maxChunkSize).toBe(initialSession.maxChunkSize);
|
|
54
|
+
});
|
|
55
|
+
(0, async_jasmine_1.itAsync)('returns error status when recipient is unknown', async () => {
|
|
56
|
+
const req = {
|
|
57
|
+
recipient: 'unknown user@bank.com',
|
|
58
|
+
msgId: initialSession.msgId
|
|
59
|
+
};
|
|
60
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
61
|
+
expect(rep.status).withContext('status for unknown recipient').toBe(delivery_1.sessionRestart.SC.unknownRecipient);
|
|
62
|
+
});
|
|
63
|
+
(0, async_jasmine_1.itAsync)(`returns error status when message is not known in delivery`, async () => {
|
|
64
|
+
const req = {
|
|
65
|
+
recipient: user2.id,
|
|
66
|
+
msgId: 'unknown message'
|
|
67
|
+
};
|
|
68
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
69
|
+
expect(rep.status).withContext('status for unknown message').toBe(delivery_1.sessionRestart.SC.unknownMsg);
|
|
70
|
+
});
|
|
71
|
+
(0, async_jasmine_1.itAsync)('adequately responds to fuzzing', async () => {
|
|
72
|
+
// bad JSON's
|
|
73
|
+
const REQ_SIZE_LIMIT = 1024;
|
|
74
|
+
const badJSONs = [null, undefined, 1, 'string',
|
|
75
|
+
[1, 2], [], { a: 1, b: 2 }];
|
|
76
|
+
await (0, requests_1.expectNonAcceptanceOfBadJsonRequest)(reqOpts, REQ_SIZE_LIMIT, badJSONs);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016 - 2017, 2025 3NSoft Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.specs = void 0;
|
|
20
|
+
const async_jasmine_1 = require("../../../../libs-for-tests/async-jasmine");
|
|
21
|
+
const xhr_utils_1 = require("../../../../libs-for-tests/xhr-utils");
|
|
22
|
+
const url_1 = require("url");
|
|
23
|
+
const delivery_1 = require("../../../../../lib-common/service-api/asmail/delivery");
|
|
24
|
+
const requests_1 = require("../../../../shared-checks/requests");
|
|
25
|
+
exports.specs = {
|
|
26
|
+
description: 'Request to start message delivery session'
|
|
27
|
+
};
|
|
28
|
+
exports.specs.definition = (setup) => (() => {
|
|
29
|
+
let user2;
|
|
30
|
+
let reqOpts;
|
|
31
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
32
|
+
user2 = setup().user2;
|
|
33
|
+
const deliveryUrl = await setup().asmailServer.getDeliveryUrl();
|
|
34
|
+
reqOpts = {
|
|
35
|
+
url: (0, url_1.resolve)(deliveryUrl, delivery_1.sessionStart.URL_END),
|
|
36
|
+
method: 'POST',
|
|
37
|
+
responseType: 'json'
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
(0, async_jasmine_1.itAsync)('with ok reply returns session parameters (id, etc.)', async () => {
|
|
41
|
+
const req = {
|
|
42
|
+
recipient: user2.id
|
|
43
|
+
};
|
|
44
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
45
|
+
expect(rep.status).withContext('successful session start status').toBe(delivery_1.sessionStart.SC.ok);
|
|
46
|
+
expect(typeof rep.data.sessionId).toBe('string');
|
|
47
|
+
expect(rep.data.sessionId.length).toBeGreaterThan(0);
|
|
48
|
+
expect(typeof rep.data.maxMsgLength).toBe('number');
|
|
49
|
+
expect(rep.data.maxMsgLength).toBeGreaterThan(0);
|
|
50
|
+
});
|
|
51
|
+
(0, async_jasmine_1.itAsync)('returns error status when recipient is unknown', async () => {
|
|
52
|
+
const req = { recipient: 'unknown user@bank.com' };
|
|
53
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
54
|
+
expect(rep.status).withContext('status for unknown recipient').toBe(delivery_1.sessionStart.SC.unknownRecipient);
|
|
55
|
+
});
|
|
56
|
+
(0, async_jasmine_1.itAsync)('adequately responds to fuzzing', async () => {
|
|
57
|
+
// bad JSON's
|
|
58
|
+
const REQ_SIZE_LIMIT = 1024;
|
|
59
|
+
const badJSONs = [null, undefined, 1, 'string',
|
|
60
|
+
[1, 2], [], { a: 1, b: 2 }];
|
|
61
|
+
await (0, requests_1.expectNonAcceptanceOfBadJsonRequest)(reqOpts, REQ_SIZE_LIMIT, badJSONs);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ASMailComponent } from '../../../libs-for-tests/server-components/asmail';
|
|
2
|
+
import { User } from '../../../libs-for-tests/mailerid';
|
|
3
|
+
import { GenericSpecDescribe } from '../../../libs-for-tests/spec-assembly';
|
|
4
|
+
import { Msg, Obj, DeliveryInfo } from '../../../libs-for-tests/asmail';
|
|
5
|
+
export { ASMailComponent } from '../../../libs-for-tests/server-components/asmail';
|
|
6
|
+
export { User } from '../../../libs-for-tests/mailerid';
|
|
7
|
+
export interface TestSetup {
|
|
8
|
+
asmailServer: ASMailComponent;
|
|
9
|
+
user1: User;
|
|
10
|
+
user2: User;
|
|
11
|
+
}
|
|
12
|
+
export type SpecDescribe = GenericSpecDescribe<TestSetup>;
|
|
13
|
+
export declare const obj1: Obj;
|
|
14
|
+
export declare const obj2: Obj;
|
|
15
|
+
export declare const msg: Msg;
|
|
16
|
+
export declare function startSessionAndSendMsgObjs(deliveryUrl: string, recipient: string, msg: Msg): Promise<DeliveryInfo>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2017 3NSoft Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.startSessionAndSendMsgObjs = exports.msg = exports.obj2 = exports.obj1 = exports.ASMailComponent = void 0;
|
|
20
|
+
const random_node_1 = require("../../../../lib-common/random-node");
|
|
21
|
+
const asmail_1 = require("../../../libs-for-tests/asmail");
|
|
22
|
+
var asmail_2 = require("../../../libs-for-tests/server-components/asmail");
|
|
23
|
+
Object.defineProperty(exports, "ASMailComponent", { enumerable: true, get: function () { return asmail_2.ASMailComponent; } });
|
|
24
|
+
exports.obj1 = {
|
|
25
|
+
objId: 'aaaa',
|
|
26
|
+
header: (0, random_node_1.bytesSync)(100),
|
|
27
|
+
segs: (0, random_node_1.bytesSync)(573)
|
|
28
|
+
};
|
|
29
|
+
exports.obj2 = {
|
|
30
|
+
objId: 'bbbb',
|
|
31
|
+
header: (0, random_node_1.bytesSync)(100),
|
|
32
|
+
segs: (0, random_node_1.bytesSync)(20 * 1024 + 7)
|
|
33
|
+
};
|
|
34
|
+
exports.msg = {
|
|
35
|
+
cryptoMeta: { pid: 'xxxx' },
|
|
36
|
+
msgObjs: [exports.obj1, exports.obj2]
|
|
37
|
+
};
|
|
38
|
+
async function startSessionAndSendMsgObjs(deliveryUrl, recipient, msg) {
|
|
39
|
+
const sessInfo = await (0, asmail_1.startMsgDelivery)(deliveryUrl, { recipient }, { pid: msg.cryptoMeta.pid,
|
|
40
|
+
objIds: [msg.msgObjs[0].objId, msg.msgObjs[1].objId] });
|
|
41
|
+
await (0, asmail_1.sendMsgObj)(deliveryUrl, sessInfo.sessionId, msg.msgObjs[0], sessInfo.maxChunkSize);
|
|
42
|
+
await (0, asmail_1.sendMsgObj)(deliveryUrl, sessInfo.sessionId, msg.msgObjs[1], sessInfo.maxChunkSize);
|
|
43
|
+
return sessInfo;
|
|
44
|
+
}
|
|
45
|
+
exports.startSessionAndSendMsgObjs = startSessionAndSendMsgObjs;
|
|
46
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016 - 2017 3NSoft Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
const async_jasmine_1 = require("../../libs-for-tests/async-jasmine");
|
|
20
|
+
const asmail_1 = require("../../libs-for-tests/server-components/asmail");
|
|
21
|
+
const config_1 = require("../../../lib-common/service-api/asmail/config");
|
|
22
|
+
const asmail_2 = require("../../libs-for-tests/asmail");
|
|
23
|
+
const path_1 = require("path");
|
|
24
|
+
const spec_assembly_1 = require("../../libs-for-tests/spec-assembly");
|
|
25
|
+
const SPECS_FOLDER = (0, path_1.join)(__dirname, './delivery/specs');
|
|
26
|
+
describe('ASMail delivery service', () => {
|
|
27
|
+
let asmailServer;
|
|
28
|
+
const midServiceDomain = 'localhost';
|
|
29
|
+
const signupDomains = ['company.inc', 'personal.net'];
|
|
30
|
+
let user1;
|
|
31
|
+
let user2;
|
|
32
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
33
|
+
asmailServer = new asmail_1.ASMailComponent(signupDomains, midServiceDomain);
|
|
34
|
+
await asmailServer.start();
|
|
35
|
+
user1 = await asmailServer.addUser(`Bob Johnson @${signupDomains[0]}`);
|
|
36
|
+
user2 = await asmailServer.addUser(`William Young @${signupDomains[1]}`);
|
|
37
|
+
const user2Params = {};
|
|
38
|
+
user2Params[config_1.p.initPubKey.URL_END] = await (0, asmail_2.generateInitPubKey)(asmailServer.midUrl, user2);
|
|
39
|
+
await (0, asmail_2.setInboxParams)(asmailServer.asmailUrl, user2, user2Params);
|
|
40
|
+
});
|
|
41
|
+
(0, async_jasmine_1.afterAllAsync)(async () => {
|
|
42
|
+
await asmailServer.stop();
|
|
43
|
+
asmailServer = undefined;
|
|
44
|
+
});
|
|
45
|
+
(0, spec_assembly_1.addSpecsFrom)(SPECS_FOLDER, () => ({ asmailServer, user1, user2 }));
|
|
46
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2017, 2025 3NSoft Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.specs = void 0;
|
|
20
|
+
const async_jasmine_1 = require("../../../../libs-for-tests/async-jasmine");
|
|
21
|
+
const test_utils_1 = require("../test-utils");
|
|
22
|
+
const ws_utils_1 = require("../../../../libs-for-tests/ws-utils");
|
|
23
|
+
const processes_1 = require("../../../../../lib-common/processes");
|
|
24
|
+
const ws_ipc_1 = require("../../../../../lib-common/ipc/ws-ipc");
|
|
25
|
+
const retrieval_1 = require("../../../../../lib-common/service-api/asmail/retrieval");
|
|
26
|
+
const rxjs_1 = require("rxjs");
|
|
27
|
+
exports.specs = {
|
|
28
|
+
description: `is an event emitter`
|
|
29
|
+
};
|
|
30
|
+
exports.specs.definition = (setup) => (() => {
|
|
31
|
+
let asmailServer;
|
|
32
|
+
let wsUrl;
|
|
33
|
+
let deliveryUrl;
|
|
34
|
+
let user1;
|
|
35
|
+
let sessionId;
|
|
36
|
+
(0, async_jasmine_1.beforeEachAsync)(async () => {
|
|
37
|
+
asmailServer = setup().asmailServer;
|
|
38
|
+
const retrievalUrl = await asmailServer.getRetrievalUrl();
|
|
39
|
+
wsUrl = `wss${retrievalUrl.substring(5)}${retrieval_1.wsEventChannel.URL_END}`;
|
|
40
|
+
deliveryUrl = await asmailServer.getDeliveryUrl();
|
|
41
|
+
user1 = setup().user1;
|
|
42
|
+
sessionId = await (0, test_utils_1.startSession)(user1, retrievalUrl);
|
|
43
|
+
});
|
|
44
|
+
(0, async_jasmine_1.itAsync)(`requires session to open web socket`, async () => {
|
|
45
|
+
let rep = await (0, ws_utils_1.openSocket)(wsUrl, 'invalid session id');
|
|
46
|
+
expect(rep.status).withContext('status for missing authorized session').toBe(retrieval_1.ERR_SC.needAuth);
|
|
47
|
+
});
|
|
48
|
+
(0, async_jasmine_1.itAsync)(`emits event on completion of message reception`, async () => {
|
|
49
|
+
let rep = await (0, ws_utils_1.openSocket)(wsUrl, sessionId);
|
|
50
|
+
expect(rep.status).toBe(retrieval_1.wsEventChannel.SC.ok);
|
|
51
|
+
const eventSrc = (0, ws_ipc_1.makeSubscriber)(rep.data, undefined);
|
|
52
|
+
const eventPromise = rxjs_1.Observable.create(obs => eventSrc.subscribe(retrieval_1.msgRecievedCompletely.EVENT_NAME, obs))
|
|
53
|
+
.take(1)
|
|
54
|
+
.toPromise();
|
|
55
|
+
// give some time for subscription to occur
|
|
56
|
+
await (0, processes_1.sleep)(10);
|
|
57
|
+
const msgId = await (0, test_utils_1.sendMsg)(deliveryUrl, user1.id, test_utils_1.msg);
|
|
58
|
+
const event = await eventPromise;
|
|
59
|
+
expect(typeof event).toBe('object');
|
|
60
|
+
expect(event.msgId).withContext(`message reception completion event should give a respective message id`).toBe(msgId);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016 - 2017, 2025 3NSoft Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.specs = void 0;
|
|
20
|
+
const async_jasmine_1 = require("../../../../libs-for-tests/async-jasmine");
|
|
21
|
+
const test_utils_1 = require("../test-utils");
|
|
22
|
+
const url_1 = require("url");
|
|
23
|
+
const retrieval_1 = require("../../../../../lib-common/service-api/asmail/retrieval");
|
|
24
|
+
const xhr_utils_1 = require("../../../../libs-for-tests/xhr-utils");
|
|
25
|
+
const requests_1 = require("../../../../shared-checks/requests");
|
|
26
|
+
const json_copy_1 = require("../../../../libs-for-tests/json-copy");
|
|
27
|
+
exports.specs = {
|
|
28
|
+
description: `Request to get message meta`
|
|
29
|
+
};
|
|
30
|
+
exports.specs.definition = (setup) => (() => {
|
|
31
|
+
let asmailServer;
|
|
32
|
+
let retrievalUrl;
|
|
33
|
+
let deliveryUrl;
|
|
34
|
+
let user1;
|
|
35
|
+
let reqOpts;
|
|
36
|
+
(0, async_jasmine_1.beforeEachAsync)(async () => {
|
|
37
|
+
asmailServer = setup().asmailServer;
|
|
38
|
+
retrievalUrl = await asmailServer.getRetrievalUrl();
|
|
39
|
+
deliveryUrl = await asmailServer.getDeliveryUrl();
|
|
40
|
+
user1 = setup().user1;
|
|
41
|
+
const sessionId = await (0, test_utils_1.startSession)(user1, retrievalUrl);
|
|
42
|
+
reqOpts = {
|
|
43
|
+
url: (0, url_1.resolve)(retrievalUrl, retrieval_1.msgMetadata.genUrlEnd('some-msg')),
|
|
44
|
+
method: 'GET',
|
|
45
|
+
responseType: 'json',
|
|
46
|
+
sessionId
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
(0, async_jasmine_1.itAsync)('returns message metadata', async () => {
|
|
50
|
+
const msgId = await (0, test_utils_1.sendMsg)(deliveryUrl, user1.id, test_utils_1.msg);
|
|
51
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
52
|
+
opts.url = (0, url_1.resolve)(retrievalUrl, retrieval_1.msgMetadata.genUrlEnd(msgId));
|
|
53
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(opts);
|
|
54
|
+
expect(rep.status).withContext('status for successfully found message').toBe(retrieval_1.msgMetadata.SC.ok);
|
|
55
|
+
expect(rep.data.authSender).toBeFalsy();
|
|
56
|
+
expect(typeof rep.data.deliveryStart).toBe('number');
|
|
57
|
+
expect(typeof rep.data.deliveryCompletion).toBe('number');
|
|
58
|
+
expect(rep.data.deliveryStart).not.toBeGreaterThan(rep.data.deliveryCompletion);
|
|
59
|
+
});
|
|
60
|
+
(0, async_jasmine_1.itAsync)(`returns an error when message is unknown`, async () => {
|
|
61
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
62
|
+
opts.url = (0, url_1.resolve)(retrievalUrl, retrieval_1.msgMetadata.genUrlEnd('unknown-message'));
|
|
63
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(opts);
|
|
64
|
+
expect(rep.status).withContext('status for unknown message').toBe(retrieval_1.msgMetadata.SC.unknownMsg);
|
|
65
|
+
});
|
|
66
|
+
(0, async_jasmine_1.itAsync)(`requires open session`, async () => {
|
|
67
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
68
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(opts);
|
|
69
|
+
});
|
|
70
|
+
});
|