/** * Copyright (c) "Neo4j" * Neo4j Sweden AB [https://neo4j.com] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { EncryptionProfile } from './encryption-profile'; import { EncapsulatedKey } from './encapsulated-key'; import { KeyEncapsulationService } from './key-encapsulation-service'; /** * A manager for encapsulated keys. * * {@link EnvelopeEncryptionProfile} requires data keys to exist before they can be used for encryption. This * manager provides operations for creating and managing such keys. * * When creating a key, the manager uses the configured {@link KeyEncapsulationService} to generate and encapsulate a * new data key and registers the resulting {@link EncapsulatedKeyRecord} with the configured * {@link EncapsulatedKeyRecordRepository}. * * @since 6.3.0 * @experimental Part of the Client-Side Encrytion preview feature */ export declare class EncapsulatedKeyManager { private readonly _profile; private readonly _keyEncapsulationService; constructor(profile: EncryptionProfile, keyEncapsulationService: KeyEncapsulationService); /** * Creates a new key via the {@link KeyEncapsulationService} and saves it in the profile's configured {@link EncapsulatedKeyRecordRepository} * * @param {string} name - The alias the new key should be saved under in the {@link EncapsulatedKeyRecordRepository} * @returns {Promise} Promise that resolves when the key is created, saved and ready to use. */ create(name: string): Promise; /** * Finds an encapsulated key by its id. * * @param {string} id the key id * @return the encapsulated key or undefined when no key with the given id exists */ findById(id: string): Promise; /** * Finds an encapsulated key by its alias. * * @param {string} alias the key alias * @return the encapsulated key or undefined when no key with the given alias exists */ findByAlias(alias: string): Promise; /** * Sets the alias of an encapsulated key by id. The alias must not be used by another key. To assign an alias * currently used by another key, it must first be deleted from that key. * * @param {string} id the key id * @param {string | undefined} alias the new key alias */ setAliasById(id: string, alias?: string): Promise; /** * Deletes the alias from encapsulated key by id. * * @param {string} id the key id */ deleteAliasById(id: string): Promise; /** * Deletes an encapsulated key by id. * * @param {string} id the key id, must not be {@literal null} */ deleteById(id: string): Promise; }