1/*
2 * Copyright (C) 2023 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_IDENTITY_COMMON_H
17#define AUTH_IDENTITY_COMMON_H
18
19#include "data_manager.h"
20#include "hc_vector.h"
21#include "identity_defines.h"
22#include "json_utils.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28int32_t ConvertPsk(const Uint8Buff *srcPsk, Uint8Buff *sharedSecret);
29int32_t SetPreSharedUrlForProof(const char *urlStr, Uint8Buff *preSharedUrl);
30CJson *CreateCredUrlJson(int32_t credentailType, int32_t keyType, int32_t trustType);
31
32#if 1
33int32_t GetSelfDeviceEntry(int32_t osAccountId, const char *groupId, TrustedDeviceEntry *deviceEntry);
34const char *GetPeerDevIdFromJson(const CJson *in, bool *isUdid);
35int32_t GetPeerDeviceEntry(
36    int32_t osAccountId, const CJson *in, const char *groupId, TrustedDeviceEntry *returnDeviceEntry);
37
38void FreeBuffData(Uint8Buff *buff);
39
40IdentityInfo *CreateIdentityInfo(void);
41void DestroyIdentityInfo(IdentityInfo *info);
42
43IdentityInfoVec CreateIdentityInfoVec(void);
44void ClearIdentityInfoVec(IdentityInfoVec *vec);
45
46ProtocolEntityVec CreateProtocolEntityVec(void);
47void ClearProtocolEntityVec(ProtocolEntityVec *vec);
48#endif
49
50#ifdef __cplusplus
51}
52#endif
53
54#endif