> For the complete documentation index, see [llms.txt](https://sherry-pang.gitbook.io/nostr-cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sherry-pang.gitbook.io/nostr-cn/fu-lu-1-nip-xiang-jie/40.md).

# NIP40

## 过期时间戳

`draft` `optional` `author:0xtlt`

`expiration` 标记使用户能够指定一个 UNIX 时间戳，在该时间戳时，消息应被视为过期（由中继和客户端），并且应由中继删除。

#### 规格

```
tag: expiration
values:
 - [UNIX timestamp in seconds]: required
```

#### 例子

```json
{
    "pubkey": "<pub-key>",
    "created_at": 1000000000,
    "kind": 1,
    "tags": [
      ["expiration", "1600000000"]
    ],
    "content": "This message will expire at the specified timestamp and be deleted by relays.\n",
    "id": "<event-id>"
}
```

注意：时间戳的格式应与在时间戳时创建的 \_ 的格式相同，并应解释为中继应删除消息的时间。

## 客户行为

客户端应使用该 `supported_nips` 字段来了解中继是否支持此 NIP.客户端不应向不支持此 NIP 的中继发送过期事件。

客户端应忽略已过期的事件。

## 中继行为

中继不能在过期时立即删除过期的消息，而是可以无限期地保留它们。中继不应向客户端发送过期事件，即使这些事件已存储。如果中继已过期，则应删除向其发布的任何事件。过期时间戳不会影响临时事件的存储。

## 建议的使用情形

* 临时公告-此标记可用于发布临时公告。例如，事件组织者可以使用此标记发布有关即将发生的事件的公告。
* 限时优惠-企业可使用此标签提供在一定时间后过期的限时优惠。例如，企业可以使用此标记来提供仅在有限时间内可用的特别优惠。

#### 警告

这些事件可以由第三方下载，因为它们在继电器上始终可公开访问。因此，不要将邮件过期视为对话或其他用途的安全功能。
