1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef NAPI_CERT_CRL_COLLECTION_H 17 #define NAPI_CERT_CRL_COLLECTION_H 18 19 #include "napi/native_api.h" 20 #include "napi/native_common.h" 21 #include "napi_x509_certificate.h" 22 #include "napi_x509_crl.h" 23 #include "cert_crl_collection.h" 24 #include "cf_result.h" 25 26 namespace OHOS { 27 namespace CertFramework { 28 29 class NapiCertCRLCollection { 30 public: 31 explicit NapiCertCRLCollection(HcfCertCrlCollection *collection); 32 ~NapiCertCRLCollection(); 33 34 static void DefineCertCRLCollectionJSClass(napi_env env, napi_value exports); 35 static napi_value CreateCertCRLCollection(napi_env env); 36 37 napi_value SelectCerts(napi_env env, napi_callback_info info); 38 napi_value SelectCRLs(napi_env env, napi_callback_info info); 39 napi_value SelectCRLsRet(napi_env env, const HcfX509CrlArray *certs); 40 GetCertCrlCollection()41 HcfCertCrlCollection *GetCertCrlCollection() 42 { 43 return certCrlCollection_; 44 } 45 46 static thread_local napi_ref classRef_; 47 48 private: 49 HcfCertCrlCollection *certCrlCollection_; 50 }; 51 52 } // namespace CertFramework 53 } // namespace OHOS 54 55 #endif // NAPI_CERT_CRL_COLLECTION_H 56