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 SYM_TOKEN_MANAGER_H 17 #define SYM_TOKEN_MANAGER_H 18 19 #include <stdint.h> 20 #include "account_module_defines.h" 21 #include "common_defs.h" 22 #include "string_util.h" 23 24 typedef struct { 25 char userId[DEV_AUTH_USER_ID_SIZE]; 26 char deviceId[DEV_AUTH_DEVICE_ID_SIZE]; 27 } SymToken; 28 DECLARE_HC_VECTOR(SymTokenVec, SymToken*) 29 30 typedef struct { 31 int32_t (*addToken)(int32_t osAccountId, int32_t opCode, CJson *in); 32 int32_t (*deleteToken)(int32_t osAccountId, const char *userId, const char *deviceId); 33 int32_t (*generateKeyAlias)(const char *userId, const char *deviceId, Uint8Buff *keyAlias); 34 } SymTokenManager; 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 SymTokenManager *GetSymTokenManager(void); 41 42 void InitSymTokenManager(void); 43 void DestroySymTokenManager(void); 44 45 SymTokenVec CreateSymTokenVec(void); 46 void ClearSymTokenVec(SymTokenVec *vec); 47 48 #ifdef __cplusplus 49 } 50 #endif 51 52 #endif