@gitpod/gitpod-protocol 0.1.5-test.6 → 0.1.5-tweak-workspaceconfig-origin-docs-fork.0
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/data/builtin-theia-plugins.json +28 -18
- package/data/gitpod-schema.json +17 -17
- package/lib/accounting-protocol.d.ts +155 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +109 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +22 -5
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +16 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +45 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/auth.d.ts +25 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +16 -0
- package/lib/auth.js.map +1 -0
- package/lib/context-url.d.ts +18 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +49 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +12 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +73 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/email-protocol.d.ts +2 -2
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js +6 -5
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts +1 -1
- package/lib/encryption/container-module.js +7 -5
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +1 -1
- package/lib/encryption/encryption-engine.js +21 -21
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +2 -2
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +31 -37
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +1 -1
- package/lib/encryption/encryption-service.js +31 -44
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +2 -2
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +27 -31
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +2 -3
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +21 -21
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts +1 -1
- package/lib/gitpod-file-parser.js +27 -42
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.d.ts +1 -1
- package/lib/gitpod-file-parser.spec.js +117 -117
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +186 -34
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +239 -116
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +9 -12
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +5 -7
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +26 -0
- package/lib/ide-frontend-service.d.ts.map +1 -0
- package/lib/ide-frontend-service.js +8 -0
- package/lib/ide-frontend-service.js.map +1 -0
- package/lib/ide-protocol.d.ts +81 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/{util/without.js → ide-protocol.js} +2 -2
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +5 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +25 -12
- package/lib/index.js.map +1 -1
- package/lib/license-protocol.d.ts +1 -1
- package/lib/license-protocol.js +2 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +6 -4
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +188 -48
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +26 -0
- package/lib/messaging/browser/window-connection.d.ts.map +1 -0
- package/lib/messaging/browser/window-connection.js +68 -0
- package/lib/messaging/browser/window-connection.js.map +1 -0
- package/lib/messaging/client-call-metrics.d.ts +35 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +83 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/connection-error-handler.js +12 -23
- package/lib/messaging/connection-error-handler.js.map +1 -1
- package/lib/messaging/error.d.ts +6 -2
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +13 -4
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -0
- package/lib/messaging/handler.js.map +1 -1
- package/lib/messaging/node/connection.js +23 -22
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +2 -0
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +75 -169
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/payment-protocol.d.ts +18 -0
- package/lib/payment-protocol.d.ts.map +1 -0
- package/lib/payment-protocol.js +13 -0
- package/lib/payment-protocol.js.map +1 -0
- package/lib/permission.d.ts +14 -12
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +21 -19
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +210 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +570 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +123 -30
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +121 -117
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +3 -4
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.d.ts +73 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +63 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +103 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +23 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/theia-plugins.d.ts +1 -1
- package/lib/theia-plugins.js +1 -1
- package/lib/typings/globals.d.ts +12 -0
- package/lib/typings/globals.d.ts.map +1 -0
- package/lib/typings/globals.js +7 -0
- package/lib/typings/globals.js.map +1 -0
- package/lib/util/analytics.d.ts +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +79 -0
- package/lib/util/analytics.js.map +1 -0
- package/lib/util/async-iterator.d.ts +1 -1
- package/lib/util/async-iterator.js +57 -134
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +1 -1
- package/lib/util/cancelable.js +19 -60
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +1 -1
- package/lib/util/date-time.js +10 -9
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/deep-partial.d.ts +1 -1
- package/lib/util/deep-partial.js +1 -1
- package/lib/util/deferred.d.ts +1 -1
- package/lib/util/deferred.js +12 -13
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts +2 -2
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +27 -39
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +59 -74
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -1
- package/lib/util/garbage-collected-cache.js +24 -47
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +4 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.js +470 -0
- package/lib/util/generate-workspace-id.js.map +1 -0
- package/lib/util/generate-workspace-id.spec.d.ts +7 -0
- package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.spec.js +63 -0
- package/lib/util/generate-workspace-id.spec.js.map +1 -0
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +44 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +8 -3
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +106 -76
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +16 -0
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -0
- package/lib/util/gitpod-host-url.spec.js +124 -0
- package/lib/util/gitpod-host-url.spec.js.map +1 -0
- package/lib/util/grpc.d.ts +15 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +18 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/logging.d.ts +57 -34
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +119 -110
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.d.ts +1 -1
- package/lib/util/make-link.js +4 -3
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +14 -4
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +39 -8
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +9 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +129 -48
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +1 -1
- package/lib/util/queue.js +18 -56
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.d.ts +1 -1
- package/lib/util/queue.spec.js +145 -287
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeater.d.ts +1 -1
- package/lib/util/repeater.js +37 -89
- package/lib/util/repeater.js.map +1 -1
- package/lib/util/safe-promise.d.ts +1 -1
- package/lib/util/safe-promise.js +11 -13
- package/lib/util/safe-promise.js.map +1 -1
- package/lib/util/semaphore.d.ts +1 -1
- package/lib/util/semaphore.js +17 -47
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +1 -1
- package/lib/util/skip-if.js +8 -7
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +1 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +30 -17
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +1 -1
- package/lib/util/timeutil.spec.js +23 -25
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +15 -2
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +86 -51
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/workspace-port-authentication.d.ts +1 -1
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +5 -3
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +74 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +16 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +10 -4
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.js +3 -2
- package/lib/wsready.js.map +1 -1
- package/package.json +32 -16
- package/pkg-yarn.lock +18 -9
- package/src/accounting-protocol.ts +229 -0
- package/src/admin-protocol.ts +41 -6
- package/src/analytics.ts +54 -0
- package/src/auth.ts +27 -0
- package/src/context-url.spec.ts +39 -0
- package/src/context-url.ts +51 -0
- package/src/email-protocol.ts +3 -4
- package/src/encryption/container-module.ts +1 -1
- package/src/encryption/encryption-engine.spec.ts +1 -1
- package/src/encryption/encryption-engine.ts +1 -1
- package/src/encryption/encryption-service.ts +1 -1
- package/src/encryption/key-provider.ts +1 -1
- package/src/env.ts +11 -11
- package/src/gitpod-file-parser.spec.ts +1 -1
- package/src/gitpod-file-parser.ts +1 -1
- package/src/gitpod-service.ts +386 -52
- package/src/headless-workspace-log.ts +8 -12
- package/src/ide-frontend-service.ts +28 -0
- package/src/ide-protocol.ts +92 -0
- package/src/index.ts +6 -2
- package/src/license-protocol.ts +1 -1
- package/src/messaging/browser/connection.ts +201 -23
- package/src/messaging/browser/window-connection.ts +72 -0
- package/src/messaging/client-call-metrics.ts +97 -0
- package/src/messaging/error.ts +16 -4
- package/src/messaging/handler.ts +12 -0
- package/src/messaging/node/connection.ts +2 -2
- package/src/messaging/proxy-factory.ts +16 -14
- package/src/payment-protocol.ts +20 -0
- package/src/permission.ts +9 -8
- package/src/plans.ts +632 -0
- package/src/protocol.ts +204 -61
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +113 -0
- package/src/teams-projects-protocol.ts +132 -0
- package/src/theia-plugins.ts +1 -1
- package/src/typings/globals.ts +12 -0
- package/src/util/analytics.ts +87 -0
- package/src/util/async-iterator.ts +1 -1
- package/src/util/cancelable.ts +1 -1
- package/src/util/date-time.ts +1 -1
- package/src/util/deep-partial.ts +1 -1
- package/src/util/deferred.ts +2 -2
- package/src/util/garbage-collected-cache.ts +3 -3
- package/src/util/generate-workspace-id.spec.ts +31 -0
- package/src/util/generate-workspace-id.ts +457 -0
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.spec.ts +49 -0
- package/src/util/gitpod-host-url.ts +58 -14
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client.d.ts +1 -1
- package/src/util/logging.ts +111 -39
- package/src/util/make-link.ts +1 -1
- package/src/util/parse-workspace-id.spec.ts +46 -5
- package/src/util/parse-workspace-id.ts +39 -8
- package/src/util/queue.spec.ts +2 -2
- package/src/util/queue.ts +1 -1
- package/src/util/repeater.ts +1 -1
- package/src/util/safe-promise.ts +1 -1
- package/src/util/semaphore.ts +3 -3
- package/src/util/skip-if.ts +2 -2
- package/src/util/timeutil.spec.ts +1 -1
- package/src/util/timeutil.ts +5 -5
- package/src/util/tracing.ts +66 -4
- package/src/util/workspace-port-authentication.ts +1 -1
- package/src/workspace-cluster.ts +96 -0
- package/src/workspace-instance.ts +38 -16
- package/src/wsready.ts +2 -2
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js.map +0 -1
package/lib/auth.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
4
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
|
+
* See License-AGPL.txt in the project root for license information.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.SelectAccountPayload = void 0;
|
|
9
|
+
var SelectAccountPayload;
|
|
10
|
+
(function (SelectAccountPayload) {
|
|
11
|
+
function is(data) {
|
|
12
|
+
return typeof data === "object" && "currentUser" in data && "otherUser" in data;
|
|
13
|
+
}
|
|
14
|
+
SelectAccountPayload.is = is;
|
|
15
|
+
})(SelectAccountPayload = exports.SelectAccountPayload || (exports.SelectAccountPayload = {}));
|
|
16
|
+
//# sourceMappingURL=auth.js.map
|
package/lib/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAkBH,IAAiB,oBAAoB,CAIpC;AAJD,WAAiB,oBAAoB;IACjC,SAAgB,EAAE,CAAC,IAAS;QACxB,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,aAAa,IAAI,IAAI,IAAI,WAAW,IAAI,IAAI,CAAC;IACpF,CAAC;IAFe,uBAAE,KAEjB,CAAA;AACL,CAAC,EAJgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAIpC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace ContextURL {
|
|
7
|
+
const INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
|
|
8
|
+
const PREBUILD_PREFIX = "prebuild";
|
|
9
|
+
const IMAGEBUILD_PREFIX = "imagebuild";
|
|
10
|
+
/**
|
|
11
|
+
* The field "contextUrl" might contain prefixes like:
|
|
12
|
+
* - envvar1=value1/...
|
|
13
|
+
* - prebuild/...
|
|
14
|
+
* This is the analogon to the (Prefix)ContextParser structure in "server".
|
|
15
|
+
*/
|
|
16
|
+
function parseToURL(contextUrl: string | undefined): URL | undefined;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=context-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-url.d.ts","sourceRoot":"","sources":["../src/context-url.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yBAAiB,UAAU,CAAC;IACnB,MAAM,2BAA2B,yBAAyB,CAAC;IAC3D,MAAM,eAAe,aAAa,CAAC;IACnC,MAAM,iBAAiB,eAAe,CAAC;IAE9C;;;;;OAKG;IACH,SAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS,CAgC1E;CACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
|
+
* See License-AGPL.txt in the project root for license information.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ContextURL = void 0;
|
|
9
|
+
var ContextURL;
|
|
10
|
+
(function (ContextURL) {
|
|
11
|
+
ContextURL.INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
|
|
12
|
+
ContextURL.PREBUILD_PREFIX = "prebuild";
|
|
13
|
+
ContextURL.IMAGEBUILD_PREFIX = "imagebuild";
|
|
14
|
+
/**
|
|
15
|
+
* The field "contextUrl" might contain prefixes like:
|
|
16
|
+
* - envvar1=value1/...
|
|
17
|
+
* - prebuild/...
|
|
18
|
+
* This is the analogon to the (Prefix)ContextParser structure in "server".
|
|
19
|
+
*/
|
|
20
|
+
function parseToURL(contextUrl) {
|
|
21
|
+
if (contextUrl === undefined) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const segments = contextUrl.split("/");
|
|
25
|
+
if (segments.length === 1) {
|
|
26
|
+
return new URL(segments[0]); // this might be something, we just try
|
|
27
|
+
}
|
|
28
|
+
const segmentsToURL = (offset) => {
|
|
29
|
+
let rest = segments.slice(offset).join("/");
|
|
30
|
+
if (!rest.startsWith("http")) {
|
|
31
|
+
rest = 'https://' + rest;
|
|
32
|
+
}
|
|
33
|
+
return new URL(rest);
|
|
34
|
+
};
|
|
35
|
+
const firstSegment = segments[0];
|
|
36
|
+
if (firstSegment === ContextURL.PREBUILD_PREFIX ||
|
|
37
|
+
firstSegment === ContextURL.INCREMENTAL_PREBUILD_PREFIX ||
|
|
38
|
+
firstSegment === ContextURL.IMAGEBUILD_PREFIX) {
|
|
39
|
+
return segmentsToURL(1);
|
|
40
|
+
}
|
|
41
|
+
// check for env vars
|
|
42
|
+
if (firstSegment.indexOf("=") !== -1) {
|
|
43
|
+
return segmentsToURL(1);
|
|
44
|
+
}
|
|
45
|
+
return segmentsToURL(0);
|
|
46
|
+
}
|
|
47
|
+
ContextURL.parseToURL = parseToURL;
|
|
48
|
+
})(ContextURL = exports.ContextURL || (exports.ContextURL = {}));
|
|
49
|
+
//# sourceMappingURL=context-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-url.js","sourceRoot":"","sources":["../src/context-url.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,IAAiB,UAAU,CA4C1B;AA5CD,WAAiB,UAAU;IACZ,sCAA2B,GAAG,sBAAsB,CAAC;IACrD,0BAAe,GAAG,UAAU,CAAC;IAC7B,4BAAiB,GAAG,YAAY,CAAC;IAE9C;;;;;OAKG;IACH,SAAgB,UAAU,CAAC,UAA8B;QACvD,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,OAAO,SAAS,CAAC;SAClB;QAED,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,uCAAuC;SACtE;QAED,MAAM,aAAa,GAAG,CAAC,MAAc,EAAO,EAAE;YAC5C,IAAI,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;gBAC5B,IAAI,GAAG,UAAU,GAAG,IAAI,CAAC;aAC1B;YACD,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC,CAAC;QAGF,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,YAAY,KAAK,WAAA,eAAe;YAChC,YAAY,KAAK,WAAA,2BAA2B;YAC5C,YAAY,KAAK,WAAA,iBAAiB,EAAE;YACtC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;SACzB;QAED,qBAAqB;QACrB,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;YACpC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;SACzB;QAED,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAhCe,qBAAU,aAgCzB,CAAA;AACH,CAAC,EA5CgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA4C1B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ContextUrlTest {
|
|
7
|
+
parseContextUrl_withEnvVar(): void;
|
|
8
|
+
parseContextUrl_withEnvVar_withoutSchema(): void;
|
|
9
|
+
parseContextUrl_withPrebuild(): void;
|
|
10
|
+
parseContextUrl_withPrebuild_withoutSchema(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=context-url.spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-url.spec.d.ts","sourceRoot":"","sources":["../src/context-url.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,qBACa,cAAc;IAEV,0BAA0B;IAM1B,wCAAwC;IAMxC,4BAA4B;IAM5B,0CAA0C;CAK1D"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
|
+
* See License-AGPL.txt in the project root for license information.
|
|
6
|
+
*/
|
|
7
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
8
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12
|
+
};
|
|
13
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ContextUrlTest = void 0;
|
|
18
|
+
const chai = require("chai");
|
|
19
|
+
const mocha_typescript_1 = require("mocha-typescript");
|
|
20
|
+
const context_url_1 = require("./context-url");
|
|
21
|
+
const expect = chai.expect;
|
|
22
|
+
let ContextUrlTest = class ContextUrlTest {
|
|
23
|
+
parseContextUrl_withEnvVar() {
|
|
24
|
+
const actual = context_url_1.ContextURL.parseToURL("passedin=test%20value/https://github.com/gitpod-io/gitpod-test-repo");
|
|
25
|
+
expect(actual === null || actual === void 0 ? void 0 : actual.host).to.equal("github.com");
|
|
26
|
+
expect(actual === null || actual === void 0 ? void 0 : actual.pathname).to.equal("/gitpod-io/gitpod-test-repo");
|
|
27
|
+
}
|
|
28
|
+
parseContextUrl_withEnvVar_withoutSchema() {
|
|
29
|
+
const actual = context_url_1.ContextURL.parseToURL("passedin=test%20value/github.com/gitpod-io/gitpod-test-repo");
|
|
30
|
+
expect(actual === null || actual === void 0 ? void 0 : actual.host).to.equal("github.com");
|
|
31
|
+
expect(actual === null || actual === void 0 ? void 0 : actual.pathname).to.equal("/gitpod-io/gitpod-test-repo");
|
|
32
|
+
}
|
|
33
|
+
parseContextUrl_withPrebuild() {
|
|
34
|
+
const actual = context_url_1.ContextURL.parseToURL("prebuild/https://github.com/gitpod-io/gitpod-test-repo");
|
|
35
|
+
expect(actual === null || actual === void 0 ? void 0 : actual.host).to.equal("github.com");
|
|
36
|
+
expect(actual === null || actual === void 0 ? void 0 : actual.pathname).to.equal("/gitpod-io/gitpod-test-repo");
|
|
37
|
+
}
|
|
38
|
+
parseContextUrl_withPrebuild_withoutSchema() {
|
|
39
|
+
const actual = context_url_1.ContextURL.parseToURL("prebuild/github.com/gitpod-io/gitpod-test-repo");
|
|
40
|
+
expect(actual === null || actual === void 0 ? void 0 : actual.host).to.equal("github.com");
|
|
41
|
+
expect(actual === null || actual === void 0 ? void 0 : actual.pathname).to.equal("/gitpod-io/gitpod-test-repo");
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
__decorate([
|
|
45
|
+
mocha_typescript_1.test,
|
|
46
|
+
__metadata("design:type", Function),
|
|
47
|
+
__metadata("design:paramtypes", []),
|
|
48
|
+
__metadata("design:returntype", void 0)
|
|
49
|
+
], ContextUrlTest.prototype, "parseContextUrl_withEnvVar", null);
|
|
50
|
+
__decorate([
|
|
51
|
+
mocha_typescript_1.test,
|
|
52
|
+
__metadata("design:type", Function),
|
|
53
|
+
__metadata("design:paramtypes", []),
|
|
54
|
+
__metadata("design:returntype", void 0)
|
|
55
|
+
], ContextUrlTest.prototype, "parseContextUrl_withEnvVar_withoutSchema", null);
|
|
56
|
+
__decorate([
|
|
57
|
+
mocha_typescript_1.test,
|
|
58
|
+
__metadata("design:type", Function),
|
|
59
|
+
__metadata("design:paramtypes", []),
|
|
60
|
+
__metadata("design:returntype", void 0)
|
|
61
|
+
], ContextUrlTest.prototype, "parseContextUrl_withPrebuild", null);
|
|
62
|
+
__decorate([
|
|
63
|
+
mocha_typescript_1.test,
|
|
64
|
+
__metadata("design:type", Function),
|
|
65
|
+
__metadata("design:paramtypes", []),
|
|
66
|
+
__metadata("design:returntype", void 0)
|
|
67
|
+
], ContextUrlTest.prototype, "parseContextUrl_withPrebuild_withoutSchema", null);
|
|
68
|
+
ContextUrlTest = __decorate([
|
|
69
|
+
mocha_typescript_1.suite
|
|
70
|
+
], ContextUrlTest);
|
|
71
|
+
exports.ContextUrlTest = ContextUrlTest;
|
|
72
|
+
module.exports = new ContextUrlTest();
|
|
73
|
+
//# sourceMappingURL=context-url.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-url.spec.js","sourceRoot":"","sources":["../src/context-url.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;AAEH,6BAA6B;AAC7B,uDAA+C;AAC/C,+CAA2C;AAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAG3B,IAAa,cAAc,GAA3B,MAAa,cAAc;IAEV,0BAA0B;QACnC,MAAM,MAAM,GAAG,wBAAU,CAAC,UAAU,CAAC,qEAAqE,CAAC,CAAC;QAC5G,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACrE,CAAC;IAEY,wCAAwC;QACjD,MAAM,MAAM,GAAG,wBAAU,CAAC,UAAU,CAAC,6DAA6D,CAAC,CAAC;QACpG,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACrE,CAAC;IAEY,4BAA4B;QACrC,MAAM,MAAM,GAAG,wBAAU,CAAC,UAAU,CAAC,wDAAwD,CAAC,CAAC;QAC/F,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACrE,CAAC;IAEY,0CAA0C;QACnD,MAAM,MAAM,GAAG,wBAAU,CAAC,UAAU,CAAC,gDAAgD,CAAC,CAAC;QACvF,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACrE,CAAC;CACJ,CAAA;AAvBS;IAAL,uBAAI;;;;gEAIJ;AAEK;IAAL,uBAAI;;;;8EAIJ;AAEK;IAAL,uBAAI;;;;kEAIJ;AAEK;IAAL,uBAAI;;;;gFAIJ;AAxBQ,cAAc;IAD1B,wBAAK;GACO,cAAc,CAyB1B;AAzBY,wCAAc;AA0B3B,MAAM,CAAC,OAAO,GAAG,IAAI,cAAc,EAAE,CAAA"}
|
package/lib/email-protocol.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
@@ -44,6 +44,6 @@ export declare type EMail = {
|
|
|
44
44
|
params: EMailParameters;
|
|
45
45
|
} & EMailStatus;
|
|
46
46
|
export declare namespace EMail {
|
|
47
|
-
const create: (ts:
|
|
47
|
+
const create: (ts: Omit<EMail, 'uid'>) => EMail;
|
|
48
48
|
}
|
|
49
49
|
//# sourceMappingURL=email-protocol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-protocol.d.ts","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"email-protocol.d.ts","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,oBAAY,UAAU,GAAG,mBAAmB,GACtC,mBAAmB,CAAC;AAE1B,MAAM,WAAW,WAAW;IACxB,wDAAwD;IACxD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mEAAmE;IACnE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,yBAAiB,WAAW,CAAC;IACzB,SAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAKxD;CACJ;AAED,MAAM,WAAW,YAAY;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC5B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,aAAa,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,0BAA0B;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACvC,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,cAAc,EAAE,EAAE,CAAC;CACtB;AAED,oBAAY,KAAK,GAAG;IAChB,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,MAAM,EAAE,eAAe,CAAC;CAC3B,GAAG,WAAW,CAAC;AAEhB,yBAAiB,KAAK,CAAC;IACZ,MAAM,MAAM,OAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,KAAG,KAI/C,CAAA;CACJ"}
|
package/lib/email-protocol.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2020
|
|
3
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
4
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
5
|
* See License-AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
|
|
8
|
+
exports.EMail = exports.EMailStatus = void 0;
|
|
9
|
+
const uuid_1 = require("uuid");
|
|
9
10
|
var EMailStatus;
|
|
10
11
|
(function (EMailStatus) {
|
|
11
12
|
function getState(status) {
|
|
@@ -18,9 +19,9 @@ var EMailStatus;
|
|
|
18
19
|
})(EMailStatus = exports.EMailStatus || (exports.EMailStatus = {}));
|
|
19
20
|
var EMail;
|
|
20
21
|
(function (EMail) {
|
|
21
|
-
EMail.create =
|
|
22
|
-
|
|
23
|
-
withId.uid =
|
|
22
|
+
EMail.create = (ts) => {
|
|
23
|
+
const withId = ts;
|
|
24
|
+
withId.uid = (0, uuid_1.v4)();
|
|
24
25
|
return withId;
|
|
25
26
|
};
|
|
26
27
|
})(EMail = exports.EMail || (exports.EMail = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-protocol.js","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"email-protocol.js","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+BAAoC;AAapC,IAAiB,WAAW,CAO3B;AAPD,WAAiB,WAAW;IACxB,SAAgB,QAAQ,CAAC,MAAmB;QACxC,IAAI,MAAM,CAAC,qBAAqB,EAAE;YAC9B,OAAO,mBAAmB,CAAC;SAC9B;QACD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IALe,oBAAQ,WAKvB,CAAA;AACL,CAAC,EAPgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAO3B;AAiCD,IAAiB,KAAK,CAMrB;AAND,WAAiB,KAAK;IACL,YAAM,GAAG,CAAC,EAAsB,EAAS,EAAE;QACpD,MAAM,MAAM,GAAG,EAAW,CAAC;QAC3B,MAAM,CAAC,GAAG,GAAG,IAAA,SAAM,GAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IAClB,CAAC,CAAA;AACL,CAAC,EANgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAMrB"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2020
|
|
3
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
4
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
5
|
* See License-AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
exports.encryptionModule = void 0;
|
|
9
|
+
const key_provider_1 = require("./key-provider");
|
|
10
|
+
const encryption_engine_1 = require("./encryption-engine");
|
|
11
|
+
const encryption_service_1 = require("./encryption-service");
|
|
11
12
|
/**
|
|
12
13
|
* User have to provide a binding for KeyProviderConfig!!!
|
|
13
14
|
* Example:
|
|
@@ -18,9 +19,10 @@ var encryption_service_1 = require("./encryption-service");
|
|
|
18
19
|
* };
|
|
19
20
|
* }).inSingletonScope();
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
const encryptionModule = bind => {
|
|
22
23
|
bind(key_provider_1.KeyProvider).to(key_provider_1.KeyProviderImpl).inSingletonScope();
|
|
23
24
|
bind(encryption_engine_1.EncryptionEngine).to(encryption_engine_1.EncryptionEngineImpl).inSingletonScope();
|
|
24
25
|
bind(encryption_service_1.EncryptionService).to(encryption_service_1.EncryptionServiceImpl).inSingletonScope();
|
|
25
26
|
};
|
|
27
|
+
exports.encryptionModule = encryptionModule;
|
|
26
28
|
//# sourceMappingURL=container-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container-module.js","sourceRoot":"","sources":["../../src/encryption/container-module.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"container-module.js","sourceRoot":"","sources":["../../src/encryption/container-module.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,iDAA8D;AAC9D,2DAA6E;AAC7E,6DAAgF;AAEhF;;;;;;;;;GASG;AACI,MAAM,gBAAgB,GAAuC,IAAI,CAAC,EAAE;IAEvE,IAAI,CAAC,0BAAW,CAAC,CAAC,EAAE,CAAC,8BAAe,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAEzD,IAAI,CAAC,oCAAgB,CAAC,CAAC,EAAE,CAAC,wCAAoB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACnE,IAAI,CAAC,sCAAiB,CAAC,CAAC,EAAE,CAAC,0CAAqB,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACzE,CAAC,CAAC;AANW,QAAA,gBAAgB,oBAM3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2020
|
|
3
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
4
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
5
|
* See License-AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
@@ -11,8 +11,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
11
11
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
exports.EncryptionEngineImpl = exports.EncryptionEngine = void 0;
|
|
15
|
+
const crypto = require("crypto");
|
|
16
|
+
const inversify_1 = require("inversify");
|
|
16
17
|
exports.EncryptionEngine = Symbol('EncryptionEngine');
|
|
17
18
|
/**
|
|
18
19
|
* For starters, let's use aes-cbc-256 with:
|
|
@@ -20,33 +21,32 @@ exports.EncryptionEngine = Symbol('EncryptionEngine');
|
|
|
20
21
|
* - no salt, as we pass in a real key (no salting needed to turn a password into a key)
|
|
21
22
|
* The implementation closely follows the exampes in https://nodejs.org/api/crypto.html.
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
let EncryptionEngineImpl = class EncryptionEngineImpl {
|
|
25
|
+
constructor() {
|
|
25
26
|
this.algorithm = 'aes-256-cbc';
|
|
26
27
|
this.enc = 'base64';
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
encrypt(data, key) {
|
|
30
|
+
const iv = crypto.randomBytes(16);
|
|
31
|
+
const cipher = crypto.createCipheriv(this.algorithm, key, iv);
|
|
32
|
+
const encrypted = cipher.update(new Buffer(data, 'utf8'));
|
|
33
|
+
const finalEncrypted = Buffer.concat([encrypted, cipher.final()]);
|
|
33
34
|
return {
|
|
34
35
|
data: finalEncrypted.toString(this.enc),
|
|
35
36
|
keyParams: {
|
|
36
37
|
iv: iv.toString(this.enc)
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
}
|
|
41
|
+
decrypt(encryptedData, key) {
|
|
42
|
+
const decipher = crypto.createDecipheriv(this.algorithm, key, new Buffer(encryptedData.keyParams.iv, this.enc));
|
|
43
|
+
let decrypted = decipher.update(new Buffer(encryptedData.data, this.enc));
|
|
44
|
+
const finalDecrypted = Buffer.concat([decrypted, decipher.final()]);
|
|
44
45
|
return finalDecrypted.toString('utf8');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}());
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
EncryptionEngineImpl = __decorate([
|
|
49
|
+
(0, inversify_1.injectable)()
|
|
50
|
+
], EncryptionEngineImpl);
|
|
51
51
|
exports.EncryptionEngineImpl = EncryptionEngineImpl;
|
|
52
52
|
//# sourceMappingURL=encryption-engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption-engine.js","sourceRoot":"","sources":["../../src/encryption/encryption-engine.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"encryption-engine.js","sourceRoot":"","sources":["../../src/encryption/encryption-engine.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;AAEH,iCAAiC;AACjC,yCAAuC;AAY1B,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAS3D;;;;;GAKG;AAEH,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAAjC;QACa,cAAS,GAAG,aAAa,CAAC;QAC1B,QAAG,GAAG,QAAQ,CAAC;IAqB5B,CAAC;IAnBG,OAAO,CAAC,IAAY,EAAE,GAAW;QAC7B,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QAC9D,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1D,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAClE,OAAO;YACH,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;YACvC,SAAS,EAAE;gBACP,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;aAC5B;SACJ,CAAC;IACN,CAAC;IAED,OAAO,CAAC,aAA4B,EAAE,GAAW;QAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAChH,IAAI,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1E,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACpE,OAAO,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACJ,CAAA;AAvBY,oBAAoB;IAD/B,IAAA,sBAAU,GAAE;GACD,oBAAoB,CAuBhC;AAvBY,oDAAoB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
declare class TestEncryptionEngineImpl {
|
|
7
|
-
protected
|
|
7
|
+
protected get testkey(): string;
|
|
8
8
|
basicSymmetry(): void;
|
|
9
9
|
}
|
|
10
10
|
export declare const t: TestEncryptionEngineImpl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption-engine.spec.d.ts","sourceRoot":"","sources":["../../src/encryption/encryption-engine.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,cAAa,wBAAwB;
|
|
1
|
+
{"version":3,"file":"encryption-engine.spec.d.ts","sourceRoot":"","sources":["../../src/encryption/encryption-engine.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,cAAa,wBAAwB;IAEjC,SAAS,KAAK,OAAO,WAIpB;IAEK,aAAa;CAWtB;AACD,eAAO,MAAM,CAAC,0BAAiC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2020
|
|
3
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
4
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
5
|
* See License-AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
@@ -14,45 +14,39 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
14
14
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
exports.t = void 0;
|
|
18
|
+
const mocha_typescript_1 = require("mocha-typescript");
|
|
19
|
+
const chai = require("chai");
|
|
20
|
+
const path = require("path");
|
|
21
|
+
const fs = require("fs");
|
|
22
|
+
const encryption_engine_1 = require("./encryption-engine");
|
|
23
|
+
const expect = chai.expect;
|
|
24
|
+
let TestEncryptionEngineImpl = class TestEncryptionEngineImpl {
|
|
25
|
+
// Created with openssl rand -rand /dev/urandom -out key -base64 32
|
|
26
|
+
get testkey() {
|
|
27
|
+
const keyFilePath = path.resolve(__dirname, '../../test/fixtures/encryption/testkey');
|
|
28
|
+
const keyBuffer = fs.readFileSync(keyFilePath);
|
|
29
|
+
return keyBuffer.toString().trim();
|
|
25
30
|
}
|
|
26
|
-
Object.defineProperty(TestEncryptionEngineImpl.prototype, "testkey", {
|
|
27
|
-
// Created with openssl rand -rand /dev/urandom -out key -base64 32
|
|
28
|
-
get: function () {
|
|
29
|
-
var keyFilePath = path.resolve(__dirname, '../../test/fixtures/encryption/testkey');
|
|
30
|
-
var keyBuffer = fs.readFileSync(keyFilePath);
|
|
31
|
-
return keyBuffer.toString().trim();
|
|
32
|
-
},
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true
|
|
35
|
-
});
|
|
36
31
|
;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
basicSymmetry() {
|
|
33
|
+
const plaintext = "12345678901234567890";
|
|
34
|
+
const key = new Buffer(this.testkey, 'base64');
|
|
35
|
+
const cut = new encryption_engine_1.EncryptionEngineImpl();
|
|
36
|
+
const encryptedData = cut.encrypt(plaintext, key);
|
|
42
37
|
expect(encryptedData).to.be.not.undefined;
|
|
43
|
-
|
|
38
|
+
const decryptedPlaintext = cut.decrypt(encryptedData, key);
|
|
44
39
|
expect(decryptedPlaintext).equals(plaintext);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}());
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
__decorate([
|
|
43
|
+
mocha_typescript_1.test,
|
|
44
|
+
__metadata("design:type", Function),
|
|
45
|
+
__metadata("design:paramtypes", []),
|
|
46
|
+
__metadata("design:returntype", void 0)
|
|
47
|
+
], TestEncryptionEngineImpl.prototype, "basicSymmetry", null);
|
|
48
|
+
TestEncryptionEngineImpl = __decorate([
|
|
49
|
+
mocha_typescript_1.suite
|
|
50
|
+
], TestEncryptionEngineImpl);
|
|
57
51
|
exports.t = new TestEncryptionEngineImpl();
|
|
58
52
|
//# sourceMappingURL=encryption-engine.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption-engine.spec.js","sourceRoot":"","sources":["../../src/encryption/encryption-engine.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"encryption-engine.spec.js","sourceRoot":"","sources":["../../src/encryption/encryption-engine.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;AAEH,uDAA+C;AAC/C,6BAA6B;AAC7B,6BAA6B;AAC7B,yBAAyB;AAEzB,2DAA2D;AAE3D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAEpB,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACjC,mEAAmE;IACnE,IAAc,OAAO;QACjB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,wCAAwC,CAAC,CAAC;QACtF,MAAM,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAC/C,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;IACvC,CAAC;IAAA,CAAC;IAEI,aAAa;QACf,MAAM,SAAS,GAAG,sBAAsB,CAAC;QACzC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,IAAI,wCAAoB,EAAE,CAAC;QACvC,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAClD,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC;QAE1C,MAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAC3D,MAAM,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC;CACJ,CAAA;AAXS;IAAL,uBAAI;;;;6DAUJ;AAlBQ,wBAAwB;IAApC,wBAAK;GAAO,wBAAwB,CAmBpC;AACY,QAAA,CAAC,GAAG,IAAI,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2020
|
|
3
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
4
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
5
|
* See License-AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
7
|
-
var __assign = (this && this.__assign) || function () {
|
|
8
|
-
__assign = Object.assign || function(t) {
|
|
9
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
10
|
-
s = arguments[i];
|
|
11
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
12
|
-
t[p] = s[p];
|
|
13
|
-
}
|
|
14
|
-
return t;
|
|
15
|
-
};
|
|
16
|
-
return __assign.apply(this, arguments);
|
|
17
|
-
};
|
|
18
7
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
8
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
9
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -25,42 +14,40 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
25
14
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
26
15
|
};
|
|
27
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
exports.EncryptionServiceImpl = exports.EncryptionService = void 0;
|
|
18
|
+
const inversify_1 = require("inversify");
|
|
19
|
+
const encryption_engine_1 = require("./encryption-engine");
|
|
20
|
+
const key_provider_1 = require("./key-provider");
|
|
31
21
|
exports.EncryptionService = Symbol('EncryptionService');
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
let EncryptionServiceImpl = class EncryptionServiceImpl {
|
|
23
|
+
encrypt(data) {
|
|
24
|
+
const dataStr = this.serialize(data);
|
|
25
|
+
const key = this.keyProvider.getPrimaryKey();
|
|
26
|
+
const encryptedData = this.engine.encrypt(dataStr, key.material);
|
|
27
|
+
return Object.assign(Object.assign({}, encryptedData), { keyMetadata: key.metadata });
|
|
34
28
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var encryptedData = this.engine.encrypt(dataStr, key.material);
|
|
39
|
-
return __assign(__assign({}, encryptedData), { keyMetadata: key.metadata });
|
|
40
|
-
};
|
|
41
|
-
EncryptionServiceImpl.prototype.decrypt = function (encrypted) {
|
|
42
|
-
var key = this.keyProvider.getKeyFor(encrypted.keyMetadata);
|
|
43
|
-
var serializedData = this.engine.decrypt(encrypted, key.material);
|
|
29
|
+
decrypt(encrypted) {
|
|
30
|
+
const key = this.keyProvider.getKeyFor(encrypted.keyMetadata);
|
|
31
|
+
const serializedData = this.engine.decrypt(encrypted, key.material);
|
|
44
32
|
return this.deserialize(serializedData);
|
|
45
|
-
}
|
|
46
|
-
|
|
33
|
+
}
|
|
34
|
+
serialize(data) {
|
|
47
35
|
return JSON.stringify(data);
|
|
48
|
-
}
|
|
49
|
-
|
|
36
|
+
}
|
|
37
|
+
deserialize(data) {
|
|
50
38
|
return JSON.parse(data);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}());
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, inversify_1.inject)(encryption_engine_1.EncryptionEngine),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], EncryptionServiceImpl.prototype, "engine", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, inversify_1.inject)(key_provider_1.KeyProvider),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], EncryptionServiceImpl.prototype, "keyProvider", void 0);
|
|
49
|
+
EncryptionServiceImpl = __decorate([
|
|
50
|
+
(0, inversify_1.injectable)()
|
|
51
|
+
], EncryptionServiceImpl);
|
|
65
52
|
exports.EncryptionServiceImpl = EncryptionServiceImpl;
|
|
66
53
|
//# sourceMappingURL=encryption-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption-service.js","sourceRoot":"","sources":["../../src/encryption/encryption-service.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"encryption-service.js","sourceRoot":"","sources":["../../src/encryption/encryption-service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;AAEH,yCAA+C;AAE/C,2DAAsE;AACtE,iDAA0D;AAO7C,QAAA,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAO7D,IAAa,qBAAqB,GAAlC,MAAa,qBAAqB;IAI9B,OAAO,CAAI,IAAO;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;QAE7C,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACjE,uCACO,aAAa,KAChB,WAAW,EAAE,GAAG,CAAC,QAAQ,IAC3B;IACN,CAAC;IAED,OAAO,CAAI,SAAuB;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC9D,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;IAES,SAAS,CAAC,IAAS;QACzB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAES,WAAW,CAAI,IAAY;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;IACjC,CAAC;CACJ,CAAA;AA3B6B;IAAzB,IAAA,kBAAM,EAAC,oCAAgB,CAAC;;qDAA6C;AACjD;IAApB,IAAA,kBAAM,EAAC,0BAAW,CAAC;;0DAA6C;AAFxD,qBAAqB;IADjC,IAAA,sBAAU,GAAE;GACA,qBAAqB,CA4BjC;AA5BY,sDAAqB"}
|