Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/gitpod-protocol/src/encryption/container-module.ts
2500 views
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
7
import { interfaces } from "inversify";
8
import { KeyProvider, KeyProviderImpl } from "./key-provider";
9
import { EncryptionEngine, EncryptionEngineImpl } from "./encryption-engine";
10
import { EncryptionService, EncryptionServiceImpl } from "./encryption-service";
11
12
/**
13
* User have to provide a binding for KeyProviderConfig!!!
14
* Example:
15
*
16
* bind(KeyProviderConfig).toDynamicValue(_ctx => {
17
* return {
18
* keys: KeyProviderImpl.loadKeyConfigFromJsonString(config)
19
* };
20
* }).inSingletonScope();
21
*/
22
export const encryptionModule: interfaces.ContainerModuleCallBack = (bind) => {
23
bind(KeyProvider).to(KeyProviderImpl).inSingletonScope();
24
25
bind(EncryptionEngine).to(EncryptionEngineImpl).inSingletonScope();
26
bind<EncryptionService>(EncryptionService).to(EncryptionServiceImpl).inSingletonScope();
27
};
28
29