addPassword(params: AddPasswordParams)
Requires:
@ray-js/lock-sdk≥1.0.0
Description
Add a password-type unlock method.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| Yes | Parameters for adding a password (password content, name, and validity settings, etc.) |
Return Value
Type: Promise<CreateUnlockMethodResult>
None (resolves after added successfully)
CreateUnlockMethodResult
| Property | Type | Description |
|---|---|---|
opModeId | number | Unlock method ID |
unlockName | string | Unlock method name |
Error Code
| Error Code | Error Message |
|---|---|
1054 | Password is empty |
1057 | Special password not supported and App notifications are disabled |
1058 | SMS is supported, but both App notifications and SMS are disabled |
1066 | SMS phone number is empty |
1056 | Country code is empty |
1055 | Verification code is empty |
1014 | This unlock method type is not supported |
1001 | Device is offline |
1002 | Operation timed out |
1015 | ~1025 Device-reported add failure (status 0~10) |
1026 | Device-reported add failure (status 0xfe) |
1037 | Cloud: password already exists (USER_PWD_ALREADY_EXIST) |
1038 | Cloud: password name is duplicate (LOCK_PWD_NAME_REPEAT) |
1040 | Cloud: record does not exist (RECORD_NOT_EXIST) |