40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
// Charter 标准库 - ACC-1643 文档管理协议
|
||
// 版本: 1.0 | 链上文档版本控制与完整性验证
|
||
|
||
/// ACC-1643 文档管理接口
|
||
/// 提供链上文档存储、版本控制、完整性验证功能
|
||
protocol Acc1643 {
|
||
/// 存储/更新文档
|
||
fn set_document(
|
||
issuer: Address, doc_type: String, uri: String,
|
||
content_hash: Hash, supersedes: Hash, receipt: Hash
|
||
) -> Hash;
|
||
|
||
/// 获取文档
|
||
fn get_document(doc_id: Hash) -> AssetDocument;
|
||
|
||
/// 获取最新版本文档
|
||
fn get_latest_document(doc_type: String) -> AssetDocument;
|
||
|
||
/// 移除文档(标记为非活跃)
|
||
fn remove_document(issuer: Address, doc_id: Hash, receipt: Hash) -> Result;
|
||
|
||
/// 验证文档完整性
|
||
fn verify_document(doc_id: Hash, uri: String, content_hash: Hash) -> bool;
|
||
|
||
/// 获取文档根哈希(Merkle 根)
|
||
fn documents_root() -> Hash;
|
||
}
|
||
|
||
/// 文档结构
|
||
struct AssetDocument {
|
||
doc_id: Hash,
|
||
doc_type: String,
|
||
uri: String,
|
||
content_hash: Hash,
|
||
version: u32,
|
||
is_active: bool,
|
||
supersedes: Hash,
|
||
created_at: u64,
|
||
}
|