1# @ohos.file.keyManager (User Key Management) (System API) 2 3This module provides common functions related to user key management, including user key uninstallation. 4 5> **NOTE** 6> 7> - 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. 8> - This topic describes only the system APIs provided by the module. 9 10## Modules to Import 11 12```ts 13import { keyManager } from "@kit.CoreFileKit"; 14``` 15 16## keyManager.deactivateUserKey 17 18deactivateUserKey(userId: number):void 19 20When the screen is locked, the specified user key is uninstalled synchronously. **(Currently, this API is available only to lock screen applications.)** 21 22**Required permission**: ohos.permission.STORAGE_MANAGER_CRYPT 23 24**System capability**: SystemCapability.FileManagement.StorageService.Encryption 25 26**System API**: This is a system API. 27 28**Parameters** 29 30 | Name | Type | Mandatory| Description| 31 | ---------- | ------ | ---- | ---- | 32 | userId | number | Yes | User ID. This parameter specifies the user who currently logs in to the lock screen application.| 33 34**Error codes** 35 36For details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md). 37 38| ID| Error Message| 39| -------- | -------- | 40| 201 | Permission verification failed. | 41| 202 | The caller is not a system application. | 42| 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. | 43| 13600001 | IPC error. | 44| 13600008 | No such object. Possible causes: Cannot find user key for the specified user. | 45| 13600009 | User ID out of range. Possible causes: input parameter userId < 100 or userId > 10736. | 46 47**Example**: 48 49 ```ts 50 import { keyManager } from "@kit.CoreFileKit"; 51 import { BusinessError } from '@ohos.base'; 52 let userId: number = 100; 53 try { 54 keyManager.deactivateUserKey(userId); 55 console.info("deactivateUserKey success"); 56 } catch (err) { 57 let error: BusinessError = err as BusinessError; 58 console.error("deactivateUserKey failed with error:" + JSON.stringify(error)); 59 } 60 ``` 61