/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import {
  Bytes,
  CRYPTO_AEAD_MIC_LENGTH_BYTES,
  CRYPTO_GROUP_SIZE_BYTES,
  CRYPTO_HASH_LEN_BYTES,
  CRYPTO_PUBLIC_KEY_SIZE_BYTES
} from "@matter/general";
import { TlvByteString, TlvField, TlvObject, TlvOptionalField, TlvUInt16 } from "@matter/types";
import { TlvSessionParameters } from "../pase/PaseMessages.js";
const CASE_SIGNATURE_LENGTH = CRYPTO_GROUP_SIZE_BYTES * 2;
const KDFSR1_KEY_INFO = Bytes.fromString("Sigma1_Resume");
const KDFSR2_KEY_INFO = Bytes.fromString("Sigma2_Resume");
const RESUME1_MIC_NONCE = Bytes.fromString("NCASE_SigmaS1");
const RESUME2_MIC_NONCE = Bytes.fromString("NCASE_SigmaS2");
const KDFSR2_INFO = Bytes.fromString("Sigma2");
const KDFSR3_INFO = Bytes.fromString("Sigma3");
const TBE_DATA2_NONCE = Bytes.fromString("NCASE_Sigma2N");
const TBE_DATA3_NONCE = Bytes.fromString("NCASE_Sigma3N");
const TlvCaseSigma1 = TlvObject({
  initiatorRandom: TlvField(1, TlvByteString.bound({ length: 32 })),
  initiatorSessionId: TlvField(2, TlvUInt16),
  destinationId: TlvField(3, TlvByteString.bound({ length: CRYPTO_HASH_LEN_BYTES })),
  initiatorEcdhPublicKey: TlvField(4, TlvByteString.bound({ length: CRYPTO_PUBLIC_KEY_SIZE_BYTES })),
  initiatorSessionParams: TlvOptionalField(5, TlvSessionParameters),
  resumptionId: TlvOptionalField(6, TlvByteString.bound({ length: 16 })),
  initiatorResumeMic: TlvOptionalField(7, TlvByteString.bound({ length: CRYPTO_AEAD_MIC_LENGTH_BYTES }))
});
const TlvCaseSigma2 = TlvObject({
  responderRandom: TlvField(1, TlvByteString.bound({ length: 32 })),
  responderSessionId: TlvField(2, TlvUInt16),
  responderEcdhPublicKey: TlvField(3, TlvByteString.bound({ length: CRYPTO_PUBLIC_KEY_SIZE_BYTES })),
  encrypted: TlvField(4, TlvByteString),
  responderSessionParams: TlvOptionalField(5, TlvSessionParameters)
});
const TlvCaseSigma2Resume = TlvObject({
  resumptionId: TlvField(1, TlvByteString.bound({ length: 16 })),
  resumeMic: TlvField(2, TlvByteString.bound({ length: 16 })),
  responderSessionId: TlvField(3, TlvUInt16),
  responderSessionParams: TlvOptionalField(4, TlvSessionParameters)
});
const TlvCaseSigma3 = TlvObject({
  encrypted: TlvField(1, TlvByteString)
});
const TlvSignedData = TlvObject({
  responderNoc: TlvField(1, TlvByteString),
  responderIcac: TlvOptionalField(2, TlvByteString),
  responderPublicKey: TlvField(3, TlvByteString.bound({ length: CRYPTO_PUBLIC_KEY_SIZE_BYTES })),
  initiatorPublicKey: TlvField(4, TlvByteString.bound({ length: CRYPTO_PUBLIC_KEY_SIZE_BYTES }))
});
const TlvEncryptedDataSigma2 = TlvObject({
  responderNoc: TlvField(1, TlvByteString),
  responderIcac: TlvOptionalField(2, TlvByteString),
  signature: TlvField(3, TlvByteString.bound({ length: CASE_SIGNATURE_LENGTH })),
  resumptionId: TlvField(4, TlvByteString.bound({ length: 16 }))
});
const TlvEncryptedDataSigma3 = TlvObject({
  responderNoc: TlvField(1, TlvByteString),
  responderIcac: TlvOptionalField(2, TlvByteString),
  signature: TlvField(3, TlvByteString.bound({ length: CASE_SIGNATURE_LENGTH }))
});
export {
  KDFSR1_KEY_INFO,
  KDFSR2_INFO,
  KDFSR2_KEY_INFO,
  KDFSR3_INFO,
  RESUME1_MIC_NONCE,
  RESUME2_MIC_NONCE,
  TBE_DATA2_NONCE,
  TBE_DATA3_NONCE,
  TlvCaseSigma1,
  TlvCaseSigma2,
  TlvCaseSigma2Resume,
  TlvCaseSigma3,
  TlvEncryptedDataSigma2,
  TlvEncryptedDataSigma3,
  TlvSignedData
};
//# sourceMappingURL=CaseMessages.js.map
