pub struct Did(/* private fields */);Expand description
A decentralized-id used to itentify different assets and documents in the borderless-ecosystem.
These ids are version 8 uuids, where
the first four bits of the uuid are set to 0xd, to indicate that it is a decentralized-id and not another uuid based id.
Example:
dfc23cb3-f447-8107-8f93-9bfb8e1d157dAll uuid-based ids used in the borderless-ecosystem have a different prefix, based on what the id is used for. This mechanism ensures that you cannot mistake a contract-id for e.g. a process-id and vice versa. Even if you convert the contract-id back into a uuid and the result into a process-id, the results are different.
The implementation of the IDs is compliant with RFC9562, as we utilize standard version 8 uuids.
Implementations§
Source§impl Did
impl Did
Sourcepub fn into_uuid(self) -> Uuid
pub fn into_uuid(self) -> Uuid
Converts the ID into a uuid::Uuid
pub fn from_bytes(bytes: [u8; 16]) -> Did
Sourcepub fn into_bytes(self) -> [u8; 16]
pub fn into_bytes(self) -> [u8; 16]
Returns the underlying bytes
Sourcepub fn merge(&self, other: &Did) -> [u8; 16]
pub fn merge(&self, other: &Did) -> [u8; 16]
Merges two IDs commutatively
Can be used to construct database keys.
Sourcepub fn merge_compact(&self, other: &Did) -> u64
pub fn merge_compact(&self, other: &Did) -> u64
Merges and Compacts two IDs into a u64
Can be used to construct database keys.