分布式树洞的交互协议(草案) #14

Open
opened 3 years ago by hole_thu · 0 comments
hole_thu commented 3 years ago
Owner

由于原计划的activitypub协议较为复杂不适合树洞场景,现自行设计协议如下:

  • 当有新洞及新评论时,向所有远端树洞的 /inbox 发送POST请求通知

  • 该请求的body如下:

{
    "author": <用户唯一标识>,  # 建议使用哈希。是否与洞号有关由实现决定,会影响远端的拉黑效果。
    "content": <正文>,
    "cw": <折叠警告>,
    "tags": [<tag1>, <tag2>, ...],
    "type": "post"|"comment",
    "time": <发布时间>,
    "uuid": <唯一标识符>,  # 可使用哈希或者 host:id
    "reply_to": <被回复对象uuid或空>
}

暂不考虑支持跨站投票,可预留poll字段

  • 该请求header中应包含Signature头如下:
    Signature: key="https://<host>/.well-known/rsa.pub",algorithm="rsa-sha256",signature="<签名结果>"
    其中algorithm目前可只支持rsa-sha256

  • user-agent应包含 HoleBot; +https://<host>/

  • 是预先在配置文件写好可连接的host与公钥,还是支持一切签名有效的请求,由实现自行决定。

由于原计划的activitypub协议较为复杂不适合树洞场景,现自行设计协议如下: + 当有新洞及新评论时,向所有远端树洞的 `/inbox` 发送POST请求通知 + 该请求的body如下: ```json { "author": <用户唯一标识>, # 建议使用哈希。是否与洞号有关由实现决定,会影响远端的拉黑效果。 "content": <正文>, "cw": <折叠警告>, "tags": [<tag1>, <tag2>, ...], "type": "post"|"comment", "time": <发布时间>, "uuid": <唯一标识符>, # 可使用哈希或者 host:id "reply_to": <被回复对象uuid或空> } ``` 暂不考虑支持跨站投票,可预留poll字段 + 该请求header中应包含Signature头如下: `Signature: key="https://<host>/.well-known/rsa.pub",algorithm="rsa-sha256",signature="<签名结果>"` 其中algorithm目前可只支持rsa-sha256 + user-agent应包含 `HoleBot; +https://<host>/` + 是预先在配置文件写好可连接的host与公钥,还是支持一切签名有效的请求,由实现自行决定。
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.