---
name: "onAddUnlockMethod"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
title: "onAddUnlockMethod - Register unlock method step listener."
summary: "Register unlock method step listener. Used to monitor input progress when adding unlock methods."
---

## onAddUnlockMethod

> [VERSION] @ray-js/lock-sdk >= 1.0.0

### Description

Register a step listener for unlocking methods

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `listener` | `AddUnlockMethodListener` | Yes | Event listener |

### Return Value

None


### Referenced Types

##### `type` AddUnlockMethodListener

```typescript
export type AddUnlockMethodListener = (event: AddUnlockMethodEvent) => void;
```

##### `interface` StepEvent

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `"finger" \| "face" \| "password" \| "card" \| "fingerVein" \| "hand" \| "eye"` | Yes |  |
| `lockUserId` | `number` | Yes |  |
| `stage` | `"step"` | Yes |  |
| `step` | `number` | Yes |  |
| `total` | `number` | Yes |  |

##### `interface` SuccessEvent

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `"finger" \| "face" \| "password" \| "card" \| "fingerVein" \| "hand" \| "eye"` | Yes |  |
| `id` | `number` | Yes |  |
| `name` | `string` | Yes |  |
| `stage` | `"success"` | Yes |  |

##### `interface` ErrorEvent

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `"finger" \| "face" \| "password" \| "card" \| "fingerVein" \| "hand" \| "eye"` | Yes |  |
| `lockUserId` | `number` | Yes |  |
| `stage` | `"fail"` | Yes |  |
| `error` | `ErrorData` | Yes |  |

##### `interface` ErrorData

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `errorCode` | `number` | Yes | Error code |
| `errorMsg` | `string` | Yes | Error message (mostly in English) |


### Valid Values

##### `StepEvent.type`

| Value | Description | Since |
| --- | --- | --- |
| `finger` | - | - |
| `face` | - | - |
| `password` | - | - |
| `card` | - | - |
| `fingerVein` | - | - |
| `hand` | - | - |
| `eye` | - | - |

##### `SuccessEvent.type`

| Value | Description | Since |
| --- | --- | --- |
| `finger` | - | - |
| `face` | - | - |
| `password` | - | - |
| `card` | - | - |
| `fingerVein` | - | - |
| `hand` | - | - |
| `eye` | - | - |

##### `ErrorEvent.type`

| Value | Description | Since |
| --- | --- | --- |
| `finger` | - | - |
| `face` | - | - |
| `password` | - | - |
| `card` | - | - |
| `fingerVein` | - | - |
| `hand` | - | - |
| `eye` | - | - |


### Examples

```ts
import { onAddUnlockMethod } from '@ray-js/lock-sdk';
onAddUnlockMethod((event) => {
  console.log(event);
});
```
