Constructors
new default()
new default():default
Returns
default
Methods
getCurrentContextCredential()
static getCurrentContextCredential(): ICredential
Returns
ICredential
getMajorVersion()
static getMajorVersion(): number
Returns
number
The major version number.
Brief
Get the major version number.getMinorVersion()
static getMinorVersion(): number
Returns
number
The minor version number.
Brief
Get the minor version number.getPatchVersion()
static getPatchVersion(): number
Returns
number
The patch version number.
Brief
Get the patch version number.getPrivilegeState()
Call Signature
static getPrivilegeState(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
static getPrivilegeState(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()
static getRuntimePrivilegeStates(credential): Promise<IRuntimePrivilege[]>
Parameters
credential
ICredential
Returns
Promise<IRuntimePrivilege[]>
requestPrivilege()
static requestPrivilege(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()
static setPrivilegeState(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
PrivilegeState
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()
static setRuntimePrivilegeStates(credential, states): Promise<void>
Parameters
credential
ICredential
states
IRuntimePrivilege[]
Returns
Promise<void>

