<aside> ⚠️
本文档概述了如何基于 CKB 实现一种 DID Method (See DID - AT Protocol)。
本文档的目的是用户内部讨论以达成共识。为了快速表述清楚,假设读者已经对 did:plc Specification v0.1 和 CKB 非常了解。
请勿对外公开本文档。
</aside>
<aside> <img src="/icons/conversation_green.svg" alt="/icons/conversation_green.svg" width="40px" />
Context Box 提供了一些决策的原因和相关的上下文
</aside>
<aside> <img src="/icons/gavel_orange.svg" alt="/icons/gavel_orange.svg" width="40px" />
Dispute Box 为存在争议的点,正文中为作者推荐的方案,Box 中提供了备选方法和作出决策的原因
</aside>
<aside> <img src="/icons/subtask_blue.svg" alt="/icons/subtask_blue.svg" width="40px" />
本文图示来自于 https://link.excalidraw.com/l/10Q8LKKT7u8/1grLgQBw4C9
https://link.excalidraw.com/p/readonly/l4tNtk987bBSDVguibvg
</aside>
用户在链下通过 did:plc 相同的方法创建 did:web5 offchain id,之后会简称为 offid。用户可以在任何时间点通过 CKB tx 创建一个关联 offid 的 did:web5 onchain id (后简称 onid)。Onid 和 offid 不相同,但是通过索引链上的 onid did cells 可以建立 onid ↔ offid 的双向映射表。
<aside> <img src="/icons/conversation_green.svg" alt="/icons/conversation_green.svg" width="40px" />
<aside> <img src="/icons/gavel_orange.svg" alt="/icons/gavel_orange.svg" width="40px" />
和 did:plc 相同。由密码学保证 offid 和初始状态一致且由初始状态中的 rotation keys 授权,而后续的更新操作组成一条链表,每一个操作由上一个状态中的 rotation keys 授权并且可以选择修改 rotation keys。只要掌握某个状态中的 rotation keys,就可以创建一个新的更新分支。确定哪个分支的状态才是 offid 对应的最新状态,需要引入中心化服务器。所以 offid 在没有执行上链之前,对应的 did doc 内容是由中心化服务的权威和声誉来保证的。
https://link.excalidraw.com/readonly/WxQl412uwN3kHECB6sOU
每个 onid 都有唯一对应的 Live Onid Cell。Onid Cell 的 type script args 是 32 个字节的 Byte Sequence。在 args 前面补 3 个字节 0x1282c0
后得到的 35 个字节的 Byte Sequence,然后作 base32 操作得到 onid。
<aside> <img src="/icons/gavel_orange.svg" alt="/icons/gavel_orange.svg" width="40px" />
Onid Cells 是指 type script 使用 did-web5-ts 的 Cells。链上所有操作的验证都由 did-web5-ts 负责,而更新的授权代理给 lock script 来取代 offid 中 rotation keys 的作用。