# 🔗 HBP通信协议 v1.0 · Robot专属语言

# 🎯 协议概述

**HBP** = HoloLake Bind Protocol

**用途**：Robot插件的原生识别语言

**功能**：绑定开发者身份 + 配置同步路径

---

# 📜 绑定码格式

## 原始数据结构

```json
{
  "protocol": "HBP",
  "version": "1.0",
  "developer": {
    "id": "DEV-007",
    "name": "四月",
    "timestamp": "2026-02-28T20:00:00Z"
  },
  "master": {
    "notion_db_id": "xxx",
    "sync_token": "encrypted_xxx"
  },
  "signature": "zhiqiu_xxx"
}
```

## 编码格式

```
HBP1.0:[Base64编码后的JSON]
```

## 示例

```
HBP1.0:eyJwcm90b2NvbCI6IkhCUCIsInZlcnNpb24iOiIxLjAiLC4uLn0=
```

---

# 🔒 安全验证

1. **前缀检查**：必须以 `HBP1.0:` 开头
2. **Base64解码**：解码后JSON
3. **签名验证**：检查 `signature` 字段
4. **时间戳验证**：防止过期绑定码

---

# 🔄 同步协议

## Robot → Notion（上报）

```jsx
{
  "type": "heartbeat",
  "dev_id": "DEV-007",
  "timestamp": "2026-02-28T20:00:00Z",
  "status": "online"
}
```

## Notion → Robot（下发）

```jsx
{
  "type": "config_update",
  "dev_id": "DEV-007",
  "data": {
    "current_task": "M05用户中心",
    "progress": 40,
    "next_step": "环节2"
  }
}
```

---

# ✅ 实现清单

- [ ]  绑定码生成器
- [ ]  绑定码解析器
- [ ]  签名验证机制
- [ ]  Notion API集成
- [ ]  心跳保持机制