---
name: "bindUnlockMethod"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
title: "bindUnlockMethod - 绑定未关联开锁方式到用户。"
summary: "绑定未关联开锁方式到用户。"
---

## bindUnlockMethod

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

### 描述

绑定未关联开锁方式到用户

### 参数

| 参数 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| `userId` | `string` | 是 | 用户 id |
| `unlockList` | `Object[]` | 是 | 待关联的开锁方式列表 |

##### bindUnlockMethod.unlockList[] 的属性

| 属性 | 类型 | 必填 | 默认值 | 描述 |
| --- | --- | --- | --- | --- |
| `type` | `UnlockMethodType` | 是 | - | 开锁方式类型 |
| `unlockId` | `number` | 是 | - | 开锁方式的硬件id |


### 返回值

类型: `Promise<boolean>`

无（绑定成功后 resolve）

### 引用对象

##### `type` UnlockMethodType

开锁方式业务类型字面量

```typescript
export type UnlockMethodType =
  | "finger"
  | "face"
  | "password"
  | "card"
  | "fingerVein"
  | "hand"
  | "eye";
```


### 示例代码

#### 示例

```ts
import { bindUnlockMethod } from '@ray-js/lock-sdk';
await bindUnlockMethod({ userId: 'user_001', unlockList: [{ id: 'method_001' }] });
```
