This PR creates a /lock endpoint that can be used to lock and unlock the device settings.When the lock is active any attempt to update the /settings endpoint will fail with a 409 status.
NOTE: the settings lock DOES NOT currently prevent restart or restore operations on the /settings endpoint.
A GET on /lock will return the state of the device
{
"state": "locked"
}
or
{
"state": "unlocked"
}
A PUT on /lock will attempt to lock the settings. Requests must include a JSON body with a pwd member. The value of pwd should be a password which is used to validate, or create/store a signature in the device_config file. Ex request body...
{
"pwd": "SuPeR SeCrEt"
}
If the lock is active - the value pwd must be the same as the value used when the lock was created. A match will unlock the device.
If the lock is not active, a lock will be created using the value of pwd.
The response body of PUT upon success is the new state of the device (same format as returned by GET).
If an error occurs the /lock endpoint returns an appropriate http status.
400 - pwd member missing
403 - incorrect value for pwd
This PR creates a /lock endpoint that can be used to lock and unlock the device settings.When the lock is active any attempt to update the /settings endpoint will fail with a 409 status.
NOTE: the settings lock DOES NOT currently prevent restart or restore operations on the /settings endpoint.
A GET on /lock will return the state of the device
{ "state": "locked" } or
{ "state": "unlocked" } A PUT on /lock will attempt to lock the settings. Requests must include a JSON body with a pwd member. The value of pwd should be a password which is used to validate, or create/store a signature in the device_config file. Ex request body...
{ "pwd": "SuPeR SeCrEt" } If the lock is active - the value pwd must be the same as the value used when the lock was created. A match will unlock the device. If the lock is not active, a lock will be created using the value of pwd.
The response body of PUT upon success is the new state of the device (same format as returned by GET).
If an error occurs the /lock endpoint returns an appropriate http status. 400 - pwd member missing 403 - incorrect value for pwd