harmony 鸿蒙@ohos.file.keyManager (User Key Management) (System API)
@ohos.file.keyManager (User Key Management) (System API)
This module provides common functions related to user key management, including user key uninstallation.
NOTE
- The initial APIs of this module are supported since API version 15. Newly added APIs will be marked with a superscript to indicate their earliest API version.
- This topic describes only the system APIs provided by the module.
Modules to Import
import { keyManager } from "@kit.CoreFileKit";
keyManager.deactivateUserKey
deactivateUserKey(userId: number):void
When the screen is locked, the specified user key is uninstalled synchronously. (Currently, this API is available only to lock screen applications.)
Required permission: ohos.permission.STORAGE_MANAGER_CRYPT
System capability: SystemCapability.FileManagement.StorageService.Encryption
System API: This is a system API.
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
userId | number | Yes | User ID. This parameter specifies the user who currently logs in to the lock screen application. |
Error codes
For details about the error codes, see File Management Error Codes.
ID | Error Message |
---|---|
201 | Permission verification failed. |
202 | The caller is not a system application. |
401 | The input parameter is invalid. Possible causes: Mandatory parameters are left unspecified; Or input parameter has type different from the type the interface requires. |
13600001 | IPC error. |
13600008 | No such object. Possible causes: Cannot find user key for the specified user. |
13600009 | User ID out of range. Possible causes: input parameter userId < 100 or userId > 10736. |
Example:
import { keyManager } from "@kit.CoreFileKit";
import { BusinessError } from '@ohos.base';
let userId: number = 100;
try {
keyManager.deactivateUserKey(userId);
console.info("deactivateUserKey success");
} catch (err) {
let error: BusinessError = err as BusinessError;
console.error("deactivateUserKey failed with error:" + JSON.stringify(error));
}
你可能感兴趣的鸿蒙文章
harmony 鸿蒙FileShare_PolicyErrorResult
harmony 鸿蒙FileShare_PolicyInfo
0
赞
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦