Path: blob/main/components/gitpod-protocol/src/encryption/container-module.ts
2500 views
/**1* Copyright (c) 2020 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/56import { interfaces } from "inversify";7import { KeyProvider, KeyProviderImpl } from "./key-provider";8import { EncryptionEngine, EncryptionEngineImpl } from "./encryption-engine";9import { EncryptionService, EncryptionServiceImpl } from "./encryption-service";1011/**12* User have to provide a binding for KeyProviderConfig!!!13* Example:14*15* bind(KeyProviderConfig).toDynamicValue(_ctx => {16* return {17* keys: KeyProviderImpl.loadKeyConfigFromJsonString(config)18* };19* }).inSingletonScope();20*/21export const encryptionModule: interfaces.ContainerModuleCallBack = (bind) => {22bind(KeyProvider).to(KeyProviderImpl).inSingletonScope();2324bind(EncryptionEngine).to(EncryptionEngineImpl).inSingletonScope();25bind<EncryptionService>(EncryptionService).to(EncryptionServiceImpl).inSingletonScope();26};272829