• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 USER_ACCESS_CTRL_COMMON_H
17 #define USER_ACCESS_CTRL_COMMON_H
18 
19 #include <vector>
20 
21 #include "napi/native_api.h"
22 #include "napi/native_common.h"
23 
24 #include "iam_common_defines.h"
25 
26 namespace OHOS {
27 namespace UserIam {
28 namespace UserAccessCtrl {
29 constexpr size_t ARGS_TWO = 2;
30 
31 constexpr size_t PARAM0 = 0;
32 constexpr size_t PARAM1 = 1;
33 
34 constexpr size_t MAX_AUTH_TOKEN_LEN = 1024;
35 constexpr const uint64_t MAX_ALLOWABLE_VERIFY_AUTH_TOKEN_DURATION = 24 * 60 * 60 * 1000;
36 
37 struct AuthToken {
38     std::vector<uint8_t> challenge {};
39     uint32_t authTrustLevel {0};
40     int32_t authType {0};
41     int32_t tokenType {0};
42     int32_t userId {0};
43     uint64_t timeInterval {0};
44     uint64_t secureUid {0};
45     uint64_t enrolledId {0};
46     uint64_t credentialId {0};
47 };
48 
49 enum AuthTokenType: int32_t {
50     TOKEN_TYPE_LOCAL_AUTH = 0,
51     TOKEN_TYPE_LOCAL_RESIGN = 1,
52     TOKEN_TYPE_LOCAL_COAUTH = 2,
53 };
54 } // namespace OHOS
55 } // namespace UserIam
56 } // namespace UserAccessCtrl
57 #endif // USER_ACCESS_CTRL_COMMON_H