/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Bytes } from "@matter/general"; import { SecurityPolicy } from "./SecurityPolicy.js"; export { ThreadDatasetError } from "./errors.js"; /** * Decoded Thread Operational Dataset. * * Each named accessor mirrors a MeshCoP TLV defined in {@link MeshCopTlvType}. * Unknown TLVs survive a decode/encode round-trip via {@link unknownTlvs}. * * Datasets returned by {@link OperationalDataset.decode} also carry hidden * replay state so {@link OperationalDataset.encode} can reproduce the source * bytes verbatim when no field has been mutated — preserving non-canonical * encodings (legacy 1-byte CHANNEL forms, vendor-specific orderings) emitted * by real Border Routers. */ export interface OperationalDataset { channel?: number; panId?: number; extPanId?: Bytes; networkName?: string; pskc?: Bytes; networkKey?: Bytes; meshLocalPrefix?: Bytes; securityPolicy?: SecurityPolicy; activeTimestamp?: Bytes; pendingTimestamp?: Bytes; delayTimer?: number; channelMask?: Bytes; unknownTlvs: Array<{ type: number; value: Bytes; }>; raw: Bytes; } export declare namespace OperationalDataset { /** * Decodes a Thread Operational Dataset from either raw bytes or a hex string. * * Accepts a whitespace-tolerant hex string (whitespace is stripped before * parsing) or pre-parsed `Bytes` (e.g. a `Uint8Array`) of MeshCoP TLV bytes. Unknown TLVs survive the * round-trip via {@link OperationalDataset.unknownTlvs}. Throws on malformed * input (bad hex or TLV structure violations). */ function decode(input: Bytes | string): OperationalDataset; /** * Encode a Thread Operational Dataset to MeshCoP TLV bytes. * * Datasets produced by {@link decode} are re-encoded with replay fidelity: * unmodified known TLVs reproduce their original bytes (preserving non-canonical * encodings from real Border Routers), while mutated fields are re-encoded * canonically. Datasets constructed directly (without a prior `decode`) are * always encoded in canonical form. * * @param ds - Dataset to encode; may be a decoded or manually constructed object. * @returns MeshCoP TLV byte sequence. */ function encode(ds: OperationalDataset): Bytes; /** * Return a copy of the dataset with `pskc` and `networkKey` cleared. * * Safe to log or expose via the public API — secret material is removed * while all other fields (channel, network name, timestamps, etc.) are retained. * * @param ds - Source dataset; not mutated. * @returns Shallow copy with secret fields set to `undefined`. */ function redact(ds: OperationalDataset): OperationalDataset; } //# sourceMappingURL=OperationalDataset.d.ts.map