1 /* 2 * Copyright (C) 2021-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 DEVICE_AUTH_H 17 #define DEVICE_AUTH_H 18 19 #include <stdint.h> 20 #include <stdbool.h> 21 22 #if defined(__LINUX__) || defined(_UNIX) 23 #define DEVICE_AUTH_API_PUBLIC __attribute__ ((visibility("default"))) 24 #else 25 #define DEVICE_AUTH_API_PUBLIC 26 #endif 27 28 #define FIELD_CREDENTIAL_VAL "credentialVal" 29 #define FIELD_CREDENTIAL_OWNER "credentialOwner" 30 #define FIELD_PEER_USER_SPACE_ID "peerUserSpaceId" 31 #define FIELD_GROUP_ID "groupId" 32 #define FIELD_GROUP_TYPE "groupType" 33 #define FIELD_GROUP_NAME "groupName" 34 #define FIELD_PEER_DEVICE_ID "peerDeviceId" 35 #define FIELD_IS_ADMIN "isAdmin" 36 #define FIELD_CRED_TYPE "credType" 37 #define FIELD_CREDENTIAL_TYPE "credentialType" 38 #define FIELD_IS_FORCE_DELETE "isForceDelete" 39 #define FIELD_IS_IGNORE_CHANNEL "isIgnoreChannel" 40 #define FIELD_CONNECT_PARAMS "connectParams" 41 #define FIELD_ADD_ID "addId" 42 #define FIELD_DELETE_ID "deleteId" 43 #define FIELD_APP_ID "appId" 44 #define FIELD_SERVICE_TYPE "serviceType" 45 #define FIELD_IS_DEVICE_LEVEL "isDeviceLevel" 46 #define FIELD_ALTERNATIVE "alternative" 47 #define FIELD_PEER_UDID "peerUdid" 48 #define FIELD_PEER_CONN_DEVICE_ID "peerConnDeviceId" 49 #define FIELD_KEY_LENGTH "keyLength" 50 #define FIELD_IS_CLIENT "isClient" 51 #define FIELD_SESSION_KEY "sessionKey" 52 #define FIELD_AUTH_FORM "authForm" 53 #define FIELD_CONFIRMATION "confirmation" 54 #define FIELD_GROUP_OWNER "groupOwner" 55 #define FIELD_PEER_AUTH_ID "peerAuthId" 56 #define FIELD_PEER_USER_TYPE "peerUserType" 57 #define FIELD_PEER_USER_ID "peerUserId" 58 #define FIELD_SERVICE_PKG_NAME "servicePkgName" 59 #define FIELD_USER_TYPE "userType" 60 #define FIELD_USER_ID "userId" 61 #define FIELD_SHARED_USER_ID "sharedUserId" 62 #define FIELD_OWNER_USER_ID "ownerUserId" 63 #define FIELD_DEVICE_ID "deviceId" 64 #define FIELD_PIN_CODE "pinCode" 65 #define FIELD_AUTH_ID "authId" 66 #define FIELD_UDID "udid" 67 #define FIELD_IS_SELF_PK "isSelfPk" 68 #define FIELD_GROUP_VISIBILITY "groupVisibility" 69 #define FIELD_EXPIRE_TIME "expireTime" 70 #define FIELD_IS_DELETE_ALL "isDeleteAll" 71 #define FIELD_OS_ACCOUNT_ID "osAccountId" 72 #define FIELD_ACQURIED_TYPE "acquireType" 73 #define FIELD_CRED_OP_FLAG "flag" 74 #define FIELD_CRED_OP_RESULT "result" 75 #define FIELD_AUTH_CODE "authCode" 76 #define FIELD_DEVICE_LIST "deviceList" 77 #define FIELD_IS_UDID_HASH "isUdidHash" 78 #define FIELD_PROTOCOL_EXPAND "protocolExpand" 79 #define FIELD_IS_SELF_FROM_UPGRADE "isSelfFromUpgrade" 80 #define FIELD_IS_PEER_FROM_UPGRADE "isPeerFromUpgrade" 81 #define FIELD_IS_CRED_AUTH "isCredAuth" 82 #define FIELD_CRED_ID "credId" 83 #define FIELD_CREDENTIAL_OBJ "credentialObject" 84 #define FIELD_CREDENTIAL_FORMAT "credentialFormat" 85 #define FIELD_SUBJECT "subject" 86 #define FIELD_ISSUER "issuer" 87 #define FIELD_KEY_FORMAT "keyFormat" 88 #define FIELD_PROOF_TYPE "proofType" 89 #define FIELD_ALGORITHM_TYPE "algorithmType" 90 #define FIELD_CRED_OWNER "credOwner" 91 #define FIELD_AUTHORIZED_ACCOUNT_LIST "authorizedAccountList" 92 #define FIELD_PROTOCOL_TYPE "protocolType" 93 #define FIELD_EXTEND_INFO "extendInfo" 94 #define FIELD_AUTHORIZED_DEVICE_LIST "authorizedDeviceList" 95 #define FIELD_AUTHORIZED_APP_LIST "authorizedAppList" 96 #define FIELD_ACROSS_ACCOUNT_CRED_ID "acrossAccountCredId" 97 #define FIELD_DEVICE_ID_HASH "deviceIdHash" 98 #define FIELD_USER_ID_HASH "userIdHash" 99 #define FIELD_BASE_INFO "baseInfo" 100 #define FIELD_UPDATE_LISTS "updateLists" 101 #define FIELD_PEER_OS_ACCOUNT_ID "peerOsAccountId" 102 103 /** 104 * @brief protocol expand value for bind 105 */ 106 typedef enum { 107 /** use this flag to support bind base on symmetric credential when interact with lite device */ 108 LITE_PROTOCOL_STANDARD_MODE = 1, 109 /** use this flag when interact with lite device which used iso with short pin */ 110 LITE_PROTOCOL_COMPATIBILITY_MODE = 2, 111 } ProtocolExpandValue; 112 113 /** 114 * @brief type of local system account 115 */ 116 typedef enum { 117 /** default local system account */ 118 DEFAULT_OS_ACCOUNT = 0, 119 /** the local system account of foreground user */ 120 ANY_OS_ACCOUNT = -2, 121 } OsAccountEnum; 122 123 /** 124 * @brief describes all group types 125 */ 126 typedef enum { 127 /** refers to all group types and is used to query group information */ 128 ALL_GROUP = 0, 129 /** group type of the same clound account */ 130 IDENTICAL_ACCOUNT_GROUP = 1, 131 /** group type of the p2p binding */ 132 PEER_TO_PEER_GROUP = 256, 133 /** group type shared to other cloud accounts */ 134 ACROSS_ACCOUNT_AUTHORIZE_GROUP = 1282 135 } GroupType; 136 137 /** 138 * @brief describes all group visibility types 139 */ 140 typedef enum { 141 /** visibility type of private group */ 142 GROUP_VISIBILITY_PRIVATE = 0, 143 /** visibility type of public group */ 144 GROUP_VISIBILITY_PUBLIC = -1 145 } GroupVisibility; 146 147 /** 148 * @brief describes all group operation codes 149 */ 150 typedef enum { 151 /** opeation code for group creation */ 152 GROUP_CREATE = 0, 153 /** opeation code for group destruction */ 154 GROUP_DISBAND = 1, 155 /** opeation code for inviting the peer device to join the local trusted group */ 156 MEMBER_INVITE = 2, 157 /** opeation code for joining the peer trusted group */ 158 MEMBER_JOIN = 3, 159 /** opeation code for unbinding with peer device */ 160 MEMBER_DELETE = 4, 161 } GroupOperationCode; 162 163 /** 164 * @brief describes all group authentication types 165 */ 166 typedef enum { 167 /** invalid group authentication type */ 168 AUTH_FORM_INVALID_TYPE = -1, 169 /** p2p group authentication type */ 170 AUTH_FORM_ACCOUNT_UNRELATED = 0, 171 /** group authentication type of the same cloud account */ 172 AUTH_FORM_IDENTICAL_ACCOUNT = 1, 173 /** group authentication type shared to other cloud accounts */ 174 AUTH_FORM_ACROSS_ACCOUNT = 2, 175 /** app level authentication type */ 176 AUTH_FORM_DIRECT_AUTH = 3, 177 AUTH_FORM_LIGHT_AUTH = 4, 178 } GroupAuthForm; 179 180 /** 181 * @brief describes all credential types 182 */ 183 typedef enum { 184 /** symmetrical credential type */ 185 SYMMETRIC_CRED = 1, 186 /** asymmetric credential type */ 187 ASYMMETRIC_CRED = 2, 188 } CredType; 189 190 /** 191 * @brief describes all device types 192 */ 193 typedef enum { 194 /** device type is accessory */ 195 DEVICE_TYPE_ACCESSORY = 0, 196 /** device type is controller */ 197 DEVICE_TYPE_CONTROLLER = 1, 198 /** device type is proxy */ 199 DEVICE_TYPE_PROXY = 2 200 } UserType; 201 202 /** 203 * @brief describes request response results 204 */ 205 typedef enum { 206 /** reject the request from the peer device */ 207 REQUEST_REJECTED = 0x80000005, 208 /** accept the request from the peer device */ 209 REQUEST_ACCEPTED = 0x80000006, 210 } RequestResponse; 211 212 /** 213 * @brief This structure provides the ability to monitor changes in trusted groups and devices. 214 */ 215 typedef struct { 216 /** Call it when a new group is created. */ 217 void (*onGroupCreated)(const char *groupInfo); 218 /** Call it when a group is destroyed. */ 219 void (*onGroupDeleted)(const char *groupInfo); 220 /** Call it when a group adds a trusted device. */ 221 void (*onDeviceBound)(const char *peerUdid, const char *groupInfo); 222 /** Call it when a group deletes a trusted device. */ 223 void (*onDeviceUnBound)(const char *peerUdid, const char *groupInfo); 224 /** Call it when a device has no trust relationship in all groups. */ 225 void (*onDeviceNotTrusted)(const char *peerUdid); 226 /** Call it when a device has no trust relationship in all groups of a certain type. */ 227 void (*onLastGroupDeleted)(const char *peerUdid, int groupType); 228 void (*onTrustedDeviceNumChanged)(int curTrustedDeviceNum); 229 } DataChangeListener; 230 231 /** 232 * @brief This structure provides the ability to monitor changes in credentials. 233 */ 234 typedef struct { 235 /** Call it when a cred add. */ 236 void (*onCredAdd)(const char *credId, const char *credInfo); 237 /** Call it when a cred is delete. */ 238 void (*onCredDelete)(const char *credId, const char *credInfo); 239 /** Call it when a cred update. */ 240 void (*onCredUpdate)(const char *credId, const char *credInfo); 241 } CredChangeListener; 242 243 /** 244 * @brief This structure describes the callbacks that need to be provided by the business. 245 */ 246 typedef struct { 247 /** Call it when there is data to be sent. */ 248 bool (*onTransmit)(int64_t requestId, const uint8_t *data, uint32_t dataLen); 249 /** Call it when the session key is returned. */ 250 void (*onSessionKeyReturned)(int64_t requestId, const uint8_t *sessionKey, uint32_t sessionKeyLen); 251 /** Call it when the asynchronous operation is successful. */ 252 void (*onFinish)(int64_t requestId, int operationCode, const char *returnData); 253 /** Call it when the asynchronous operation fails. */ 254 void (*onError)(int64_t requestId, int operationCode, int errorCode, const char *errorReturn); 255 /** Call it when receiving requests from other devices. */ 256 char *(*onRequest)(int64_t requestId, int operationCode, const char *reqParams); 257 } DeviceAuthCallback; 258 259 /** 260 * @brief This structure provides all the capabilities of group authentication. 261 */ 262 typedef struct { 263 /** This interface is used to process authentication data. */ 264 int32_t (*processData)(int64_t authReqId, const uint8_t *data, uint32_t dataLen, 265 const DeviceAuthCallback *gaCallback); 266 /** This interface is used to initiate authentication between devices. */ 267 int32_t (*authDevice)(int32_t osAccountId, int64_t authReqId, const char *authParams, 268 const DeviceAuthCallback *gaCallback); 269 /** This interface is used to cancel an authentication process. */ 270 void (*cancelRequest)(int64_t requestId, const char *appId); 271 /** This interface is used to get real info by pseudonym id. */ 272 int32_t (*getRealInfo)(int32_t osAccountId, const char *pseudonymId, char **realInfo); 273 /** This interface is used to get pseudonym id by an index. */ 274 int32_t (*getPseudonymId)(int32_t osAccountId, const char *indexKey, char **pseudonymId); 275 } GroupAuthManager; 276 277 typedef struct { 278 /** This interface is used to register business callbacks. */ 279 int32_t (*regCallback)(const char *appId, const DeviceAuthCallback *callback); 280 /** This interface is used to unregister business callbacks. */ 281 int32_t (*unRegCallback)(const char *appId); 282 /** This interface is used to register callback for data change monitoring. */ 283 int32_t (*regDataChangeListener)(const char *appId, const DataChangeListener *listener); 284 /** This interface is used to unregister callback for data change monitoring. */ 285 int32_t (*unRegDataChangeListener)(const char *appId); 286 /** This interface is used to create a trusted group. */ 287 int32_t (*createGroup)(int32_t osAccountId, int64_t requestId, const char *appId, const char *createParams); 288 /** This interface is used to delete a trusted group. */ 289 int32_t (*deleteGroup)(int32_t osAccountId, int64_t requestId, const char *appId, const char *disbandParams); 290 /** This interface is used to add a trusted device to a trusted group. */ 291 int32_t (*addMemberToGroup)(int32_t osAccountId, int64_t requestId, const char *appId, const char *addParams); 292 /** This interface is used to delete a trusted device from a trusted group. */ 293 int32_t (*deleteMemberFromGroup)(int32_t osAccountId, int64_t requestId, const char *appId, 294 const char *deleteParams); 295 /** This interface is used to process data of binding or unbinding devices. */ 296 int32_t (*processData)(int64_t requestId, const uint8_t *data, uint32_t dataLen); 297 /** This interface is used to batch add trusted devices with account relationships. */ 298 int32_t (*addMultiMembersToGroup)(int32_t osAccountId, const char *appId, const char *addParams); 299 /** This interface is used to batch delete trusted devices with account relationships. */ 300 int32_t (*delMultiMembersFromGroup)(int32_t osAccountId, const char *appId, const char *deleteParams); 301 /** This interface is used to obtain the registration information of the local device. */ 302 int32_t (*getRegisterInfo)(const char *reqJsonStr, char **returnRegisterInfo); 303 /** This interface is used to check whether the specified application has access rights to the group. */ 304 int32_t (*checkAccessToGroup)(int32_t osAccountId, const char *appId, const char *groupId); 305 /** This interface is used to obtain all public key information related to a device. */ 306 int32_t (*getPkInfoList)(int32_t osAccountId, const char *appId, const char *queryParams, char **returnInfoList, 307 uint32_t *returnInfoNum); 308 /** This interface is used to obtain group information of a group. */ 309 int32_t (*getGroupInfoById)(int32_t osAccountId, const char *appId, const char *groupId, char **returnGroupInfo); 310 /** This interface is used to obtain the group information of groups that meet the query parameters. */ 311 int32_t (*getGroupInfo)(int32_t osAccountId, const char *appId, const char *queryParams, 312 char **returnGroupVec, uint32_t *groupNum); 313 /** This interface is used to obtain all group information of a specific group type. */ 314 int32_t (*getJoinedGroups)(int32_t osAccountId, const char *appId, int groupType, 315 char **returnGroupVec, uint32_t *groupNum); 316 /** This interface is used to obtain all group information related to a certain device. */ 317 int32_t (*getRelatedGroups)(int32_t osAccountId, const char *appId, const char *peerDeviceId, 318 char **returnGroupVec, uint32_t *groupNum); 319 /** This interface is used to obtain the information of a trusted device. */ 320 int32_t (*getDeviceInfoById)(int32_t osAccountId, const char *appId, const char *deviceId, const char *groupId, 321 char **returnDeviceInfo); 322 /** This interface is used to obtain all trusted device information in a group. */ 323 int32_t (*getTrustedDevices)(int32_t osAccountId, const char *appId, const char *groupId, 324 char **returnDevInfoVec, uint32_t *deviceNum); 325 /** This interface is used to query whether a specified device exists in the group. */ 326 bool (*isDeviceInGroup)(int32_t osAccountId, const char *appId, const char *groupId, const char *deviceId); 327 /** This interface is used to cancel a binding or unbinding process. */ 328 void (*cancelRequest)(int64_t requestId, const char *appId); 329 /** This interface is used to destroy the information returned by the internal allocated memory. */ 330 void (*destroyInfo)(char **returnInfo); 331 } DeviceGroupManager; 332 333 /** 334 * @brief This enum provides all the operationCode of interface ProcessCredential. 335 */ 336 enum { 337 /** invalid operationCode for initialize */ 338 CRED_OP_INVALID = -1, 339 /** operationCode for ProcessCredential to query credential */ 340 CRED_OP_QUERY, 341 /** operationCode for ProcessCredential to create credential */ 342 CRED_OP_CREATE, 343 /** operationCode for ProcessCredential to import credential */ 344 CRED_OP_IMPORT, 345 /** operationCode for ProcessCredential to delete credential */ 346 CRED_OP_DELETE, 347 }; 348 349 /** 350 * @brief This enum provides all the flag of reqJsion for interface ProcessCredential. 351 */ 352 enum { 353 /** invalid flag for initialize */ 354 RETURN_FLAG_INVALID = -1, 355 /** flag for only return result */ 356 RETURN_FLAG_DEFAULT, 357 /** flag for return result and publicKey */ 358 RETURN_FLAG_PUBLIC_KEY, 359 }; 360 361 /** 362 * @brief This enum provides all the acquireType of interface StartAuthDevice & ProcessAuthDevice. 363 */ 364 typedef enum { 365 /** invalid acquireType for initialize */ 366 ACQUIRE_TYPE_INVALID = -1, 367 /** acquireType for p2p bind */ 368 P2P_BIND, 369 } AcquireType; 370 371 /** 372 * @brief This structure provides all the capabilities of credential authentication. 373 */ 374 typedef struct { 375 /** This interface is used to process authentication data. */ 376 int32_t (*processCredData)(int64_t authReqId, const uint8_t *data, uint32_t dataLen, 377 const DeviceAuthCallback *gaCallback); 378 /** This interface is used to initiate authentication between devices. */ 379 int32_t (*authCredential)(int32_t osAccountId, int64_t authReqId, const char *authParams, 380 const DeviceAuthCallback *gaCallback); 381 } CredAuthManager; 382 383 #ifdef __cplusplus 384 extern "C" { 385 #endif 386 387 /** 388 * @brief Process Credential data. 389 * 390 * This API is used to process Credential data. 391 * 392 * @param operationCode: use one of CRED_OP_QUERY|CRED_OP_CREATE|CRED_OP_IMPORT|CRED_OP_DELETE 393 * @param requestParams: json string contains group of osAccountId|deviceId|serviceType|acquireType|flag 394 * @param returnData: json string contains group of result|publicKey 395 * 396 * @return When the ipc call is successful, it returns HC_SUCCESS. 397 * Otherwise, it returns other values. 398 */ 399 DEVICE_AUTH_API_PUBLIC int32_t ProcessCredential( 400 int32_t operationCode, const char *requestParams, char **returnData); 401 402 /** 403 * @brief Start to auth device. 404 * 405 * This API is used to start to auth device. 406 * 407 * @param requestId: id of a request 408 * @param authParams: json string contains group of osAccountId|deviceId|serviceType|acquireType|pinCode 409 * @param callbak: callback object 410 * 411 * @return When the ipc call is successful, it returns HC_SUCCESS. 412 * Otherwise, it returns other values. 413 */ 414 DEVICE_AUTH_API_PUBLIC int32_t StartAuthDevice( 415 int64_t requestId, const char *authParams, const DeviceAuthCallback *callbak); 416 417 /** 418 * @brief Process auth device data. 419 * 420 * This API is used to process auth device data. 421 * 422 * @param requestId: id of a request 423 * @param authParams: json string contains group of osAccountId|data 424 * @param callbak: callback object 425 * 426 * @return When the ipc call is successful, it returns HC_SUCCESS. 427 * Otherwise, it returns other values. 428 */ 429 DEVICE_AUTH_API_PUBLIC int32_t ProcessAuthDevice( 430 int64_t requestId, const char *authParams, const DeviceAuthCallback *callbak); 431 432 /** 433 * @brief Cancle auth device request. 434 * 435 * This API is used to cancle auth device request. 436 * 437 * @param requestId: id of a request 438 * @param authParams: json string contains osAccountId or NULL 439 * 440 * @return When the ipc call is successful, it returns HC_SUCCESS. 441 * Otherwise, it returns other values. 442 */ 443 DEVICE_AUTH_API_PUBLIC int32_t CancelAuthRequest(int64_t requestId, const char *authParams); 444 445 /** 446 * @brief Initialize device auth service. 447 * 448 * This API is used to initialize device auth service. 449 * 450 * @return When the service initialization is successful, it returns HC_SUCCESS. 451 * Otherwise, it returns other values. 452 * @see DestroyDeviceAuthService 453 */ 454 DEVICE_AUTH_API_PUBLIC int InitDeviceAuthService(void); 455 456 /** 457 * @brief Destroy device auth service. 458 * 459 * This API is used to destroy device auth service. 460 * 461 * @see InitDeviceAuthService 462 */ 463 DEVICE_AUTH_API_PUBLIC void DestroyDeviceAuthService(void); 464 465 /** 466 * @brief Get group authentication instance. 467 * 468 * This API is used to get group authentication instance. 469 * The InitDeviceAuthService function must be called before using this method. 470 * 471 * @return When the method call result is successful, it returns GroupAuthManager instance. 472 * Otherwise, it returns NULL. 473 */ 474 DEVICE_AUTH_API_PUBLIC const GroupAuthManager *GetGaInstance(void); 475 476 /** 477 * @brief Get group management instance. 478 * 479 * This API is used to get group management instance. 480 * The InitDeviceAuthService function must be called before using this method. 481 * 482 * @return When the method call result is successful, it returns DeviceGroupManager instance. 483 * Otherwise, it returns NULL. 484 */ 485 DEVICE_AUTH_API_PUBLIC const DeviceGroupManager *GetGmInstance(void); 486 487 typedef struct { 488 int32_t (*addCredential)(int32_t osAccountId, const char *requestParams, char **returnData); 489 490 int32_t (*exportCredential)(int32_t osAccountId, const char *credId, char **returnData); 491 492 int32_t (*queryCredentialByParams)(int32_t osAccountId, const char *requestParams, char **returnData); 493 494 int32_t (*queryCredInfoByCredId)(int32_t osAccountId, const char *credId, char **returnData); 495 496 int32_t (*deleteCredential)(int32_t osAccountId, const char *credId); 497 498 int32_t (*updateCredInfo)(int32_t osAccountId, const char *credId, const char *requestParams); 499 500 int32_t (*agreeCredential)(int32_t osAccountId, const char *selfCredId, const char *requestParams, 501 char **returnData); 502 503 int32_t (*registerChangeListener)(const char *appId, CredChangeListener *listener); 504 505 int32_t (*unregisterChangeListener)(const char *appId); 506 507 int32_t (*deleteCredByParams)(int32_t osAccountId, const char *requestParams, char **returnData); 508 509 int32_t (*batchUpdateCredentials)(int32_t osAccountId, const char *requestParams, char **returnData); 510 511 void (*destroyInfo)(char **returnData); 512 } CredManager; 513 514 DEVICE_AUTH_API_PUBLIC const CredManager *GetCredMgrInstance(void); 515 516 /** 517 * @brief Get credential authentication instance. 518 * 519 * This API is used to get credential authentication instance. 520 * The InitDeviceAuthService function must be called before using this method. 521 * 522 * @return When the method call result is successful, it returns CredAuthManager instance. 523 * Otherwise, it returns NULL. 524 */ 525 DEVICE_AUTH_API_PUBLIC const CredAuthManager *GetCredAuthInstance(void); 526 527 typedef struct { 528 uint8_t *data; 529 uint32_t length; 530 } DataBuff; 531 532 typedef struct { 533 int32_t (*getClientSharedKey)(const char *peerPkWithSig, const char *serviceId, DataBuff *returnSharedKey, 534 DataBuff *returnRandom); 535 int32_t (*getServerSharedKey)(const char *peerPkWithSig, const char *serviceId, const DataBuff *random, 536 DataBuff *returnSharedKey); 537 void (*destroyDataBuff)(DataBuff *dataBuff); 538 } AccountVerifier; 539 540 DEVICE_AUTH_API_PUBLIC const AccountVerifier *GetAccountVerifierInstance(void); 541 542 typedef struct { 543 int32_t (*startLightAccountAuth)(int32_t osAccountId, int64_t requestId, 544 const char *serviceId, const DeviceAuthCallback *laCallBack); 545 int32_t (*processLightAccountAuth)(int32_t osAccountId, int64_t requestId, 546 DataBuff *inMsg, const DeviceAuthCallback *laCallBack); 547 } LightAccountVerifier; 548 549 DEVICE_AUTH_API_PUBLIC const LightAccountVerifier *GetLightAccountVerifierInstance(void); 550 551 #ifdef __cplusplus 552 } 553 #endif 554 #endif 555