Skip to main content

p2panda_core/
traits.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3use std::hash::Hash as StdHash;
4
5use crate::identity::Author;
6
7/// Identifier of a single operation.
8pub trait OperationId: Copy + Clone + PartialEq + Eq + StdHash {}
9
10/// Returns (unique) hash digest, which can be used as identifier of this published data type.
11pub trait Digest<ID>
12where
13    ID: OperationId,
14{
15    fn hash(&self) -> ID;
16}
17
18/// Returns the author of this published data type and a method to verify the authenticity of it.
19pub trait Provenance<A>
20where
21    A: Author,
22{
23    fn author(&self) -> A;
24
25    fn verify(&self) -> bool;
26}