1 /* 2 * Copyright (C) 2022 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 USER_IDM_FUNCS_H 17 #define USER_IDM_FUNCS_H 18 19 #include "idm_database.h" 20 #include "idm_session.h" 21 #include "user_sign_centre.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 typedef struct { 28 uint8_t token[AUTH_TOKEN_LEN]; 29 int32_t userId; 30 uint32_t authType; 31 uint32_t executorSensorHint; 32 } PermissionCheckParam; 33 34 typedef struct { 35 uint8_t token[AUTH_TOKEN_LEN]; 36 int32_t userId; 37 uint64_t credentialId; 38 } CredentialDeleteParam; 39 40 ResultCode CheckEnrollPermission(PermissionCheckParam param, uint64_t *scheduleId); 41 ResultCode CheckUpdatePermission(PermissionCheckParam param, uint64_t *scheduleId); 42 ResultCode AddCredentialFunc(int32_t userId, const Buffer *scheduleResult, uint64_t *credentialId, Buffer **rootSecret); 43 ResultCode DeleteCredentialFunc(CredentialDeleteParam param, CredentialInfoHal *credentialInfo); 44 ResultCode QueryCredentialFunc(int32_t userId, uint32_t authType, LinkedList **creds); 45 ResultCode GetUserInfoFunc(int32_t userId, uint64_t *secureUid, uint64_t *pinSubType, 46 EnrolledInfoHal **enrolledInfoArray, uint32_t *enrolledNum); 47 ResultCode UpdateCredentialFunc(int32_t userId, const Buffer *scheduleResult, uint64_t *credentialId, 48 CredentialInfoHal *deletedCredential, Buffer **rootSecret); 49 50 #ifdef __cplusplus 51 } 52 #endif 53 54 #endif // USER_IDM_FUNCS_H 55