Matter SDK Coverage Report
Current view: top level - credentials/jcm - TrustVerification.cpp (source / functions) Coverage Total Hit
Test: SHA:e98a48c2e59f85a25417956e1d105721433aa5d1 Lines: 91.3 % 23 21
Test Date: 2026-01-09 16:53:50 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /*
       2              :  *    Copyright (c) 2025 Project CHIP Authors
       3              :  *    All rights reserved.
       4              :  *
       5              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       6              :  *    you may not use this file except in compliance with the License.
       7              :  *    You may obtain a copy of the License at
       8              :  *
       9              :  *        http://www.apache.org/licenses/LICENSE-2.0
      10              :  *
      11              :  *    Unless required by applicable law or agreed to in writing, software
      12              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      13              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      14              :  *    See the License for the specific language governing permissions and
      15              :  *    limitations under the License.
      16              :  */
      17              : 
      18              : #include "TrustVerification.h"
      19              : 
      20              : #include <controller/InvokeInteraction.h>
      21              : #include <credentials/CHIPCert.h>
      22              : #include <credentials/FabricTable.h>
      23              : 
      24              : using namespace ::chip;
      25              : using namespace ::chip::app;
      26              : using namespace ::chip::Crypto;
      27              : using namespace ::chip::Controller;
      28              : using namespace chip::app::Clusters;
      29              : 
      30              : namespace chip {
      31              : namespace Credentials {
      32              : namespace JCM {
      33              : 
      34            7 : void TrustVerificationStateMachine::RegisterTrustVerificationDelegate(TrustVerificationDelegate * trustVerificationDelegate)
      35              : {
      36            7 :     ChipLogProgress(Controller, "JCM: Setting trust verification delegate");
      37            7 :     mTrustVerificationDelegate = trustVerificationDelegate;
      38            7 : }
      39              : 
      40            3 : void TrustVerificationStateMachine::StartTrustVerification()
      41              : {
      42            3 :     PerformTrustVerificationStage(GetNextTrustVerificationStage(kIdle));
      43            3 : }
      44              : 
      45           17 : void TrustVerificationStateMachine::TrustVerificationStageFinished(const TrustVerificationStage & completedStage,
      46              :                                                                    const TrustVerificationError & error)
      47              : {
      48           17 :     ChipLogProgress(Controller, "JCM: Trust Verification Stage Finished: %s", EnumToString(completedStage).c_str());
      49              : 
      50           17 :     if (mTrustVerificationDelegate != nullptr)
      51              :     {
      52            9 :         mTrustVerificationDelegate->OnProgressUpdate(*this, completedStage, mInfo, error);
      53              :     }
      54              : 
      55           17 :     if (error != TrustVerificationError::kSuccess)
      56              :     {
      57            3 :         OnTrustVerificationComplete(error);
      58            6 :         return;
      59              :     }
      60              : 
      61           14 :     if (completedStage == TrustVerificationStage::kComplete || completedStage == TrustVerificationStage::kError)
      62              :     {
      63            3 :         ChipLogProgress(Controller, "JCM: Trust Verification already complete or error");
      64            3 :         OnTrustVerificationComplete(error);
      65            3 :         return;
      66              :     }
      67              : 
      68           11 :     auto nextStage = GetNextTrustVerificationStage(completedStage);
      69           11 :     if (nextStage == TrustVerificationStage::kError)
      70              :     {
      71            0 :         OnTrustVerificationComplete(TrustVerificationError::kInternalError);
      72            0 :         return;
      73              :     }
      74              : 
      75           11 :     PerformTrustVerificationStage(nextStage);
      76              : }
      77              : 
      78              : } // namespace JCM
      79              : } // namespace Credentials
      80              : } // namespace chip
        

Generated by: LCOV version 2.0-1