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 #include "auth_device_profile_mock.h"
17
18 namespace OHOS {
19 void *g_authDeviceProfileIterface;
20
AuthDeviceProfileInterfaceMock()21 AuthDeviceProfileInterfaceMock::AuthDeviceProfileInterfaceMock()
22 {
23 g_authDeviceProfileIterface = reinterpret_cast<void *>(this);
24 }
25
~AuthDeviceProfileInterfaceMock()26 AuthDeviceProfileInterfaceMock::~AuthDeviceProfileInterfaceMock()
27 {
28 g_authDeviceProfileIterface = nullptr;
29 }
30
GetInterface()31 static AuthDeviceProfileInterfaceMock *GetInterface()
32 {
33 return reinterpret_cast<AuthDeviceProfileInterfaceMock *>(g_authDeviceProfileIterface);
34 }
35
36 extern "C" {
GetActiveOsAccountIds(void)37 int32_t GetActiveOsAccountIds(void)
38 {
39 return GetInterface()->GetActiveOsAccountIds();
40 }
41
LnnGetLocalNum64Info(InfoKey key,int64_t * info)42 int32_t LnnGetLocalNum64Info(InfoKey key, int64_t *info)
43 {
44 return GetInterface()->LnnGetLocalNum64Info(key, info);
45 }
46
LnnIsDefaultOhosAccount(void)47 bool LnnIsDefaultOhosAccount(void)
48 {
49 return GetInterface()->LnnIsDefaultOhosAccount();
50 }
51
LnnGetLocalStrInfo(InfoKey key,char * info,uint32_t len)52 int32_t LnnGetLocalStrInfo(InfoKey key, char *info, uint32_t len)
53 {
54 return GetInterface()->LnnGetLocalStrInfo(key, info, len);
55 }
56
AuthIsUkExpired(uint64_t time)57 bool AuthIsUkExpired(uint64_t time)
58 {
59 return GetInterface()->AuthIsUkExpired(time);
60 }
61
AuthInsertUserKey(const AuthACLInfo * aclInfo,const AuthUserKeyInfo * userKeyInfo,bool isUserBindLevel)62 int32_t AuthInsertUserKey(const AuthACLInfo *aclInfo, const AuthUserKeyInfo *userKeyInfo, bool isUserBindLevel)
63 {
64 return GetInterface()->AuthInsertUserKey(aclInfo, userKeyInfo, isUserBindLevel);
65 }
66
SoftBusGetSysTimeMs(void)67 uint64_t SoftBusGetSysTimeMs(void)
68 {
69 return GetInterface()->SoftBusGetSysTimeMs();
70 }
71
SoftBusGenerateStrHash(const unsigned char * str,uint32_t len,unsigned char * hash)72 int32_t SoftBusGenerateStrHash(const unsigned char *str, uint32_t len, unsigned char *hash)
73 {
74 return GetInterface()->SoftBusGenerateStrHash(str, len, hash);
75 }
76
ConvertBytesToHexString(char * outBuf,uint32_t outBufLen,const unsigned char * inBuf,uint32_t inLen)77 int32_t ConvertBytesToHexString(char *outBuf, uint32_t outBufLen, const unsigned char *inBuf, uint32_t inLen)
78 {
79 return GetInterface()->ConvertBytesToHexString(outBuf, outBufLen, inBuf, inLen);
80 }
81
LnnGetLocalByteInfo(InfoKey key,uint8_t * info,uint32_t len)82 int32_t LnnGetLocalByteInfo(InfoKey key, uint8_t *info, uint32_t len)
83 {
84 return GetInterface()->LnnGetLocalByteInfo(key, info, len);
85 }
86
IdServiceGetCredInfoByUdid(const char * udid,SoftBusCredInfo * credInfo)87 int32_t IdServiceGetCredInfoByUdid(const char *udid, SoftBusCredInfo *credInfo)
88 {
89 return GetInterface()->IdServiceGetCredInfoByUdid(udid, credInfo);
90 }
91
RegisterToDp(DeviceProfileChangeListener * deviceProfilePara)92 int32_t RegisterToDp(DeviceProfileChangeListener *deviceProfilePara)
93 {
94 return GetInterface()->RegisterToDp(deviceProfilePara);
95 }
96
GetUserKeyByUkId(int32_t sessionKeyId,uint8_t * uk,uint32_t ukLen)97 int32_t GetUserKeyByUkId(int32_t sessionKeyId, uint8_t *uk, uint32_t ukLen)
98 {
99 return GetInterface()->GetUserKeyByUkId(sessionKeyId, uk, ukLen);
100 }
101
CheckAclInfoIsAccesser(const AuthACLInfo * acl,bool * isAccesser)102 int32_t CheckAclInfoIsAccesser(const AuthACLInfo *acl, bool *isAccesser)
103 {
104 return GetInterface()->CheckAclInfoIsAccesser(acl, isAccesser);
105 }
106 }
107 }