---
name: "createTempDynamic"
mode: "api"
versionRequirements:
  - { name: "@ray-js/lock-sdk", version: "1.0.0" }
title: "createTempDynamic - 创建动态密码。"
summary: "创建动态密码。"
---

## createTempDynamic

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

### 描述

创建动态临时密码。

### 参数

无


### 返回值

类型: `Promise<TempPasswordResult>`

动态临时密码创建结果

##### TempPasswordResult

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `type` | `"once" \| "limit" \| "custom" \| "clear" \| "clearOne" \| "dynamic"` | 密码类型或 dynamic（动态码） |
| `name` | `string` | 展示名称 |
| `password` | `string` | 密码明文或展示串 |
| `unlockBindingId` | `string` | 云端绑定关系 id |
| `effectiveConfig` | `EffectiveConfig` | 生效时间配置 |

### 错误码

| 错误码 | 错误信息 |
| --- | --- |
| `ERROR` | 云端请求异常时透传平台错误 |

### 引用对象

##### `type` Week

周重复位图：下标 0–6 对应周日–周六，0 不生效 1 生效

```typescript
export type Week = [
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
];
```

##### `type` BitStatus

位开关：0 关、1 开 / Single-bit flag

```typescript
export type BitStatus = 0 | 1;
```


### 示例代码

#### 示例

```ts
import { createTempDynamic } from '@ray-js/lock-sdk';
const result = await createTempDynamic();
```
