• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*
2   * Copyright (c) 2022 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_IAM_USERAUTH_INTERFACE
17  #define USER_IAM_USERAUTH_INTERFACE
18  
19  #include "vector"
20  #include "stdint.h"
21  
22  #include "common_defines.h"
23  
24  namespace OHOS {
25  namespace UserIAM {
26  namespace UserAuth {
27  typedef struct {
28      uint64_t contextId;
29      int32_t userId;
30      uint64_t challenge;
31      uint32_t authType;
32      uint32_t authTrustLevel;
33  } AuthSolution;
34  
35  typedef struct {
36      int32_t authResult;
37      uint64_t contextId;
38      int32_t userId;
39      uint64_t challenge;
40      uint32_t authType;
41      uint32_t authTrustLevel;
42      uint64_t enrolledId;
43      uint32_t version;
44      uint64_t time;
45      uint8_t sign[SIGN_LEN];
46  } UserAuthToken;
47  
48  int32_t GenerateSolution(AuthSolution param, std::vector<uint64_t> &scheduleIds);
49  int32_t RequestAuthResult(uint64_t contextId, std::vector<uint8_t> &scheduleToken, UserAuthToken &authToken,
50      std::vector<uint64_t> &scheduleIds);
51  int32_t CancelContext(uint64_t contextId, std::vector<uint64_t> &scheduleIds);
52  int32_t GetAuthTrustLevel(int32_t userId, uint32_t authType, uint32_t &authTrustLevel);
53  } // UserAuth
54  } // UserIAM
55  } // OHOS
56  
57  #endif // USER_IAM_USERAUTH_INTERFACE