Members
name
- Source:
The project's name.
Example
project.name();
quotas
- Source:
The project quotas.
Example
// Create map of supported devices.
let supported = {};
(await corellium.supported()).forEach(modelInfo => {
supported[modelInfo.name] = modelInfo;
});
// Get how many CPUs we're currently using.
let cpusUsed = 0;
instances.forEach(instance => {
cpusUsed += supported[instance.flavor].quotas.cpus;
});
console.log('Used: ' + cpusUsed + '/' + project.quotas.cpus);
quotasUsed
- Source:
Properties:
Name | Type | Description |
---|---|---|
cores |
number | Number of used CPU cores |
How much of the project's quotas are currently used. To ensure this information is up to date, call Project#refresh() first.
Example
project.quotasUsed();
Methods
(async) addKey(key, kind, labelopt) → {Promise.<ProjectKey>}
- Source:
Add a public key to project.
Example
project.addKey(key, 'ssh', 'SSH Key');
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string | the public key, as formatted in a .pub file |
||
kind |
'ssh' | 'adb' |
ssh
|
||
label |
string |
<optional> |
null
|
defaults to the public key comment, if present |
Returns:
- Type
- Promise.<ProjectKey>
(async) createInstance(options, vmmioopt) → {Promise.<Instance>}
- Source:
Creates an instance and returns the Instance object. The options are passed directly to the API.
Example
Creating an instance and waiting for it to start its first boot
const instance = await project.createInstance({
flavor: 'iphone6',
os: '11.3',
name: 'Test Device',
osbuild: '15E216',
patches: 'corelliumd',
bootOptions: {
udid: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
},
});
await instance.finishRestore();
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | The options for instance creation. These are the same as the JSON options passed to the instance creation API endpoint. For a full list of possible options, see the API documentation. Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vmmio |
Array.<vmmio> |
<optional> |
VMMIO options for external MMIO support |
Returns:
- Type
- Promise.<Instance>
(async) createRole(grantee, type)
- Source:
Give permissions to this project for a Team or a User (adds a Role).
This function is only available to domain and project administrators.
Example
project.createRole(grantee, 'user');
Parameters:
Name | Type | Default | Description |
---|---|---|---|
grantee |
User | Team | ||
type |
string |
user
|
user ID |
(async) deleteImage(image)
- Source:
Delete a Image
Parameters:
Name | Type | Description |
---|---|---|
image |
Image |
(async) deleteIotFirmware(firmwareImage)
- Source:
Delete an IoT firmware
Parameters:
Name | Type | Description |
---|---|---|
firmwareImage |
FirmwareImage |
(async) deleteKernel(kernelImage)
- Source:
Delete a kernel
Parameters:
Name | Type | Description |
---|---|---|
kernelImage |
KernelImage |
(async) deleteKey(keyId)
- Source:
Delete public key from the project
Example
project.deleteKey('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
Parameters:
Name | Type | Description |
---|---|---|
keyId |
string |
(async) destroy()
- Source:
Destroy this project.
Example
project.destroy();
(async) getInstance(id) → {Promise.<Instance>}
- Source:
Returns the Instance with the given ID.
Example
await project.getInstance('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
Returns:
- Type
- Promise.<Instance>
(async) getToken() → {string}
- Source:
Returns refreshed authentication token
Example
let token = await project.getToken()
Returns:
token
- Type
- string
(async) instances() → {Promise.<Array.<Instance>>}
- Source:
Returns an array of the Instances in this project.
Example
Finding the first instance with a given name
const instances = await project.instances();
const instance = instances.find(instance => instance.name === 'Test Device');
Returns:
The instances in this project
- Type
- Promise.<Array.<Instance>>
(async) keys() → {Promise.<Array.<ProjectKey>>}
- Source:
Returns a list of authorized keys associated with the project. When a new instance is created in this project, its authorized_keys (iOS) or adbkeys (Android) will be populated with these keys by default. Adding or removing keys from the project will have no effect on existing instances.
Example
let keys = project.keys();
for(let key of keys)
console.log(key);
Returns:
- Type
- Promise.<Array.<ProjectKey>>
(async) refresh()
- Source:
Reload the project info. This currently consists of name and quotas, but will likely include more in the future.
Example
project.refresh();
(async) roles() → {Array.<Role>}
- Source:
Returns a list of Roles associated with this project, showing who has permissions over this project.
This function is only available to domain and project administrators.
Example
await project.roles();
Returns:
- Type
- Array.<Role>
(async) setQuotas(quotas)
- Source:
Sets the project quotas. Only the cores property is currently respected.
Parameters:
Name | Type | Description |
---|---|---|
quotas |
ProjectQuotas |
(async) uploadImage(type, filePath, name, progressopt) → {Promise.<Image>}
- Source:
Add an image to the project. These images may be removed at any time and are meant to facilitate creating a new Instance with images.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | E.g. fw for the main firmware image. |
|
filePath |
string | The path on the local file system to get the file. |
|
name |
string | The name of the file to identify the file on the server. Usually the basename of the path. |
|
progress |
Project~progressCallback |
<optional> |
The callback for file upload progress information. |
Returns:
- Type
- Promise.<Image>
(async) uploadIotFirmware(filePath, name, progressopt) → {Promise.<FirmwareImage>}
- Source:
Add a custom IoT firmware image to a project for use in creating new instances.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
filePath |
string | The path on the local file system to get the firmware file. |
|
name |
string | The name of the file to identify the file on the server. Usually the basename of the path. |
|
progress |
Project~progressCallback |
<optional> |
The callback for file upload progress information. |
Returns:
- Type
- Promise.<FirmwareImage>
(async) uploadKernel(filePath, name, progressopt) → {Promise.<KernelImage>}
- Source:
Add a kernel image to a project for use in creating new instances.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
filePath |
string | The path on the local file system to get the kernel file. |
|
name |
string | The name of the file to identify the file on the server. Usually the basename of the path. |
|
progress |
Project~progressCallback |
<optional> |
The callback for file upload progress information. |
Returns:
- Type
- Promise.<KernelImage>
(async) uploadVmfile(filePath, name, progressopt) → {Promise.<string>}
- Source:
Add a vmfile image to a project for use in creating new instances.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
filePath |
string | The path on the local file system to get the vmfile file |
|
name |
string | The name of the file to identify the file on the server, usually the basename of the path. |
|
progress |
Project~progressCallback |
<optional> |
The callback for the file upload progress information. |
Returns:
- Type
- Promise.<string>
(async) vpnConfig(type, clientUUID) → {Promise.<Buffer>}
- Source:
Get the VPN configuration to connect to the project network. This is only available for cloud. At least one instance must be on in the project.
Example
await project.vpnConfig('ovpn', undefined)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
type |
string |
ovpn
|
Could be either "ovpn" or "tblk" to select between OpenVPN and TunnelBlick configuration formats. TunnelBlick files are delivered as a ZIP file and OpenVPN configuration is just a text file. |
clientUUID |
string | An arbitrary UUID to uniquely associate this VPN configuration with so it can be later identified in a list of connected clients. Optional. |
Returns:
- Type
- Promise.<Buffer>