Skip to main content
. 2023 Oct 12;9:e1626. doi: 10.7717/peerj-cs.1626

Algorithm 4. Delete the policy.

Input: policyID
Output: Boolean Status
async deletePolicy(policyId)
{
   try {
    constpolicyExists=awaitviewPolicy(ctx,policyId);
   if (policyExists)
   {
    constdeletePolicyRequest={
   fcn:deletePolicy’,
   args: [ctx, policyId]
    };
   await contract.submitTransaction(deletePolicyRequest);
   return true;
   }
    else{
      throw new Error(‘policy does not exist’);
   }
   }
   catch (err) {
   throw err;
   }
}