/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Crypto, Observable } from "@matter/general"; /** * Runtime ICD check-in counter (ICDCounter attribute, quality C N). * * The owner constructs this from the persisted attribute value, persists {@link value} once, then persists every * {@link changed} emission. The persisted value is advanced by {@link BOOT_BUMP} on construction so a crash cannot * resume below an already-sent counter value (which would reuse its nonce) unless more than {@link BOOT_BUMP} * increments were lost unpersisted. * * uint32 wrap-around is harmless: clients apply mod-2³² offset arithmetic and refresh their keys before the offset * reaches 2³¹. * * @see {@link MatterSpecification.v161.Core} § 9.16.6.5 (ICDCounter attribute) * @see {@link MatterSpecification.v161.Core} § 4.6.3 (Check-In Counter — boot-bump persistence strategy) */ export declare class IcdCounter { #private; /** Emits the new counter value after every {@link increment} and {@link advance}. */ readonly changed: Observable<[value: number], void>; /** * Random initial counter value for a factory-reset device: a 28-bit DRBG value plus one (range 1 … 2²⁸). * Randomizing the start widens the counter space traversed before key refresh and avoids cross-device counter * correlation, since the counter is bound into the Check-In AES-CCM nonce together with the ICD key. * * @see {@link MatterSpecification.v161.Core} § 4.6.1.1 (Message Counter Initialization) * @see {@link MatterSpecification.v161.Core} § 4.6.3 (Check-In Counter — randomize on factory reset) */ static randomInitialValue(crypto: Crypto): number; constructor(persistedValue: number); /** Current counter value. */ get value(): number; /** * Advances the counter by one (uint32 wrap-around) and emits {@link changed}. * * @returns the new counter value. */ increment(): number; /** * Advances the counter by `by` (uint32 wrap-around) and emits {@link changed}. * * For test event triggers that invalidate counter values only, as CHIP's `InvalidateHalfCheckInCounterValues` * and `InvalidateAllCheckInCounterValues` do: a large advance deliberately lets a counter value recur, which the * boot bump otherwise prevents. * * @returns the new counter value. */ advance(by: number): number; } //# sourceMappingURL=IcdCounter.d.ts.map