SecurityManager
The SecurityManager class provides APIs to interact with privileges.
Constructors
new SecurityManager()
new SecurityManager(): SecurityManager
Returns
Methods
getCurrentContextCredential()
staticgetCurrentContextCredential():SecurityManagerTypes.ICredential
Returns
SecurityManagerTypes.ICredential
getMajorVersion()
staticgetMajorVersion():number
Get the major version number. The major version number.
Returns
number
getMinorVersion()
staticgetMinorVersion():number
Get the minor version number. The minor version number.
Returns
number
getPatchVersion()
staticgetPatchVersion():number
Get the patch version number. The patch version number.
Returns
number
getPrivilegeState()
staticgetPrivilegeState(privilege:string, packageId?:string | undefined):Promise<SecurityManagerTypes.PrivilegeState>
Parameters
privilege
string
packageId?
string | undefined
Returns
Promise<SecurityManagerTypes.PrivilegeState>
getRuntimePrivilegeStates()
staticgetRuntimePrivilegeStates(credential:SecurityManagerTypes.ICredential):Promise<SecurityManagerTypes.IRuntimePrivilege[]>
Parameters
credential
SecurityManagerTypes.ICredential
Returns
Promise<SecurityManagerTypes.IRuntimePrivilege[]>
requestPrivilege()
staticrequestPrivilege(privilege:string):Promise<SecurityManagerTypes.PrivilegeState>
Request permission to use a run-time privilege
Parameters
privilege
string
The run-time privilege to request access to.
Returns
Promise<SecurityManagerTypes.PrivilegeState>
PromiseSecurityManagerTypes.PrivilegeState On success, the promise is resolved with the new state of the privilege for the calling package. On error, the promise is rejected with one of the following error messages:
- "Failed to get privilege state" - An error occurred retrieving the new privilege state
- "Failed to launch privilege request handler" - An error occurred while attempting to launch a system component to get the user's consent
requestPrivileges()
staticrequestPrivileges(privileges:string[]):Promise<boolean[]>
Parameters
privileges
string[]
Returns
Promise<boolean[]>
setPrivilegeState()
staticsetPrivilegeState(packageId:string, privilege:string, state:SecurityManagerTypes.PrivilegeState):Promise<string>
Sets the run-time privilege to a certain state for a specified package.
Parameters
packageId
string
The packageId value of the specified package.
privilege
string
The run-time privilege to modify.
state
SecurityManagerTypes.PrivilegeState
State to set the run-time privilege to.
Returns
Promise<string>
Promise On success, the promise is resolved. On error, the promise is rejected with the error message: "Failed to set privilege state."
setRuntimePrivilegeStates()
staticsetRuntimePrivilegeStates(credential:SecurityManagerTypes.ICredential, states:SecurityManagerTypes.IRuntimePrivilege[]):Promise<void>
Parameters
credential
SecurityManagerTypes.ICredential
states
SecurityManagerTypes.IRuntimePrivilege[]
Returns
Promise<void>
Last updated: Jul 22, 2026

