Skip to main content
Version: 8.2.2

security

The sos.management.security API groups together methods for the management of a security PIN code of the device.

Methods

generateRandomPinCode()

The generateRandomPinCode() generates a random 4-digit PIN code and sets it as the current PIN code.

generateRandomPinCode(): Promise<void>;

Return value

A promise that resolves when the random PIN code is successfully set.

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);

getPinCode()

The getPinCode() method returns the currently set PIN code.

getPinCode(): Promise<string>;

Return value

A promise that resolves to the currently set PIN code.

Possible errors

Get PIN code failed because the PIN code has not been set yet.

Example

const pinCode = await sos.management.security.getPinCode();
console.log(`Current PIN code is: ${pinCode}`);

setPinCode()

The setPinCode() method sets the pin code.

warning

The maximum length of the PIN code is four characters.

setPinCode(pinCode: string): Promise<void>;

Params

NameTypeRequiredDescription
pinCodestring
Yes
The PIN code to be set.

Return value

A promise that resolves when the PIN code is successfully set.

Possible errors

  • Invalid PIN code format.
  • PIN code 0000 is not allowed, use another PIN code.

Example

await sos.management.security.setPinCode("9999");