• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 OS_ACCOUNT_FRAMEWORK_APP_ACCOUNT_INFO_JSON_PARSER_H
17 #define OS_ACCOUNT_FRAMEWORK_APP_ACCOUNT_INFO_JSON_PARSER_H
18 
19 #include "app_account_info.h"
20 #include "json_utils.h"
21 
22 namespace OHOS {
23 namespace AccountSA {
24 namespace {
25 const char OWNER[] = "owner";
26 const char NAME[] = "name";
27 const char ALIAS[] = "alias";
28 const char EXTRA_INFO[] = "extraInfo";
29 const char SYNC_ENABLE[] = "syncEnable";
30 const char AUTHORIZED_APPS[] = "authorizedApps";
31 const char ASSOCIATED_DATA[] = "associatedData";
32 const char ACCOUNT_CREDENTIAL[] = "accountCredential";
33 const char OAUTH_TOKEN[] = "oauthToken";
34 const char OAUTH_TOKEN_INFOS[] = "tokenInfos";
35 const char OAUTH_TYPE[] = "authType";
36 const char OAUTH_TOKEN_STATUS[] = "status";
37 const char OAUTH_AUTH_LIST[] = "authList";
38 const std::string OAUTH_TOKEN_TO_TYPE = "tokenToType";
39 const char HYPHEN[] = "#";
40 constexpr uint32_t APP_INDEX = 0;
41 constexpr uint32_t MAX_TOKEN_NUMBER = 128;
42 constexpr uint32_t MAX_OAUTH_LIST_SIZE = 512;
43 constexpr uint32_t MAX_ASSOCIATED_DATA_NUMBER = 1024;
44 constexpr uint32_t MAX_APP_AUTH_LIST_SIZE = 1024;
45 #ifdef HAS_ASSET_PART
46 constexpr uint32_t HASH_LENGTH = 32;
47 constexpr uint32_t WIDTH_FOR_HEX = 2;
48 #endif
49 constexpr int32_t MAX_MAP_SZIE = 1024;
50 } // namespace
51 CJsonUnique ToJson(const AppAccountInfo &accountInfo);
52 bool FromJson(cJSON *jsonObject, AppAccountInfo &accountInfo);
53 } // namespace AccountSA
54 } // namespace OHOS
55 
56 #endif // OS_ACCOUNT_FRAMEWORK_APP_ACCOUNT_INFO_JSON_PARSER_H