/** * @license * @preserve * * KeeeX SAS Public code * https://keeex.me * Copyright 2013-2023 KeeeX All Rights Reserved. * * These computer program listings and specifications, herein, * are and remain the property of KeeeX SAS. The intellectual * and technical concepts herein are proprietary to KeeeX SAS * and may be covered by EU and foreign patents, * patents in process, trade secrets and copyright law. * * These listings are published as a way to provide third party * with the ability to process KeeeX data. * As such, support for public inquiries is limited. * They are provided "as-is", without warrany of any kind. * * They shall not be reproduced or copied or used in whole or * in part as the basis for manufacture or sale of items unless * prior written permission is obtained from KeeeX SAS. * * For a license agreement, please contact: * * */ import { type Awaitable } from "@keeex/utils/types/types.js"; import type { Algorithms as CipherAlgorithms } from "./cipher.js"; import type { Algorithms as DigestAlgorithms } from "./digest.js"; /** * Basic key interface shared by all implementations. * * @public */ export interface CryptoKey { export(): Awaitable; algorithm(): CipherAlgorithms; } /** * Shared secret key management interface. * * @public */ export interface KeysProvider { /** Generate a new random key for symetric encryption */ generateCryptoKey?(algorithm: CipherAlgorithms, keyLen: number): Awaitable; /** Create a key based on existing data for symetric encryption */ importCryptoKey(algorithm: CipherAlgorithms, keyData: Uint8Array): Awaitable; /** * Derive a key from potentially not strong data source (passwords) * * Uses PBKDF2 * * @param keyLen - Length of the cipher key in bytes */ deriveKey?(data: string, salt: Uint8Array, digestAlgorithm: DigestAlgorithms, rounds: number, targetAlgorithm: CipherAlgorithms, keyLen: number): Awaitable; /** * Derive a raw buffer from passwords using PBKDF2 * * @param outLen - Length of the output buffer in bytes */ deriveKeyRaw(data: string, salt: Uint8Array, digestAlgorithm: DigestAlgorithms, rounds: number, outLen: number): Awaitable; } /** @internal */ export declare const isKeysProvider: import("@keeex/utils/types/types.js").TypePredicate;