1 /* 2 * Copyright (c) 2025 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 AUTH_APPLY_KEY_STRUCT_H 17 #define AUTH_APPLY_KEY_STRUCT_H 18 19 #include <stdint.h> 20 21 #include "common_list.h" 22 #include "softbus_adapter_crypto.h" 23 #include "softbus_common.h" 24 #include "softbus_def.h" 25 26 #ifdef __cplusplus 27 #if __cplusplus 28 extern "C" { 29 #endif 30 #endif 31 32 #define D2D_UDID_HASH_STR_LEN 11 33 #define D2D_ACCOUNT_HASH_STR_LEN 11 34 #define D2D_UDID_SHORT_HASH_LEN (D2D_UDID_HASH_STR_LEN / 2) 35 #define D2D_ACCOUNT_SHORT_HASH_LEN (D2D_ACCOUNT_HASH_STR_LEN / 2) 36 #define D2D_APPLY_KEY_LEN 32 37 38 typedef enum { 39 BUSINESS_TYPE_D2D = 0, 40 BUSINESS_TYPE_MAX, 41 } RequestBusinessType; 42 43 typedef struct { 44 RequestBusinessType type; 45 char udidHash[D2D_UDID_HASH_STR_LEN]; 46 char accountHash[D2D_ACCOUNT_HASH_STR_LEN]; 47 char peerAccountHash[SHA_256_HEX_HASH_LEN]; 48 } RequestBusinessInfo; 49 50 typedef struct { 51 void (*onGenSuccess)(uint32_t requestId, uint8_t *applyKey, uint32_t applyKeyLen); 52 void (*onGenFailed)(uint32_t requestId, int32_t reason); 53 } GenApplyKeyCallback; 54 55 #ifdef __cplusplus 56 #if __cplusplus 57 } 58 #endif 59 #endif 60 #endif /* AUTH_APPLY_KEY_STRUCT_H */