/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { SupportedTransportsBitmap } from "#common/SupportedTransportsBitmap.js";
import { CRYPTO_HASH_LEN_BYTES, CRYPTO_PUBLIC_KEY_SIZE_BYTES } from "@matter/general";
import {
  TlvBitmap,
  TlvBoolean,
  TlvByteString,
  TlvField,
  TlvObject,
  TlvOptionalField,
  TlvUInt16,
  TlvUInt32
} from "@matter/types";
const TlvSessionParameters = TlvObject({
  /** Maximum sleep interval of node when in idle mode. */
  idleInterval: TlvOptionalField(1, TlvUInt32),
  /** Maximum sleep interval of node when in active mode. */
  activeInterval: TlvOptionalField(2, TlvUInt32),
  /** Minimum amount of time the node SHOULD stay active after network activity. */
  activeThreshold: TlvOptionalField(3, TlvUInt16),
  /** Data model revision. */
  dataModelRevision: TlvOptionalField(4, TlvUInt16),
  /** Interaction model revision. */
  interactionModelRevision: TlvOptionalField(5, TlvUInt16),
  /** Specification version. */
  specificationVersion: TlvOptionalField(6, TlvUInt32),
  /** Maximum Paths pert Invoke */
  maxPathsPerInvoke: TlvOptionalField(7, TlvUInt16),
  /** Supported transport protocols in addition to MRP.*/
  supportedTransports: TlvOptionalField(8, TlvBitmap(TlvUInt16, SupportedTransportsBitmap)),
  /** Maximum size of the message carried over TCP in bytes */
  maxTcpMessageSize: TlvOptionalField(9, TlvUInt32)
});
const TlvPbkdfParamRequest = TlvObject({
  initiatorRandom: TlvField(1, TlvByteString.bound({ length: 32 })),
  initiatorSessionId: TlvField(2, TlvUInt16),
  // Specs: range: 16bits
  passcodeId: TlvField(3, TlvUInt16),
  // Specs: length: 16bits so min is 0x8000?
  hasPbkdfParameters: TlvField(4, TlvBoolean),
  initiatorSessionParams: TlvOptionalField(5, TlvSessionParameters)
});
const TlvPbkdfParamResponse = TlvObject({
  initiatorRandom: TlvField(1, TlvByteString.bound({ length: 32 })),
  responderRandom: TlvField(2, TlvByteString.bound({ length: 32 })),
  responderSessionId: TlvField(3, TlvUInt16),
  pbkdfParameters: TlvOptionalField(
    4,
    TlvObject({
      iterations: TlvField(1, TlvUInt32),
      salt: TlvField(2, TlvByteString.bound({ minLength: 16, maxLength: 32 }))
    })
  ),
  responderSessionParams: TlvOptionalField(5, TlvSessionParameters)
});
const TlvPasePake1 = TlvObject({
  x: TlvField(1, TlvByteString.bound({ length: CRYPTO_PUBLIC_KEY_SIZE_BYTES }))
  // pA
});
const TlvPasePake2 = TlvObject({
  y: TlvField(1, TlvByteString.bound({ length: CRYPTO_PUBLIC_KEY_SIZE_BYTES })),
  // pB
  verifier: TlvField(2, TlvByteString.bound({ length: CRYPTO_HASH_LEN_BYTES }))
  // cB
});
const TlvPasePake3 = TlvObject({
  verifier: TlvField(1, TlvByteString.bound({ length: CRYPTO_HASH_LEN_BYTES }))
  // cA
});
export {
  TlvPasePake1,
  TlvPasePake2,
  TlvPasePake3,
  TlvPbkdfParamRequest,
  TlvPbkdfParamResponse,
  TlvSessionParameters
};
//# sourceMappingURL=PaseMessages.js.map
