Skip to content

Keys and IDs

XternA edited this page Aug 31, 2024 · 7 revisions

Keys, IDs, API Keys, it's all the same thing here. The use of these keys is a form of identification when registering the device with the application so that it binds all earnings that the device earns to the app's account holder.

Device ID (UUID)

Applications that require the device ID when registering in the dashboard can be found during the setup configuration phase when auto-generating a UUID for the first time.

[ EARNAPP ]
Go to https://bit.ly/4a4XJLF to register account. (CTRL + Click)
 - If previously installed. Obtain UUID from the dashboard to re-assign. Recommended, otherwise new UUID is generated. Go to dashboard to register device.
Do you want to auto-generate a new UUID for EARNAPP_DEVICE_UUID? (y/n): y
A new UUID has been auto-generated for EARNAPP_DEVICE_UUID: sdk-node-ae2c09e9196741bcf251e8524975ef90

Press Enter to continue...

Note this ID and register it in the dashboard when needed.

Alternatively, this ID is also stored in the .env configuration file.

[ Re-register the same UUID ]

In the event, the UUID is needed again for re-registering the same machine. Obtain the UUID from the application site's dashboard, typically in the device section.

This UUID can then be re-applied when configuring the app's credentials in the tool's setup configurations.

[ EARNAPP ]
Go to https://bit.ly/4a4XJLF to register an account. (CTRL + Click)
 - If previously installed. Obtain UUID from the dashboard to re-assign. Recommended, otherwise new UUID is generated. Go to dashboard to register device.
Do you want to auto-generate a new UUID for EARNAPP_DEVICE_UUID? (y/n): n
Do you want to define an existing UUID? (y/n): y
Enter a new value for EARNAPP_DEVICE_UUID (or press Enter to skip): sdk-node-ae2c09e9196741bcf251e8524975ef90

This is so that the same device continues to be registered in the application's dashboard, instead of duplicate entries. This is important as some apps don't permit deleting/modifying once a device is added so you might run out of limits or have many orphan devices shown in the dashboard.

Device Keys

Device keys sometimes can also be referred to as UUID. In this instance, this would typically be generated by the app and given to us. It's usually found in the log file.

To access the log file of the application run the following command:

docker logs <name-of-application>

Refer to Checking Logs if unsure how to obtain the application name ID.

Then look around the log file for identity that would indicate a device key, ID or some sort.

For example:

2024/04/09 01:02:10 Build version: 2022-07-12_11:08:44AM-LINUX
2024/04/09 01:02:10 ENV: prod
2024/04/09 01:02:10 Device Key:  f17220f4a8c1a01967ffa5402c69cd1024571259f6ddf9e15f0f9e143eb3efce6
2024/04/09 01:02:13 get url https://config-alpha-01.sgp1.digitaloceanspaces.com/client_config_prod_v0.1.json content length 517
2024/04/09 01:02:13 Client version:  14
2024/04/09 01:02:13 connect to server 159.223.219.217:50001
2024/04/09 01:02:14 Status: OK
2024/04/09 01:03:03 Status: OK

Take this device key to register in the dashboard.

Machine ID

A machine ID is a bit like a seed phrase (recovery phrase), a hex string used for generating the corresponding device key. This is important because applications such as Spide Network depends on the machine ID to rehash and generate a device key based on the given machine ID.

You will always be able to regenerate the same device key if you know the machine ID. But you can't reverse the device key to get the machine ID.

Why is this important? If you need to reinstall or migrate the device instance to new hardware, the device is already registered so you want to re-use the same device. Having the same device key that's already registered on the application which doesn't permit deletion once registered overcomes this limitation.

When setting up the configuration for deployment the first time, opt to auto-generate a machine ID. This will create a new machine ID stored in the .env config file, which can be viewed from the tool later on. On auto-generating the machine ID, it will also display this for reference.

Example

Do you want to auto-generate a new UUID for SPIDE_MACHINE_ID? (y/n): y
A new UUID has been auto-generated for SPIDE_MACHINE_ID: d7c32028b7b6b062356224cb79eaf2e0

Press Enter to continue...

The next time the application is redeployed on the same machine that has the config file configured will reuse the same machine ID unless you re-generate a new machine ID.

This command can also used to fetch the machine ID from the docker logs.

docker logs <app_name> 2>&1 | grep "Machine ID"

Migrating an existing device machine or upgrading, make a note of this machine ID and re-apply it in the config setup phase to reuse the same ID for the device that has been migrated.

⚠️ A separate machine ID should correspond to each device that has been registered. For example, if you have deployed onto multiple machines, there should be a unique machine ID for each so the device key doesn't clash. To re-register an existing device, the same machine ID should be used.

API Keys

When it comes to API keys, these replace those applications that use the email and password authentication configuration of the application in the setup configuration process.

To obtain the API key, log into the app's site it will either be located in the dashboard section or usually in the device section. Other cases involve looking around the UI. It can sometimes be hidden in the profile settings.

Grab the API key and register during the setup configuration process when prompted.

Clone this wiki locally