/** * @license * * Portions copyright 2022-2023 Project CHIP Authors * SPDX-License-Identifier: Apache-2.0 */ import { Bytes } from "#util/Bytes.js"; import { MaybePromise } from "#util/Promises.js"; import { Crypto, HashAlgorithm } from "./Crypto.js"; import { EcdsaSignature } from "./EcdsaSignature.js"; import { PrivateKey, PublicKey } from "./Key.js"; import { WebCrypto } from "./WebCrypto.js"; /** * A {@link Crypto} implementation that uses only JS standards. * * WARNING: This code is unaudited. Use a trusted native alternative where available. * * This module is mostly based on {@link crypto.subtle}. This should be a reliable native implementation. However, * Web Crypto doesn't support AES-CCM required by Matter so we use a JS implementation for that. See relevant warnings * in the "aes" subdirectory. */ export declare class StandardCrypto extends Crypto { #private; implementationName: string; constructor(crypto?: WebCrypto); protected get subtle(): SubtleCrypto; static provider(): StandardCrypto; randomBytes(length: number): Bytes; encrypt(key: Bytes, data: Bytes, nonce: Bytes, associatedData?: Bytes): AllowSharedBufferSource; decrypt(key: Bytes, data: Bytes, nonce: Bytes, associatedData?: Bytes): AllowSharedBufferSource; computeHash(buffer: Bytes | Bytes[] | ReadableStreamDefaultReader | AsyncIterator, algorithm?: HashAlgorithm): Promise; createPbkdf2Key(secret: Bytes, salt: Bytes, iteration: number, keyLength: number): Promise; createHkdfKey(secret: Bytes, salt: Bytes, info: Bytes, length?: number): Promise; signHmac(secret: Bytes, data: Bytes): MaybePromise; signEcdsa(key: JsonWebKey, data: Bytes | Bytes[]): Promise; verifyEcdsa(key: JsonWebKey, data: Bytes, signature: EcdsaSignature): Promise; createKeyPair(): Promise; protected generateJwk(): Promise; generateDhSecret(key: PrivateKey, peerKey: PublicKey): Promise; protected importKey(format: KeyFormat, keyData: JsonWebKey | Bytes, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: ReadonlyArray): Promise; } //# sourceMappingURL=StandardCrypto.d.ts.map