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 #ifndef USER_IAM_COAUTH_INTERFACE 16 #define USER_IAM_COAUTH_INTERFACE 17 18 #include "vector" 19 #include "common_defines.h" 20 21 namespace OHOS { 22 namespace UserIAM { 23 namespace CoAuth { 24 typedef struct { 25 uint32_t scheduleResult; 26 uint64_t scheduleId; 27 uint32_t authType; 28 uint64_t authSubType; 29 uint64_t templateId; 30 uint32_t scheduleMode; 31 uint32_t capabilityLevel; 32 uint32_t version; 33 uint64_t time; 34 uint8_t sign[SIGN_LEN]; 35 } ScheduleToken; 36 37 typedef struct { 38 uint64_t executorId; 39 uint32_t authType; 40 uint64_t authAbility; 41 uint32_t esl; 42 uint32_t executorType; 43 uint8_t publicKey[PUBLIC_KEY_LEN]; 44 } ExecutorInfo; 45 46 typedef struct { 47 std::vector<ExecutorInfo> executors; 48 uint64_t templateId; 49 uint64_t authSubType; 50 uint32_t scheduleMode; 51 } ScheduleInfo; 52 53 int32_t GetScheduleInfo(uint64_t scheduleId, ScheduleInfo &scheduleInfo); 54 int32_t DeleteScheduleInfo(uint64_t scheduleId, ScheduleInfo &scheduleInfo); 55 int32_t GetScheduleToken(std::vector<uint8_t> executorFinishMsg, ScheduleToken &scheduleToken); 56 57 int32_t ExecutorRegister(ExecutorInfo executorInfo, uint64_t &executorId); 58 int32_t ExecutorUnRegister(uint64_t executorId); 59 bool IsExecutorExist(uint32_t authType); 60 } 61 } 62 } 63 64 #endif // USER_IAM_COAUTH_INTERFACE