/** * 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 { EncapsulationResult, KeyEncapsulationService } from './key-encapsulation-service'; /** * An implementation of {@link KeyEncapsulationService} that uses a local, 256-bit, AES-GCM Key Encryption Key (KEK) to encrypt keys. * * @experimental Part of the Client-Side Encrytion preview feature */ export declare class LocalKeyEncapsulationService implements KeyEncapsulationService { private readonly _kek; private readonly _cryptoProvider; constructor(kek: Uint8Array); /** * Creates a new key, encapsulates it with the local KEK and returns the result. * * @param {KeyEncapsulationOptions} options the encapsulation options, depends on the implementation * @return {Promise} a promise that resolves to the encapsulation result * @experimental Part of the Client-Side Encrytion preview feature */ encapsulate(options: Record): Promise; /** * Decapsulates encapsulated bytes with the local KEK. * * @param {Int8Array} encapsulation the encapsulated byte} * @param {KeyEncapsulationOptions} metadata the key metadata * @return {Promise} a promise that resolves to the decapsulated key * @experimental Part of the Client-Side Encrytion preview feature */ decapsulate(encapsulation: Int8Array, metadata: Record): Promise; } /** * @private */ export declare class LocalEncapsulationResult implements EncapsulationResult { private readonly _dek; private readonly _encapsulation; private readonly _options; constructor(DEK: Uint8Array, encapsulation: Int8Array, options: Record); encapsulation(): Int8Array; options(): Record; key(): Uint8Array; } /** * Returns a new {@link KeyEncapsulationService} implementation that uses the provided AES-256 * {@link SecretKey} as a master key for encapsulating and decapsulating data keys. * * @param {Uint8Array} masterKey the AES-256 master key * @return {KeyEncapsulationService} the new key encapsulation service * @experimental Part of the Client-Side Encrytion preview feature */ export declare function localKeyEncapsulationService(masterKey: Uint8Array): LocalKeyEncapsulationService;