Security
Security management API allows you to manually set PIN code interfaces or get current PIN code.
All methods
Methods | Description | Supported since |
---|---|---|
getPinCode() | Get PIN code, 4 digits number string | 4.1 |
setPinCode() | Set PIN code, 4 digits number string | 4.1 |
generateRandomPinCode() | Generate 4 digits number string and set it as PIN code | 4.1 |
getPinCode()
Method getPinCode()
will returns current PIN code, 4 digits number string.
await sos.management.security.getPinCode(); // Returns e.g. "1234"
setPinCode()
Method setPinCode()
will set the current PIN code, 4 digits number string.
PIN code 0000
is not allowed according to the default PIN after boot when the device is not connected to the internet!
Param | Type | Required | Description |
---|---|---|---|
pinCode | String | Yes | Set new PIN code |
Javascript example
await sos.management.security.setPinCode("9999");
GitHub Example
generateRandomPinCode()
Method generateRandomPinCode()
will generate random 4 digits number string and set it as current PIN code.
Javascript example
await sos.management.security.generateRandomPinCode(); // Generate new random PIN code
const newPinCode = await sos.management.security.getPinCode(); // Get PIN code as string
console.log(newPinCode);
Errors
Although we are doing our best, following errors may occur when working with the Applet Resources.
Code | Type | Message |
---|---|---|
41701 | AppletSecurityError | Invalid PIN code (has to be 4 digits string) |
41702 | AppletSecurityError | Not allowed PIN code 0000, use another pin code |
41703 | AppletSecurityError | Get PIN code failed because was not set yet. Try to get PIN code later or set the PIN code using setPinCode method first. |