spec-3nweb-server 1.8.5 → 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/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/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,73 @@
|
|
|
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 test_utils_1 = require("../test-utils");
|
|
21
|
+
const owner_1 = require("../../../../../lib-common/service-api/3nstorage/owner");
|
|
22
|
+
const async_jasmine_1 = require("../../../../libs-for-tests/async-jasmine");
|
|
23
|
+
const xhr_utils_1 = require("../../../../libs-for-tests/xhr-utils");
|
|
24
|
+
const requests_1 = require("../../../../shared-checks/requests");
|
|
25
|
+
const random_node_1 = require("../../../../../lib-common/random-node");
|
|
26
|
+
const url_1 = require("url");
|
|
27
|
+
exports.specs = {
|
|
28
|
+
description: 'Request to cancel root object transaction'
|
|
29
|
+
};
|
|
30
|
+
const obj = {
|
|
31
|
+
objId: null,
|
|
32
|
+
version: 1,
|
|
33
|
+
header: (0, random_node_1.bytesSync)(100),
|
|
34
|
+
segs: (0, random_node_1.bytesSync)(573)
|
|
35
|
+
};
|
|
36
|
+
exports.specs.definition = (setup) => (() => {
|
|
37
|
+
let reqOpts;
|
|
38
|
+
let storageServer;
|
|
39
|
+
let user;
|
|
40
|
+
let transactionId;
|
|
41
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
42
|
+
storageServer = setup().storageServer;
|
|
43
|
+
user = setup().user;
|
|
44
|
+
await storageServer.restartAndClearStorageFor(user.id);
|
|
45
|
+
const sessionId = await (0, test_utils_1.startSession)(user);
|
|
46
|
+
const fstReqOpts = {
|
|
47
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, owner_1.currentRootObj.firstPutReqUrlEnd({
|
|
48
|
+
ver: 1, header: obj.header.length
|
|
49
|
+
})),
|
|
50
|
+
method: 'PUT',
|
|
51
|
+
sessionId
|
|
52
|
+
};
|
|
53
|
+
const fstRep = await (0, xhr_utils_1.doBinaryRequest)(fstReqOpts, obj.header);
|
|
54
|
+
transactionId = fstRep.data.transactionId;
|
|
55
|
+
reqOpts = {
|
|
56
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, owner_1.cancelRootTransaction.getReqUrlEnd(transactionId)),
|
|
57
|
+
method: 'POST',
|
|
58
|
+
sessionId
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
(0, async_jasmine_1.itAsync)('cancels root object transaction', async () => {
|
|
62
|
+
expect(await storageServer.currentRootObjExists(user.id)).withContext('initially, there is no root object').toBeFalsy();
|
|
63
|
+
expect(await storageServer.rootTransactionExists(user.id)).withContext('initially, there is a started transaction').toBeTruthy();
|
|
64
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
65
|
+
expect(rep.status).withContext('status for normal transaction cancelation').toBe(owner_1.cancelRootTransaction.SC.ok);
|
|
66
|
+
expect(await storageServer.rootTransactionExists(user.id)).withContext('transaction should not exist, as it has been cancelled.').toBeFalsy();
|
|
67
|
+
expect(await storageServer.currentRootObjExists(user.id, 1, obj)).withContext('object is not created, cause transaction has been cancelled').toBeFalsy();
|
|
68
|
+
// XXX split out fuzzing requests
|
|
69
|
+
await (0, requests_1.expectNonAcceptanceOfNonEmptyBody)(reqOpts);
|
|
70
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(reqOpts);
|
|
71
|
+
});
|
|
72
|
+
// XXX add cancelation with unknown transaction id (repeat request)
|
|
73
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
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 test_utils_1 = require("../test-utils");
|
|
21
|
+
const owner_1 = require("../../../../../lib-common/service-api/3nstorage/owner");
|
|
22
|
+
const async_jasmine_1 = require("../../../../libs-for-tests/async-jasmine");
|
|
23
|
+
const xhr_utils_1 = require("../../../../libs-for-tests/xhr-utils");
|
|
24
|
+
const requests_1 = require("../../../../shared-checks/requests");
|
|
25
|
+
const random_node_1 = require("../../../../../lib-common/random-node");
|
|
26
|
+
const url_1 = require("url");
|
|
27
|
+
exports.specs = {
|
|
28
|
+
description: 'Request to cancel non-root object transaction'
|
|
29
|
+
};
|
|
30
|
+
const obj = {
|
|
31
|
+
objId: 'aaaa',
|
|
32
|
+
version: 1,
|
|
33
|
+
header: (0, random_node_1.bytesSync)(100),
|
|
34
|
+
segs: (0, random_node_1.bytesSync)(573)
|
|
35
|
+
};
|
|
36
|
+
exports.specs.definition = (setup) => (() => {
|
|
37
|
+
let reqOpts;
|
|
38
|
+
let storageServer;
|
|
39
|
+
let user;
|
|
40
|
+
let transactionId;
|
|
41
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
42
|
+
storageServer = setup().storageServer;
|
|
43
|
+
user = setup().user;
|
|
44
|
+
await storageServer.restartAndClearStorageFor(user.id);
|
|
45
|
+
const sessionId = await (0, test_utils_1.startSession)(user);
|
|
46
|
+
const fstReqOpts = {
|
|
47
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, owner_1.currentObj.firstPutReqUrlEnd(obj.objId, { ver: 1, header: obj.header.length })),
|
|
48
|
+
method: 'PUT',
|
|
49
|
+
sessionId
|
|
50
|
+
};
|
|
51
|
+
const fstRep = await (0, xhr_utils_1.doBinaryRequest)(fstReqOpts, obj.header);
|
|
52
|
+
transactionId = fstRep.data.transactionId;
|
|
53
|
+
reqOpts = {
|
|
54
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, owner_1.cancelTransaction.getReqUrlEnd(obj.objId, transactionId)),
|
|
55
|
+
method: 'POST',
|
|
56
|
+
sessionId: sessionId
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
(0, async_jasmine_1.itAsync)('cancels object transaction', async () => {
|
|
60
|
+
expect(await storageServer.currentObjExists(user.id, obj.objId)).withContext('initially, there is no object').toBeFalsy();
|
|
61
|
+
expect(await storageServer.transactionExists(user.id, obj.objId)).withContext('initially, there is a started transaction').toBeTruthy();
|
|
62
|
+
// normal reply
|
|
63
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
64
|
+
expect(rep.status).withContext('status for normal transaction completion').toBe(owner_1.cancelTransaction.SC.ok);
|
|
65
|
+
expect(await storageServer.transactionExists(user.id, obj.objId)).withContext('transaction should not be present, as it has been completed').toBeFalsy();
|
|
66
|
+
expect(await storageServer.currentObjExists(user.id, obj.objId, 1, obj)).withContext('object is not created, cause transaction has been cancelled').toBeFalsy();
|
|
67
|
+
// XXX split out fuzzing requests
|
|
68
|
+
await (0, requests_1.expectNonAcceptanceOfNonEmptyBody)(reqOpts);
|
|
69
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(reqOpts);
|
|
70
|
+
});
|
|
71
|
+
// XXX add cancelation with unknown object id, and unknown transaction id
|
|
72
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { User } from '../../../libs-for-tests/mailerid';
|
|
2
|
+
import * as api from '../../../../lib-common/service-api/3nstorage/owner';
|
|
3
|
+
import { StorageComponent } from '../../../libs-for-tests/server-components/3nstorage';
|
|
4
|
+
import { GenericSpecDescribe } from '../../../libs-for-tests/spec-assembly';
|
|
5
|
+
export { User } from '../../../libs-for-tests/mailerid';
|
|
6
|
+
export { StorageComponent } from '../../../libs-for-tests/server-components/3nstorage';
|
|
7
|
+
export interface TestSetup {
|
|
8
|
+
user: User;
|
|
9
|
+
storageServer: StorageComponent;
|
|
10
|
+
}
|
|
11
|
+
export type SpecDescribe = GenericSpecDescribe<TestSetup>;
|
|
12
|
+
export declare function startSession(user: User): Promise<string>;
|
|
13
|
+
export declare function getObjStatus(user: User, objId: string | null, sessionId: string): Promise<api.ObjStatus>;
|
|
14
|
+
export declare function archiveObjVer(user: User, objId: string | null, version: number, sessionId: string): Promise<void>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016, 2022 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.archiveObjVer = exports.getObjStatus = exports.startSession = exports.StorageComponent = void 0;
|
|
20
|
+
const mailerid_1 = require("../../../libs-for-tests/mailerid");
|
|
21
|
+
const url_1 = require("url");
|
|
22
|
+
const api = require("../../../../lib-common/service-api/3nstorage/owner");
|
|
23
|
+
const xhr_utils_1 = require("../../../libs-for-tests/xhr-utils");
|
|
24
|
+
const assert_1 = require("../../../libs-for-tests/assert");
|
|
25
|
+
var _3nstorage_1 = require("../../../libs-for-tests/server-components/3nstorage");
|
|
26
|
+
Object.defineProperty(exports, "StorageComponent", { enumerable: true, get: function () { return _3nstorage_1.StorageComponent; } });
|
|
27
|
+
async function startSession(user) {
|
|
28
|
+
return await (0, mailerid_1.doMailerIdLogin)((0, url_1.resolve)(user.storageOwnerUrl, api.midLogin.URL_PART), user);
|
|
29
|
+
}
|
|
30
|
+
exports.startSession = startSession;
|
|
31
|
+
async function getObjStatus(user, objId, sessionId) {
|
|
32
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)({
|
|
33
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, (objId ?
|
|
34
|
+
api.objStatus.getReqUrlEnd(objId) : api.rootStatus.getReqUrlEnd())),
|
|
35
|
+
method: 'GET',
|
|
36
|
+
sessionId,
|
|
37
|
+
responseType: 'json'
|
|
38
|
+
});
|
|
39
|
+
(0, assert_1.assert)(rep.status === api.objStatus.SC.ok, `Unexpected status ${rep.status} with data ${rep.data}, when listing archived versions of object ${objId}`);
|
|
40
|
+
return rep.data;
|
|
41
|
+
}
|
|
42
|
+
exports.getObjStatus = getObjStatus;
|
|
43
|
+
async function archiveObjVer(user, objId, version, sessionId) {
|
|
44
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)({
|
|
45
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, (objId ?
|
|
46
|
+
api.archiveObj.postAndDelReqUrlEnd(objId, version) :
|
|
47
|
+
api.archiveRoot.postAndDelReqUrlEnd(version))),
|
|
48
|
+
method: 'POST',
|
|
49
|
+
sessionId
|
|
50
|
+
});
|
|
51
|
+
(0, assert_1.assert)(rep.status === api.archiveObj.SC.okPost, `Unexpected status ${rep.status} with data ${rep.data}, when archiving version ${version} of object ${objId}`);
|
|
52
|
+
}
|
|
53
|
+
exports.archiveObjVer = archiveObjVer;
|
|
54
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016, 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 _3nstorage_1 = require("../../libs-for-tests/server-components/3nstorage");
|
|
21
|
+
const mailerid_1 = require("../../libs-for-tests/mailerid");
|
|
22
|
+
const check_mid_login_1 = require("../../shared-checks/check-mid-login");
|
|
23
|
+
const url_1 = require("url");
|
|
24
|
+
const api = require("../../../lib-common/service-api/3nstorage/owner");
|
|
25
|
+
const xhr_utils_1 = require("../../libs-for-tests/xhr-utils");
|
|
26
|
+
const requests_1 = require("../../shared-checks/requests");
|
|
27
|
+
const test_utils_1 = require("./owner/test-utils");
|
|
28
|
+
const path_1 = require("path");
|
|
29
|
+
const spec_assembly_1 = require("../../libs-for-tests/spec-assembly");
|
|
30
|
+
const json_equal_1 = require("../../libs-for-tests/json-equal");
|
|
31
|
+
const SPECS_FOLDER = (0, path_1.join)(__dirname, './owner/specs');
|
|
32
|
+
describe('3NStorage owner service', () => {
|
|
33
|
+
let storageServer;
|
|
34
|
+
const midServiceDomain = 'localhost';
|
|
35
|
+
const signupDomains = ['company.inc', 'personal.net'];
|
|
36
|
+
let user;
|
|
37
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
38
|
+
storageServer = new _3nstorage_1.StorageComponent(signupDomains, midServiceDomain);
|
|
39
|
+
await storageServer.start();
|
|
40
|
+
user = await storageServer.addUser(`Bob Johnson @${signupDomains[0]}`);
|
|
41
|
+
await storageServer.stop(false);
|
|
42
|
+
});
|
|
43
|
+
(0, async_jasmine_1.afterAllAsync)(async () => {
|
|
44
|
+
if (storageServer.isRunning()) {
|
|
45
|
+
await storageServer.stop();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
await storageServer.clean();
|
|
49
|
+
}
|
|
50
|
+
storageServer = undefined;
|
|
51
|
+
});
|
|
52
|
+
describe('session', () => {
|
|
53
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
54
|
+
await storageServer.restart();
|
|
55
|
+
});
|
|
56
|
+
describe('MailerId login', (0, check_mid_login_1.midLoginSpecs)(() => (0, url_1.resolve)(user.storageOwnerUrl, api.midLogin.URL_PART), () => user));
|
|
57
|
+
(0, async_jasmine_1.itAsync)('closing', async () => {
|
|
58
|
+
const sessionId = await (0, test_utils_1.startSession)(user);
|
|
59
|
+
const reqOpts = {
|
|
60
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, api.closeSession.URL_END),
|
|
61
|
+
method: 'POST',
|
|
62
|
+
sessionId
|
|
63
|
+
};
|
|
64
|
+
// normal closing of a session
|
|
65
|
+
let rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
66
|
+
expect(rep.status).withContext('status for successful closing of session').toBe(200);
|
|
67
|
+
// repeated call should see invalid session respose
|
|
68
|
+
rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
69
|
+
expect(rep.status).toBe(api.ERR_SC.needAuth);
|
|
70
|
+
reqOpts.sessionId = await (0, mailerid_1.doMailerIdLogin)((0, url_1.resolve)(user.storageOwnerUrl, api.midLogin.URL_PART), user);
|
|
71
|
+
await (0, requests_1.expectNonAcceptanceOfNonEmptyBody)(reqOpts);
|
|
72
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(reqOpts);
|
|
73
|
+
});
|
|
74
|
+
(0, async_jasmine_1.itAsync)('dictates parameters to client side', async () => {
|
|
75
|
+
const ownerUrl = user.storageOwnerUrl;
|
|
76
|
+
const sessionId = await (0, test_utils_1.startSession)(user);
|
|
77
|
+
const reqOpts = {
|
|
78
|
+
url: (0, url_1.resolve)(ownerUrl, api.sessionParams.URL_END),
|
|
79
|
+
method: 'GET',
|
|
80
|
+
responseType: 'json',
|
|
81
|
+
sessionId
|
|
82
|
+
};
|
|
83
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
84
|
+
expect(rep.status).withContext('for successful getting of session parameters').toBe(200);
|
|
85
|
+
expect(typeof rep.data.maxChunkSize).toBe('number');
|
|
86
|
+
expect(rep.data.maxChunkSize).not.toBeLessThan(64 * 1024);
|
|
87
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(reqOpts);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
function checkParamRoutes(paramUrlPart, goodValues, badValues, maxBodyLen) {
|
|
91
|
+
return () => {
|
|
92
|
+
let sessionId;
|
|
93
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
94
|
+
sessionId = await (0, test_utils_1.startSession)(user);
|
|
95
|
+
});
|
|
96
|
+
(0, async_jasmine_1.itAsync)('is readable', async () => {
|
|
97
|
+
const reqOpts = {
|
|
98
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, paramUrlPart),
|
|
99
|
+
method: 'GET',
|
|
100
|
+
responseType: 'json',
|
|
101
|
+
sessionId
|
|
102
|
+
};
|
|
103
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
104
|
+
expect(rep.status).withContext('status for reading parameter').toBe(api.PARAM_SC.ok);
|
|
105
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(reqOpts);
|
|
106
|
+
});
|
|
107
|
+
async function getParam() {
|
|
108
|
+
const reqOpts = {
|
|
109
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, paramUrlPart),
|
|
110
|
+
method: 'GET',
|
|
111
|
+
responseType: 'json',
|
|
112
|
+
sessionId
|
|
113
|
+
};
|
|
114
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
115
|
+
expect(rep.status).toBe(api.PARAM_SC.ok);
|
|
116
|
+
return rep.data;
|
|
117
|
+
}
|
|
118
|
+
(0, async_jasmine_1.itAsync)('is writable', async () => {
|
|
119
|
+
const initValue = await getParam();
|
|
120
|
+
const reqOpts = {
|
|
121
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, paramUrlPart),
|
|
122
|
+
method: 'PUT',
|
|
123
|
+
sessionId
|
|
124
|
+
};
|
|
125
|
+
for (const paramVal of goodValues) {
|
|
126
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, paramVal);
|
|
127
|
+
expect(rep.status).withContext('status for successful parameter value update').toBe(api.PARAM_SC.ok);
|
|
128
|
+
const paramOnServer = await getParam();
|
|
129
|
+
expect((0, json_equal_1.deepEqual)(paramVal, paramOnServer)).withContext('parameter value on the server should be set to new value').toBe(true);
|
|
130
|
+
}
|
|
131
|
+
await (0, requests_1.expectNonAcceptanceOfBadJsonRequest)(reqOpts, maxBodyLen, badValues);
|
|
132
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(reqOpts);
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
describe(`user's key derivation parameters`, checkParamRoutes(api.keyDerivParams.URL_END, [], [1, undefined, 'string', [1, 2], []], 1024));
|
|
137
|
+
(0, spec_assembly_1.addSpecsFrom)(SPECS_FOLDER, () => ({ user, storageServer }));
|
|
138
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016, 2020, 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 asmail_1 = require("../../libs-for-tests/server-components/asmail");
|
|
21
|
+
const mailerid_1 = require("../../libs-for-tests/mailerid");
|
|
22
|
+
const check_mid_login_1 = require("../../shared-checks/check-mid-login");
|
|
23
|
+
const api = require("../../../lib-common/service-api/asmail/config");
|
|
24
|
+
const xhr_utils_1 = require("../../libs-for-tests/xhr-utils");
|
|
25
|
+
const requests_1 = require("../../shared-checks/requests");
|
|
26
|
+
const url_1 = require("url");
|
|
27
|
+
const json_equal_1 = require("../../libs-for-tests/json-equal");
|
|
28
|
+
describe('ASMail configuration', () => {
|
|
29
|
+
let asmailServer;
|
|
30
|
+
const midServiceDomain = 'localhost';
|
|
31
|
+
const signupDomains = ['company.inc', 'personal.net'];
|
|
32
|
+
let user1;
|
|
33
|
+
let confUrl;
|
|
34
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
35
|
+
asmailServer = new asmail_1.ASMailComponent(signupDomains, midServiceDomain);
|
|
36
|
+
await asmailServer.start();
|
|
37
|
+
confUrl = await asmailServer.getConfUrl();
|
|
38
|
+
if (!confUrl.endsWith('/')) {
|
|
39
|
+
confUrl += '/';
|
|
40
|
+
}
|
|
41
|
+
user1 = await asmailServer.addUser(`Bob Johnson @${signupDomains[0]}`);
|
|
42
|
+
});
|
|
43
|
+
(0, async_jasmine_1.afterAllAsync)(async () => {
|
|
44
|
+
await asmailServer.stop();
|
|
45
|
+
asmailServer = undefined;
|
|
46
|
+
});
|
|
47
|
+
describe('MailerId login', (0, check_mid_login_1.midLoginSpecs)(() => (0, url_1.resolve)(confUrl, api.midLogin.URL_PART), () => user1));
|
|
48
|
+
async function startSession(user) {
|
|
49
|
+
return await (0, mailerid_1.doMailerIdLogin)((0, url_1.resolve)(confUrl, api.midLogin.URL_PART), user);
|
|
50
|
+
}
|
|
51
|
+
function checkParamRoutes(paramUrlPart, goodValues, badValues, maxBodyLen) {
|
|
52
|
+
return () => {
|
|
53
|
+
let sessionId;
|
|
54
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
55
|
+
sessionId = await startSession(user1);
|
|
56
|
+
});
|
|
57
|
+
(0, async_jasmine_1.itAsync)('is readable', async () => {
|
|
58
|
+
const reqOpts = {
|
|
59
|
+
url: (0, url_1.resolve)(confUrl, paramUrlPart),
|
|
60
|
+
method: 'GET',
|
|
61
|
+
responseType: 'json',
|
|
62
|
+
sessionId
|
|
63
|
+
};
|
|
64
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
65
|
+
expect(rep.status).withContext('status for reading parameter').toBe(api.PARAM_SC.ok);
|
|
66
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(reqOpts);
|
|
67
|
+
});
|
|
68
|
+
async function getParam() {
|
|
69
|
+
const reqOpts = {
|
|
70
|
+
url: (0, url_1.resolve)(confUrl, paramUrlPart),
|
|
71
|
+
method: 'GET',
|
|
72
|
+
responseType: 'json',
|
|
73
|
+
sessionId
|
|
74
|
+
};
|
|
75
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
76
|
+
expect(rep.status).toBe(api.PARAM_SC.ok);
|
|
77
|
+
return rep.data;
|
|
78
|
+
}
|
|
79
|
+
(0, async_jasmine_1.itAsync)('is writable', async () => {
|
|
80
|
+
const reqOpts = {
|
|
81
|
+
url: (0, url_1.resolve)(confUrl, paramUrlPart),
|
|
82
|
+
method: 'PUT',
|
|
83
|
+
sessionId
|
|
84
|
+
};
|
|
85
|
+
for (const paramVal of goodValues) {
|
|
86
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, paramVal);
|
|
87
|
+
expect(rep.status).withContext('status for successful parameter value update').toBe(api.PARAM_SC.ok);
|
|
88
|
+
const paramOnServer = await getParam();
|
|
89
|
+
expect((0, json_equal_1.deepEqual)(paramVal, paramOnServer)).withContext('parameter value on the server should be set to new value').toBe(true);
|
|
90
|
+
}
|
|
91
|
+
await (0, requests_1.expectNonAcceptanceOfBadJsonRequest)(reqOpts, maxBodyLen, badValues);
|
|
92
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(reqOpts);
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
// TODO add route checking for other parameters,
|
|
97
|
+
// write stricter good/bad values that go into the check
|
|
98
|
+
describe(`user's initial public key`, checkParamRoutes(api.p.initPubKey.URL_END, [], [1, undefined, 'string', [1, 2], []], 4 * 1024));
|
|
99
|
+
describe(`invites for anonymous senders`, checkParamRoutes(api.p.anonSenderInvites.URL_END, [{}], [1, null, undefined, 'string'], 40 * 1024));
|
|
100
|
+
(0, async_jasmine_1.itAsync)(`closing session`, async () => {
|
|
101
|
+
const sessionId = await startSession(user1);
|
|
102
|
+
const reqOpts = {
|
|
103
|
+
url: (0, url_1.resolve)(confUrl, api.closeSession.URL_END),
|
|
104
|
+
method: 'POST',
|
|
105
|
+
sessionId
|
|
106
|
+
};
|
|
107
|
+
// normal closing of a session
|
|
108
|
+
let rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
109
|
+
expect(rep.status).withContext('status for successful closing of session').toBe(200);
|
|
110
|
+
// repeated call should see invalid session respose
|
|
111
|
+
rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
112
|
+
expect(rep.status).toBe(api.ERR_SC.needAuth);
|
|
113
|
+
reqOpts.sessionId = await startSession(user1);
|
|
114
|
+
await (0, requests_1.expectNonAcceptanceOfNonEmptyBody)(reqOpts);
|
|
115
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(reqOpts);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
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 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 complete message delivery`
|
|
28
|
+
};
|
|
29
|
+
exports.specs.definition = (setup) => (() => {
|
|
30
|
+
let user2;
|
|
31
|
+
let deliveryUrl;
|
|
32
|
+
let asmailServer;
|
|
33
|
+
let sessInfo;
|
|
34
|
+
let reqOpts;
|
|
35
|
+
(0, async_jasmine_1.beforeEachAsync)(async () => {
|
|
36
|
+
user2 = setup().user2;
|
|
37
|
+
asmailServer = setup().asmailServer;
|
|
38
|
+
deliveryUrl = await asmailServer.getDeliveryUrl();
|
|
39
|
+
sessInfo = await (0, test_utils_1.startSessionAndSendMsgObjs)(deliveryUrl, user2.id, test_utils_1.msg);
|
|
40
|
+
reqOpts = {
|
|
41
|
+
url: (0, url_1.resolve)(deliveryUrl, delivery_1.completion.URL_END),
|
|
42
|
+
method: 'POST',
|
|
43
|
+
sessionId: sessInfo.sessionId
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
(0, async_jasmine_1.itAsync)(`marks message as completely delivered`, async () => {
|
|
47
|
+
expect(await asmailServer.msgExists(user2.id, sessInfo.msgId, false)).withContext('message is known to be in delivery').toBeTruthy();
|
|
48
|
+
let rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
49
|
+
expect(rep.status).withContext('normal end of message delivering session').toBe(delivery_1.completion.SC.ok);
|
|
50
|
+
expect(await asmailServer.msgExists(user2.id, sessInfo.msgId, true, test_utils_1.msg)).withContext('message must now be delivered').toBeTruthy();
|
|
51
|
+
// duplicate should not work, as session is already closed
|
|
52
|
+
rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
53
|
+
expect(rep.status).toBe(requests_1.UNAUTHORIZED_STATUS);
|
|
54
|
+
});
|
|
55
|
+
(0, async_jasmine_1.itAsync)('adequately responds to fuzzing', async () => {
|
|
56
|
+
await (0, requests_1.expectNonAcceptanceOfNonEmptyBody)(reqOpts);
|
|
57
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(reqOpts);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
const asmail_1 = require("../../../../libs-for-tests/asmail");
|
|
26
|
+
const json_copy_1 = require("../../../../libs-for-tests/json-copy");
|
|
27
|
+
exports.specs = {
|
|
28
|
+
description: `Request to get recipient's registered initial key`
|
|
29
|
+
};
|
|
30
|
+
exports.specs.definition = (setup) => (() => {
|
|
31
|
+
let deliveryUrl;
|
|
32
|
+
let user1;
|
|
33
|
+
let user2;
|
|
34
|
+
let baseReqOpts;
|
|
35
|
+
(0, async_jasmine_1.beforeAllAsync)(async () => {
|
|
36
|
+
user1 = setup().user1;
|
|
37
|
+
user2 = setup().user2;
|
|
38
|
+
deliveryUrl = await setup().asmailServer.getDeliveryUrl();
|
|
39
|
+
baseReqOpts = {
|
|
40
|
+
url: (0, url_1.resolve)(deliveryUrl, delivery_1.initPubKey.URL_END),
|
|
41
|
+
method: 'GET',
|
|
42
|
+
responseType: 'json'
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
(0, async_jasmine_1.itAsync)(`returns certificates, registered by recipient`, async () => {
|
|
46
|
+
const sessInfo = await (0, asmail_1.startMsgDeliverySession)(deliveryUrl, { recipient: user2.id });
|
|
47
|
+
const reqOpts = (0, json_copy_1.copy)(baseReqOpts);
|
|
48
|
+
reqOpts.sessionId = sessInfo.sessionId;
|
|
49
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
50
|
+
expect(rep.status).withContext('status for successfully getting a key').toBe(delivery_1.initPubKey.SC.ok);
|
|
51
|
+
// TODO add check of certs, together with adding check in setting pkey
|
|
52
|
+
});
|
|
53
|
+
(0, async_jasmine_1.itAsync)(`returns error, when recipient registered no certs`, async () => {
|
|
54
|
+
// recipient doesn't have initial public key registered
|
|
55
|
+
const sessInfo = await (0, asmail_1.startMsgDeliverySession)(deliveryUrl, { recipient: user1.id });
|
|
56
|
+
const reqOpts = (0, json_copy_1.copy)(baseReqOpts);
|
|
57
|
+
reqOpts.sessionId = sessInfo.sessionId;
|
|
58
|
+
let rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
59
|
+
expect(rep.status).withContext('status for no key registered with server').toBe(delivery_1.initPubKey.SC.pkeyNotRegistered);
|
|
60
|
+
// session is closed, when there is no key, so repeat request is denied
|
|
61
|
+
rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
62
|
+
expect(rep.status).withContext('status for closed session').toBe(requests_1.UNAUTHORIZED_STATUS);
|
|
63
|
+
});
|
|
64
|
+
(0, async_jasmine_1.itAsync)('adequately responds to fuzzing', async () => {
|
|
65
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(baseReqOpts);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
Object.freeze(exports);
|