spec-3nweb-server 1.8.5 → 1.8.7
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/resources/store.d.ts +2 -2
- package/build/3nstorage/resources/store.js +1 -1
- package/build/3nstorage/resources/users.d.ts +3 -3
- package/build/3nstorage/resources/users.js +1 -1
- package/build/3nstorage/resources/utils.d.ts +6 -0
- package/build/3nstorage/resources/utils.js +41 -0
- package/build/3nstorage/routes/owner/archive-obj-version.js +8 -10
- package/build/3nstorage/routes/owner/cancel-trans.js +5 -4
- package/build/3nstorage/routes/owner/delete-obj.js +7 -8
- package/build/3nstorage/routes/owner/get-archived-obj-ver.js +11 -13
- package/build/3nstorage/routes/owner/get-current-obj.js +7 -6
- package/build/3nstorage/routes/owner/get-obj-status.js +8 -8
- package/build/3nstorage/routes/owner/put-current-obj.js +25 -55
- package/build/3nstorage/routes/owner/session-params.js +2 -0
- package/build/asmail/resources/utils.d.ts +6 -0
- package/build/asmail/resources/utils.js +36 -0
- package/build/asmail/routes/delivery/finalize-delivery.js +3 -2
- package/build/asmail/routes/delivery/pre-flight.js +9 -26
- package/build/asmail/routes/delivery/provide-recipient-pubkey.js +4 -3
- package/build/asmail/routes/delivery/put-metadata.js +13 -21
- package/build/asmail/routes/delivery/put-obj.js +19 -25
- package/build/asmail/routes/delivery/restart-session.d.ts +4 -8
- package/build/asmail/routes/delivery/restart-session.js +10 -23
- package/build/asmail/routes/delivery/sender-authorization.js +5 -5
- package/build/asmail/routes/delivery/start-session.js +9 -24
- package/build/asmail/routes/retrieval/get-message-meta.js +4 -7
- package/build/asmail/routes/retrieval/get-message-obj.js +10 -7
- package/build/asmail/routes/retrieval/list-messages.js +4 -4
- package/build/asmail/routes/retrieval/remove-message.js +3 -2
- package/build/mock/tls-options.js +46 -44
- 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/resources/utils.ts +45 -0
- package/ts-code/3nstorage/routes/owner/archive-obj-version.ts +71 -0
- package/ts-code/3nstorage/routes/owner/cancel-trans.ts +60 -0
- package/ts-code/3nstorage/routes/owner/delete-obj.ts +99 -0
- package/ts-code/3nstorage/routes/owner/get-archived-obj-ver.ts +109 -0
- package/ts-code/3nstorage/routes/owner/get-current-obj.ts +124 -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 +257 -0
- package/ts-code/3nstorage/routes/owner/session-params.ts +50 -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/resources/utils.ts +41 -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 +51 -0
- package/ts-code/asmail/routes/delivery/pre-flight.ts +118 -0
- package/ts-code/asmail/routes/delivery/provide-recipient-pubkey.ts +58 -0
- package/ts-code/asmail/routes/delivery/put-metadata.ts +85 -0
- package/ts-code/asmail/routes/delivery/put-obj.ts +152 -0
- package/ts-code/asmail/routes/delivery/restart-session.ts +117 -0
- package/ts-code/asmail/routes/delivery/sender-authorization.ts +81 -0
- package/ts-code/asmail/routes/delivery/start-session.ts +136 -0
- package/ts-code/asmail/routes/retrieval/get-message-meta.ts +50 -0
- package/ts-code/asmail/routes/retrieval/get-message-obj.ts +106 -0
- package/ts-code/asmail/routes/retrieval/list-messages.ts +68 -0
- package/ts-code/asmail/routes/retrieval/remove-message.ts +48 -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
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.authorize = void 0;
|
|
20
20
|
const delivery_1 = require("../../../lib-common/service-api/asmail/delivery");
|
|
21
|
+
const utils_1 = require("../../resources/utils");
|
|
21
22
|
/**
|
|
22
23
|
* This creates an authorize-sender route handler.
|
|
23
24
|
* @param relyingPartyDomain at which this service operates, as seen by client
|
|
@@ -28,8 +29,7 @@ const delivery_1 = require("../../../lib-common/service-api/asmail/delivery");
|
|
|
28
29
|
function authorize(relyingPartyDomain, midAuthorizingFunc) {
|
|
29
30
|
return async (req, res, next) => {
|
|
30
31
|
if (req.session.isAuthorized) {
|
|
31
|
-
|
|
32
|
-
return;
|
|
32
|
+
return (0, utils_1.replyWithErr)(delivery_1.ERR_SC.duplicateReq, "This protocol request has already been served.", res);
|
|
33
33
|
}
|
|
34
34
|
const rb = req.body;
|
|
35
35
|
const sender = req.session.params.sender;
|
|
@@ -37,12 +37,12 @@ function authorize(relyingPartyDomain, midAuthorizingFunc) {
|
|
|
37
37
|
if (!sender) {
|
|
38
38
|
// This case must be rejected, because place for authorizing
|
|
39
39
|
// anonymous connection is at the session start.
|
|
40
|
-
|
|
40
|
+
(0, utils_1.replyWithErr)(delivery_1.authSender.SC.authFailed, "Server is not accepting provided credentials.", res);
|
|
41
41
|
req.session.close();
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
if (!rb.assertion || !rb.userCert || !rb.provCert) {
|
|
45
|
-
|
|
45
|
+
(0, utils_1.replyWithErr)(delivery_1.ERR_SC.malformed, "No credentials given.", res);
|
|
46
46
|
req.session.close();
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
@@ -53,7 +53,7 @@ function authorize(relyingPartyDomain, midAuthorizingFunc) {
|
|
|
53
53
|
res.status(delivery_1.authSender.SC.ok).send();
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
|
|
56
|
+
(0, utils_1.replyWithErr)(delivery_1.authSender.SC.authFailed, "Server is not accepting provided credentials.", res);
|
|
57
57
|
req.session.close();
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2016, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2016, 2025 - 2026 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -20,6 +20,7 @@ exports.startSession = void 0;
|
|
|
20
20
|
const recipients_1 = require("../../resources/recipients");
|
|
21
21
|
const delivery_1 = require("../../../lib-common/service-api/asmail/delivery");
|
|
22
22
|
const canonical_address_1 = require("../../../lib-common/canonical-address");
|
|
23
|
+
const utils_1 = require("../../resources/utils");
|
|
23
24
|
/**
|
|
24
25
|
* This creates a start-session route handler.
|
|
25
26
|
* @param allowedMsgSizeFunc is a function returning promises, that
|
|
@@ -55,14 +56,10 @@ function startSession(allowedMsgSizeFunc, sessionGenFunc, redirectFunc) {
|
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
else if (msgSize === 0) {
|
|
58
|
-
|
|
59
|
-
error: `${sender ? sender : "Anonymous sender "} is not allowed to leave mail for ${recipient}`
|
|
60
|
-
});
|
|
59
|
+
(0, utils_1.replyWithErr)(delivery_1.sessionStart.SC.senderNotAllowed, `${sender ? sender : "Anonymous sender "} is not allowed to leave mail for ${recipient}`, res);
|
|
61
60
|
}
|
|
62
61
|
else if (msgSize === -1) {
|
|
63
|
-
|
|
64
|
-
error: `Mail box for ${recipient} is full.`
|
|
65
|
-
});
|
|
62
|
+
(0, utils_1.replyWithErr)(delivery_1.sessionStart.SC.inboxFull, `Mail box for ${recipient} is full.`, res);
|
|
66
63
|
}
|
|
67
64
|
else {
|
|
68
65
|
throw new Error(`Unrecognized code ${msgSize} for message size limits.`);
|
|
@@ -76,34 +73,24 @@ function startSession(allowedMsgSizeFunc, sessionGenFunc, redirectFunc) {
|
|
|
76
73
|
const session = req.session;
|
|
77
74
|
// already existing session indicates repeated call, which should be bounced off
|
|
78
75
|
if (session) {
|
|
79
|
-
|
|
80
|
-
error: "This protocol request has already been served."
|
|
81
|
-
});
|
|
76
|
+
(0, utils_1.replyWithErr)(delivery_1.ERR_SC.duplicateReq, "This protocol request has already been served.", res);
|
|
82
77
|
return;
|
|
83
78
|
}
|
|
84
79
|
// missing recipient makes a bad request
|
|
85
80
|
if (!recipient) {
|
|
86
|
-
|
|
87
|
-
error: "Recipient is either missing in the request, or is malformed"
|
|
88
|
-
});
|
|
81
|
+
(0, utils_1.replyWithErr)(delivery_1.ERR_SC.malformed, "Recipient is either missing in the request, or is malformed", res);
|
|
89
82
|
return;
|
|
90
83
|
}
|
|
91
84
|
// if sender is given, we canonicalize the address
|
|
92
85
|
if (sender) {
|
|
93
86
|
sender = (0, canonical_address_1.checkAndTransformAddress)(sender);
|
|
94
87
|
if (!sender) {
|
|
95
|
-
|
|
96
|
-
error: "Sender field is malformed"
|
|
97
|
-
});
|
|
98
|
-
return;
|
|
88
|
+
return (0, utils_1.replyWithErr)(delivery_1.ERR_SC.malformed, "Sender field is malformed", res);
|
|
99
89
|
}
|
|
100
90
|
}
|
|
101
91
|
// check invitation field
|
|
102
92
|
if ((invitation !== undefined) && (typeof invitation !== 'string')) {
|
|
103
|
-
|
|
104
|
-
error: "Inviation field is malformed"
|
|
105
|
-
});
|
|
106
|
-
return;
|
|
93
|
+
return (0, utils_1.replyWithErr)(delivery_1.ERR_SC.malformed, "Inviation field is malformed", res);
|
|
107
94
|
}
|
|
108
95
|
try {
|
|
109
96
|
if (redirectFunc) {
|
|
@@ -123,9 +110,7 @@ function startSession(allowedMsgSizeFunc, sessionGenFunc, redirectFunc) {
|
|
|
123
110
|
}
|
|
124
111
|
catch (err) {
|
|
125
112
|
if (err === recipients_1.SC.USER_UNKNOWN) {
|
|
126
|
-
|
|
127
|
-
error: `Recipient ${recipient} is unknown.`
|
|
128
|
-
});
|
|
113
|
+
(0, utils_1.replyWithErr)(delivery_1.sessionStart.SC.unknownRecipient, `Recipient ${recipient} is unknown.`, res);
|
|
129
114
|
}
|
|
130
115
|
else {
|
|
131
116
|
next(err);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2016, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2016, 2025 - 2026 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.getMsgMeta = void 0;
|
|
20
20
|
const recipients_1 = require("../../resources/recipients");
|
|
21
21
|
const retrieval_1 = require("../../../lib-common/service-api/asmail/retrieval");
|
|
22
|
+
const utils_1 = require("../../resources/utils");
|
|
22
23
|
function getMsgMeta(getMsgMetaFunc) {
|
|
23
24
|
return async (req, res, next) => {
|
|
24
25
|
const userId = req.session.params.userId;
|
|
@@ -32,14 +33,10 @@ function getMsgMeta(getMsgMetaFunc) {
|
|
|
32
33
|
next(err);
|
|
33
34
|
}
|
|
34
35
|
else if (err === recipients_1.SC.MSG_UNKNOWN) {
|
|
35
|
-
|
|
36
|
-
error: "Message " + msgId + " is unknown."
|
|
37
|
-
});
|
|
36
|
+
(0, utils_1.replyWithErr)(retrieval_1.msgMetadata.SC.unknownMsg, "Message " + msgId + " is unknown.", res);
|
|
38
37
|
}
|
|
39
38
|
else if (err === recipients_1.SC.USER_UNKNOWN) {
|
|
40
|
-
|
|
41
|
-
error: "Recipient disappeared from the system."
|
|
42
|
-
});
|
|
39
|
+
(0, utils_1.replyWithErr)(retrieval_1.ERR_SC.server, "Recipient disappeared from the system.", res);
|
|
43
40
|
req.session.close();
|
|
44
41
|
}
|
|
45
42
|
else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2017, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2017, 2025 - 2026 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -21,6 +21,7 @@ const recipients_1 = require("../../resources/recipients");
|
|
|
21
21
|
const retrieval_1 = require("../../../lib-common/service-api/asmail/retrieval");
|
|
22
22
|
const error_1 = require("../../../lib-common/exceptions/error");
|
|
23
23
|
const buffer_utils_1 = require("../../../lib-common/buffer-utils");
|
|
24
|
+
const utils_1 = require("../../resources/utils");
|
|
24
25
|
function extractQueryOptions(req) {
|
|
25
26
|
// query fields are string or undefined, yet, type info helps the show
|
|
26
27
|
const query = req.query;
|
|
@@ -41,11 +42,13 @@ function getMsgObj(getMsgObjFunc) {
|
|
|
41
42
|
return async (req, res, next) => {
|
|
42
43
|
const userId = req.session.params.userId;
|
|
43
44
|
const msgId = req.params.msgId;
|
|
44
|
-
const objId = req
|
|
45
|
+
const { objId, objIdParseErr } = (0, utils_1.getObjIdFromParams)(req);
|
|
46
|
+
if (objIdParseErr) {
|
|
47
|
+
return (0, utils_1.replyWithErr)(retrieval_1.ERR_SC.malformed, objIdParseErr, res);
|
|
48
|
+
}
|
|
45
49
|
const opts = extractQueryOptions(req);
|
|
46
50
|
if (!opts) {
|
|
47
|
-
|
|
48
|
-
return;
|
|
51
|
+
return (0, utils_1.replyWithErr)(retrieval_1.ERR_SC.malformed, "Bad query parameters", res);
|
|
49
52
|
}
|
|
50
53
|
try {
|
|
51
54
|
const reader = await getMsgObjFunc(userId, msgId, objId, opts.header, opts.ofs, opts.limit);
|
|
@@ -76,13 +79,13 @@ function getMsgObj(getMsgObjFunc) {
|
|
|
76
79
|
next(err);
|
|
77
80
|
}
|
|
78
81
|
else if (err === recipients_1.SC.OBJ_UNKNOWN) {
|
|
79
|
-
|
|
82
|
+
(0, utils_1.replyWithErr)(retrieval_1.msgObj.SC.unknownMsgOrObj, `Object ${objId} is unknown.`, res);
|
|
80
83
|
}
|
|
81
84
|
else if (err === recipients_1.SC.MSG_UNKNOWN) {
|
|
82
|
-
|
|
85
|
+
(0, utils_1.replyWithErr)(retrieval_1.msgObj.SC.unknownMsgOrObj, `Message ${msgId} is unknown.`, res);
|
|
83
86
|
}
|
|
84
87
|
else if (err === recipients_1.SC.USER_UNKNOWN) {
|
|
85
|
-
|
|
88
|
+
(0, utils_1.replyWithErr)(retrieval_1.ERR_SC.server, `Recipient disappeared from the system.`, res);
|
|
86
89
|
req.session.close();
|
|
87
90
|
}
|
|
88
91
|
else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2016, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2016, 2025 - 2026 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -19,13 +19,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.listMsgIds = void 0;
|
|
20
20
|
const recipients_1 = require("../../resources/recipients");
|
|
21
21
|
const retrieval_1 = require("../../../lib-common/service-api/asmail/retrieval");
|
|
22
|
+
const utils_1 = require("../../resources/utils");
|
|
22
23
|
function listMsgIds(listMsgIdsFunc) {
|
|
23
24
|
return async (req, res, next) => {
|
|
24
25
|
const userId = req.session.params.userId;
|
|
25
26
|
const opts = extractQueryOptions(req);
|
|
26
27
|
if (!opts) {
|
|
27
|
-
|
|
28
|
-
return;
|
|
28
|
+
return (0, utils_1.replyWithErr)(retrieval_1.ERR_SC.malformed, "Bad query parameters", res);
|
|
29
29
|
}
|
|
30
30
|
try {
|
|
31
31
|
const { from, to } = opts;
|
|
@@ -37,7 +37,7 @@ function listMsgIds(listMsgIdsFunc) {
|
|
|
37
37
|
next(err);
|
|
38
38
|
}
|
|
39
39
|
else if (err === recipients_1.SC.USER_UNKNOWN) {
|
|
40
|
-
|
|
40
|
+
(0, utils_1.replyWithErr)(retrieval_1.ERR_SC.server, "Recipient disappeared from the system.", res);
|
|
41
41
|
req.session.close();
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.deleteMsg = void 0;
|
|
20
20
|
const recipients_1 = require("../../resources/recipients");
|
|
21
21
|
const retrieval_1 = require("../../../lib-common/service-api/asmail/retrieval");
|
|
22
|
+
const utils_1 = require("../../resources/utils");
|
|
22
23
|
function deleteMsg(delMsgFunc) {
|
|
23
24
|
return async (req, res, next) => {
|
|
24
25
|
const userId = req.session.params.userId;
|
|
@@ -32,10 +33,10 @@ function deleteMsg(delMsgFunc) {
|
|
|
32
33
|
next(err);
|
|
33
34
|
}
|
|
34
35
|
else if (err === recipients_1.SC.MSG_UNKNOWN) {
|
|
35
|
-
|
|
36
|
+
(0, utils_1.replyWithErr)(retrieval_1.rmMsg.SC.unknownMsg, "Message " + msgId + " is unknown.", res);
|
|
36
37
|
}
|
|
37
38
|
else if (err === recipients_1.SC.USER_UNKNOWN) {
|
|
38
|
-
|
|
39
|
+
(0, utils_1.replyWithErr)(retrieval_1.ERR_SC.server, "Recipient disappeared from the system.", res);
|
|
39
40
|
req.session.close();
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
@@ -19,52 +19,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.sslOpts = void 0;
|
|
20
20
|
exports.sslOpts = {
|
|
21
21
|
key: `-----BEGIN PRIVATE KEY-----
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
22
|
+
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCggRGeSSbXoPby
|
|
23
|
+
CI943Lg80+0XFoJxbinkH+SEbNZ3IpuSQyaoaWTIGqjXH2tIO7D7Htr7XVsqIsQW
|
|
24
|
+
33K9ZxAGwowuDXduRD/TM2Fnt7OHKbQIOJehD6JZg/pg7IwJvUPRoLHfT7f3Obs9
|
|
25
|
+
i63CQhITxXimDR1MCw/+mwXJabT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657sReywAa6iunk8220vjRq8LlceJh3952ov
|
|
68
|
+
EEuI+hxj/ikVBSjQX8aFhX8kx4p4q/mKCOA5q3DCbmrr3Cn8fl0zRZZegrk9kfpV
|
|
69
|
+
QGCnHRJ0yQ==
|
|
68
70
|
-----END CERTIFICATE-----`
|
|
69
71
|
};
|
|
70
72
|
Object.freeze(exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016, 2020 - 2021, 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
|
+
const async_jasmine_1 = require("../libs-for-tests/async-jasmine");
|
|
20
|
+
const admin_1 = require("../libs-for-tests/server-components/admin");
|
|
21
|
+
const xhr_utils_1 = require("../libs-for-tests/xhr-utils");
|
|
22
|
+
const signupApi = require("../../lib-common/admin-api/signup");
|
|
23
|
+
const requests_1 = require("../shared-checks/requests");
|
|
24
|
+
const jwkeys_1 = require("../../lib-common/jwkeys");
|
|
25
|
+
const ecma_nacl_1 = require("ecma-nacl");
|
|
26
|
+
describe('Admin', () => {
|
|
27
|
+
describe('signup subsystem', () => {
|
|
28
|
+
let admin;
|
|
29
|
+
const signupDomains = ['first.org', 'second.org'];
|
|
30
|
+
(0, async_jasmine_1.beforeEachAsync)(async () => {
|
|
31
|
+
admin = new admin_1.AdminComponent(signupDomains);
|
|
32
|
+
await admin.start();
|
|
33
|
+
});
|
|
34
|
+
(0, async_jasmine_1.afterEachAsync)(async () => {
|
|
35
|
+
await admin.stop();
|
|
36
|
+
admin = undefined;
|
|
37
|
+
});
|
|
38
|
+
(0, async_jasmine_1.itAsync)('tells available addresses for a given name', async () => {
|
|
39
|
+
const REQ_SIZE_LIMIT = 1024;
|
|
40
|
+
const name = 'Bob Marley ';
|
|
41
|
+
const reqOpts = {
|
|
42
|
+
url: admin.signupUrl + signupApi.availableAddressesForName.URL_END,
|
|
43
|
+
method: 'POST',
|
|
44
|
+
responseType: 'json'
|
|
45
|
+
};
|
|
46
|
+
// request with ok name
|
|
47
|
+
let req = { name };
|
|
48
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
49
|
+
expect(rep.status).withContext('status code for OK reply').toBe(signupApi.availableAddressesForName.SC.ok);
|
|
50
|
+
expect(Array.isArray(rep.data)).withContext('OK reply is an array').toBe(true);
|
|
51
|
+
expect(rep.data.length).withContext('with no users, all domains should used as options for available addresses').toBe(signupDomains.length);
|
|
52
|
+
for (const domain of signupDomains) {
|
|
53
|
+
expect(rep.data).toContain(name + '@' + domain);
|
|
54
|
+
}
|
|
55
|
+
// requests with bad names and with bad json's
|
|
56
|
+
const badNames = [name + '@something',
|
|
57
|
+
5, null, undefined, {}]; // non-strings
|
|
58
|
+
const badJSONs = [name, 5, null, undefined, [name],
|
|
59
|
+
{ a: 1 }];
|
|
60
|
+
for (const badName of badNames) {
|
|
61
|
+
req = { name: badName };
|
|
62
|
+
badJSONs.push(req);
|
|
63
|
+
}
|
|
64
|
+
await (0, requests_1.expectNonAcceptanceOfBadJsonRequest)(reqOpts, REQ_SIZE_LIMIT, badJSONs);
|
|
65
|
+
});
|
|
66
|
+
(0, async_jasmine_1.itAsync)('tells available domains', async () => {
|
|
67
|
+
const REQ_SIZE_LIMIT = 1024;
|
|
68
|
+
const reqOpts = {
|
|
69
|
+
url: admin.signupUrl + signupApi.availableDomains.URL_END,
|
|
70
|
+
method: 'POST',
|
|
71
|
+
responseType: 'json'
|
|
72
|
+
};
|
|
73
|
+
const req = {};
|
|
74
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
75
|
+
expect(rep.status).withContext('status code for OK reply').toBe(signupApi.availableDomains.SC.ok);
|
|
76
|
+
expect(Array.isArray(rep.data)).withContext('OK reply is an array').toBe(true);
|
|
77
|
+
expect(rep.data.length).withContext('with no token, all domains should be given as options').toBe(signupDomains.length);
|
|
78
|
+
for (const domain of signupDomains) {
|
|
79
|
+
expect(rep.data).toContain(domain);
|
|
80
|
+
}
|
|
81
|
+
// requests with bad json's
|
|
82
|
+
const badJSONs = [{ signupToken: 4 }];
|
|
83
|
+
await (0, requests_1.expectNonAcceptanceOfBadJsonRequest)(reqOpts, REQ_SIZE_LIMIT, badJSONs);
|
|
84
|
+
});
|
|
85
|
+
async function getAvailableAddressesFor(name) {
|
|
86
|
+
const reqOpts = {
|
|
87
|
+
url: admin.signupUrl + signupApi.availableAddressesForName.URL_END,
|
|
88
|
+
method: 'POST',
|
|
89
|
+
responseType: 'json'
|
|
90
|
+
};
|
|
91
|
+
const req = { name };
|
|
92
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
93
|
+
expect(rep.status).toBe(signupApi.availableAddressesForName.SC.ok);
|
|
94
|
+
return rep.data;
|
|
95
|
+
}
|
|
96
|
+
function makeAddUserReq(userId, signupToken) {
|
|
97
|
+
return {
|
|
98
|
+
userId,
|
|
99
|
+
storage: {
|
|
100
|
+
kdParams: {}
|
|
101
|
+
},
|
|
102
|
+
mailerId: {
|
|
103
|
+
defaultPKey: {
|
|
104
|
+
pkey: {
|
|
105
|
+
alg: ecma_nacl_1.box.JWK_ALG_NAME,
|
|
106
|
+
kid: (Buffer.alloc(12)).toString('base64'),
|
|
107
|
+
use: jwkeys_1.use.MID_PKLOGIN,
|
|
108
|
+
k: (Buffer.alloc(ecma_nacl_1.box.KEY_LENGTH)).toString('base64')
|
|
109
|
+
},
|
|
110
|
+
kdParams: {}
|
|
111
|
+
},
|
|
112
|
+
otherPKeys: [{
|
|
113
|
+
alg: ecma_nacl_1.box.JWK_ALG_NAME,
|
|
114
|
+
kid: (Buffer.alloc(12)).toString('base64'),
|
|
115
|
+
use: jwkeys_1.use.MID_PKLOGIN,
|
|
116
|
+
k: (Buffer.alloc(ecma_nacl_1.box.KEY_LENGTH)).toString('base64')
|
|
117
|
+
}]
|
|
118
|
+
},
|
|
119
|
+
signupToken
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function makeBadAddUserReq(goodId) {
|
|
123
|
+
const name = 'Bob Marley';
|
|
124
|
+
const badJSONs = [name, 5, null, undefined, [name],
|
|
125
|
+
{ a: 1 }];
|
|
126
|
+
const badIds = ['bad domain str',
|
|
127
|
+
'', ' ', '\t', '\n',
|
|
128
|
+
5, null, undefined, {}]; // non-strings
|
|
129
|
+
for (const id of badIds) {
|
|
130
|
+
const req = makeAddUserReq(id);
|
|
131
|
+
badJSONs.push(req);
|
|
132
|
+
}
|
|
133
|
+
let req = makeAddUserReq(goodId);
|
|
134
|
+
delete req.userId;
|
|
135
|
+
badJSONs.push(req);
|
|
136
|
+
req = makeAddUserReq(goodId);
|
|
137
|
+
delete req.storage;
|
|
138
|
+
badJSONs.push(req);
|
|
139
|
+
req = makeAddUserReq(goodId);
|
|
140
|
+
delete req.storage.kdParams;
|
|
141
|
+
badJSONs.push(req);
|
|
142
|
+
req = makeAddUserReq(goodId);
|
|
143
|
+
delete req.mailerId;
|
|
144
|
+
badJSONs.push(req);
|
|
145
|
+
req = makeAddUserReq(goodId);
|
|
146
|
+
delete req.mailerId.defaultPKey;
|
|
147
|
+
badJSONs.push(req);
|
|
148
|
+
req = makeAddUserReq(goodId);
|
|
149
|
+
delete req.mailerId.defaultPKey.pkey.alg;
|
|
150
|
+
badJSONs.push(req);
|
|
151
|
+
req = makeAddUserReq(goodId);
|
|
152
|
+
delete req.mailerId.defaultPKey.pkey.k;
|
|
153
|
+
badJSONs.push(req);
|
|
154
|
+
req = makeAddUserReq(goodId);
|
|
155
|
+
delete req.mailerId.defaultPKey.pkey.kid;
|
|
156
|
+
badJSONs.push(req);
|
|
157
|
+
req = makeAddUserReq(goodId);
|
|
158
|
+
delete req.mailerId.defaultPKey.pkey.use;
|
|
159
|
+
badJSONs.push(req);
|
|
160
|
+
req = makeAddUserReq(goodId);
|
|
161
|
+
delete req.mailerId.defaultPKey.kdParams;
|
|
162
|
+
badJSONs.push(req);
|
|
163
|
+
req = makeAddUserReq(goodId);
|
|
164
|
+
delete req.mailerId.otherPKeys;
|
|
165
|
+
badJSONs.push(req);
|
|
166
|
+
req = makeAddUserReq(goodId);
|
|
167
|
+
req.mailerId.otherPKeys.shift();
|
|
168
|
+
badJSONs.push(req);
|
|
169
|
+
req = makeAddUserReq(goodId);
|
|
170
|
+
delete req.mailerId.otherPKeys[0].alg;
|
|
171
|
+
badJSONs.push(req);
|
|
172
|
+
req = makeAddUserReq(goodId);
|
|
173
|
+
delete req.mailerId.otherPKeys[0].k;
|
|
174
|
+
badJSONs.push(req);
|
|
175
|
+
req = makeAddUserReq(goodId);
|
|
176
|
+
delete req.mailerId.otherPKeys[0].kid;
|
|
177
|
+
badJSONs.push(req);
|
|
178
|
+
req = makeAddUserReq(goodId);
|
|
179
|
+
delete req.mailerId.otherPKeys[0].use;
|
|
180
|
+
badJSONs.push(req);
|
|
181
|
+
return badJSONs;
|
|
182
|
+
}
|
|
183
|
+
async function addNewUser(userId, signupToken) {
|
|
184
|
+
const reqOpts = {
|
|
185
|
+
url: admin.signupUrl + signupApi.addUser.URL_END,
|
|
186
|
+
method: 'POST'
|
|
187
|
+
};
|
|
188
|
+
const req = makeAddUserReq(userId, signupToken);
|
|
189
|
+
let rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
190
|
+
expect(rep.status).withContext('status when user is added').toBe(signupApi.addUser.SC.ok);
|
|
191
|
+
rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
192
|
+
expect(rep.status).withContext('status when user already exists').toBe(signupApi.addUser.SC.userAlreadyExists);
|
|
193
|
+
}
|
|
194
|
+
(0, async_jasmine_1.itAsync)('adds new user', async () => {
|
|
195
|
+
const REQ_SIZE_LIMIT = 4 * 1024;
|
|
196
|
+
const reqOpts = {
|
|
197
|
+
url: admin.signupUrl + signupApi.addUser.URL_END,
|
|
198
|
+
method: 'POST'
|
|
199
|
+
};
|
|
200
|
+
const name = 'Bob Marley ';
|
|
201
|
+
let addresses = await getAvailableAddressesFor(name);
|
|
202
|
+
let numOfAvailableAddresses = addresses.length;
|
|
203
|
+
expect(numOfAvailableAddresses).toBe(signupDomains.length);
|
|
204
|
+
// requests with bad json's
|
|
205
|
+
const badJSONs = makeBadAddUserReq(addresses[0]);
|
|
206
|
+
await (0, requests_1.expectNonAcceptanceOfBadJsonRequest)(reqOpts, REQ_SIZE_LIMIT, badJSONs);
|
|
207
|
+
// normal adding users
|
|
208
|
+
for (const userId of addresses) {
|
|
209
|
+
expect(addresses).toContain(userId);
|
|
210
|
+
await addNewUser(userId);
|
|
211
|
+
numOfAvailableAddresses -= 1;
|
|
212
|
+
addresses = await getAvailableAddressesFor(name);
|
|
213
|
+
expect(addresses.length).toBe(numOfAvailableAddresses);
|
|
214
|
+
expect(addresses).not.toContain(userId);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
(0, async_jasmine_1.itAsync)(`adds new user with token`, async () => {
|
|
218
|
+
const reqOpts = {
|
|
219
|
+
url: admin.signupUrl + signupApi.addUser.URL_END,
|
|
220
|
+
method: 'POST'
|
|
221
|
+
};
|
|
222
|
+
// note that new id has other domain that isn't set anywhere
|
|
223
|
+
const userId = 'Pink Floyd @home.town';
|
|
224
|
+
// let's try to do this without any token
|
|
225
|
+
let req = makeAddUserReq(userId);
|
|
226
|
+
let rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
227
|
+
expect(rep.status).withContext('status when no token given').toBe(signupApi.addUser.SC.unauthorized);
|
|
228
|
+
// create token, here setup code uses spec-server specific code
|
|
229
|
+
const token = await admin.createSingleUserSignupTokenFor(userId);
|
|
230
|
+
req = makeAddUserReq(userId, token);
|
|
231
|
+
rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
232
|
+
expect(rep.status).withContext('status when user is added').toBe(signupApi.addUser.SC.ok);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const jas: any;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2016 3NSoft Inc.
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
7
|
+
version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful, but
|
|
10
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
12
|
+
See the GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License along with
|
|
15
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
// NOTE: due to bad definition file, typescript below is not very type-strict.
|
|
18
|
+
const jas = new (require('jasmine'))();
|
|
19
|
+
jas.loadConfig({
|
|
20
|
+
spec_dir: 'build/tests',
|
|
21
|
+
spec_files: [
|
|
22
|
+
'admin-proto/**/*.js',
|
|
23
|
+
'protocols/mailerid.js',
|
|
24
|
+
'protocols/3nstorage/*.js',
|
|
25
|
+
'protocols/asmail/*.js',
|
|
26
|
+
],
|
|
27
|
+
random: false
|
|
28
|
+
});
|
|
29
|
+
jas.configureDefaultReporter({
|
|
30
|
+
showColors: true
|
|
31
|
+
});
|
|
32
|
+
jas.execute();
|