default
The SecurityManager class provides APIs to interact with privileges.
Constructors
new default()
new default():
default
Returns
Methods
getCurrentContextCredential()
staticgetCurrentContextCredential():ICredential
Returns
getMajorVersion()
staticgetMajorVersion():number
Returns
number
The major version number.
Brief
Get the major version number.
getMinorVersion()
staticgetMinorVersion():number
Returns
number
The minor version number.
Brief
Get the minor version number.
getPatchVersion()
staticgetPatchVersion():number
Returns
number
The patch version number.
Brief
Get the patch version number.
getPrivilegeState()
Call Signature
staticgetPrivilegeState(privilege):Promise<PrivilegeState>
Get the state of a run-time privilege for the calling package.
Parameters
privilege
string
The run-time privilege to modify.
Returns
Promise<PrivilegeState>
On success, the promise is resolved with the current state of the privilege for the calling package. On error, the promise is rejected with the error message: "Failed to get privilege state."
Call Signature
staticgetPrivilegeState(privilege,packageId):Promise<PrivilegeState>
Get the state of a run-time privilege for the specified package.
Parameters
privilege
string
The run-time privilege to modify.
packageId
string
The package ID for the package to get the privilege state for.
Returns
Promise<PrivilegeState>
On success, the promise is resolved with the current state of the privilege for the specified package. On error, the promise is rejected with the error message: "Failed to get privilege state."
Privilege
The "com.amazon.privilege.package.query" privilege is required.
getRuntimePrivilegeStates()
staticgetRuntimePrivilegeStates(credential):Promise<IRuntimePrivilege[]>
Parameters
credential
Returns
Promise<IRuntimePrivilege[]>
requestPrivilege()
staticrequestPrivilege(privilege):Promise<PrivilegeState>
Request permission to use a run-time privilege
Parameters
privilege
string
The run-time privilege to request access to.
Returns
Promise<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
setPrivilegeState()
staticsetPrivilegeState(packageId,privilege,state):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
State to set the run-time privilege to.
Returns
Promise<string>
On success, the promise is resolved. On error, the promise is rejected with the error message: "Failed to set privilege state."
Privilege
The "com.amazon.security.privilege.set-privilege-state" privilege is required.
setRuntimePrivilegeStates()
staticsetRuntimePrivilegeStates(credential,states):Promise<void>
Parameters
credential
states
Returns
Promise<void>
Last updated: Oct 02, 2025

