UNPKG

@webda/gcp

Version:

Webda GCP Services implementation

39 lines (38 loc) 1.05 kB
import { KeyManagementServiceClient } from "@google-cloud/kms"; import { DeepPartial, Service, ServiceParameters } from "@webda/core"; /** * Parameters for the KMS Service */ export declare class KMSServiceParameters extends ServiceParameters { /** * Encryption key to use by default * @default WEBDA_GCP_KMS_KEY env variable */ defaultKey?: string; constructor(params: any); } /** * Expose KMS Service * * @WebdaModda GoogleCloudKMS */ export declare class GCPKMSService<T extends KMSServiceParameters> extends Service<T> { client: KeyManagementServiceClient; /** * @override */ loadParameters(params: DeepPartial<ServiceParameters>): ServiceParameters; /** * Encrypt a data with GCP KMS given key or defaultKey * @param data * @param key * @returns */ encrypt(data: string, key?: string): Promise<string>; /** * Decrypt a data previously encrypted with this service * @param data * @returns */ decrypt(data: string): Promise<string>; }