pub trait ReferenceProvider {
// Required method
fn reference(&self) -> Reference;
// Provided methods
fn ref_hex(&self) -> String { ... }
fn ref_data_short(&self) -> [u8; 4] { ... }
fn ref_hex_short(&self) -> String { ... }
fn ref_bytewords(&self, prefix: Option<&str>) -> String { ... }
fn ref_bytemoji(&self, prefix: Option<&str>) -> String { ... }
}Expand description
Implementers of this trait provide a globally unique reference to themselves.
The ReferenceProvider trait is used to create a unique, cryptographic
reference to an object. This is particularly useful for distributed systems
where objects need to be uniquely identified across networks or storage
systems.
The reference is derived from a cryptographic digest of the object’s serialized form, ensuring that the reference uniquely identifies the object’s contents.
Required Methods§
Provided Methods§
Sourcefn ref_hex(&self) -> String
fn ref_hex(&self) -> String
Returns the reference data as a hexadecimal string.
This is a convenience method that returns the full 32-byte reference as a 64-character hexadecimal string.
Sourcefn ref_data_short(&self) -> [u8; 4]
fn ref_data_short(&self) -> [u8; 4]
Returns the first four bytes of the reference.
This is a convenience method for when a shorter, more user-friendly representation is needed, such as for display or comparison purposes.
Sourcefn ref_hex_short(&self) -> String
fn ref_hex_short(&self) -> String
Returns the first four bytes of the reference as a hexadecimal string.
This produces an 8-character string that is useful for display purposes, such as in debug output or logs.
Sourcefn ref_bytewords(&self, prefix: Option<&str>) -> String
fn ref_bytewords(&self, prefix: Option<&str>) -> String
Returns the first four bytes of the reference as upper-case ByteWords.
ByteWords is a human-readable encoding format that uses common English words to represent binary data, making it easier to communicate verbally or in text.
§Parameters
prefix- An optional prefix to add before the ByteWords representation
Sourcefn ref_bytemoji(&self, prefix: Option<&str>) -> String
fn ref_bytemoji(&self, prefix: Option<&str>) -> String
Returns the first four bytes of the reference as Bytemoji.
Bytemoji is an emoji-based encoding that represents binary data using emoji characters, which can be more visually distinctive and memorable.
§Parameters
prefix- An optional prefix to add before the Bytemoji representation
Implementations on Foreign Types§
Source§impl ReferenceProvider for PrivateKey
Available on crate feature ssh only.
impl ReferenceProvider for PrivateKey
ssh only.Source§impl ReferenceProvider for PublicKey
Available on crate feature ssh only.
impl ReferenceProvider for PublicKey
ssh only.Implementors§
impl ReferenceProvider for EncapsulationPrivateKey
impl ReferenceProvider for EncapsulationPublicKey
impl ReferenceProvider for MLDSAPrivateKey
impl ReferenceProvider for MLDSAPublicKey
impl ReferenceProvider for MLKEMPrivateKey
impl ReferenceProvider for MLKEMPublicKey
impl ReferenceProvider for SigningPrivateKey
impl ReferenceProvider for SigningPublicKey
impl ReferenceProvider for ECPrivateKey
impl ReferenceProvider for ECPublicKey
impl ReferenceProvider for ECUncompressedPublicKey
impl ReferenceProvider for Ed25519PrivateKey
impl ReferenceProvider for Ed25519PublicKey
impl ReferenceProvider for PrivateKeyBase
impl ReferenceProvider for PrivateKeys
impl ReferenceProvider for PublicKeys
impl ReferenceProvider for Reference
Implement the ReferenceProvider trait for Reference.
Yes, this creates a Reference to a Reference.
impl ReferenceProvider for SchnorrPublicKey
impl ReferenceProvider for SymmetricKey
impl ReferenceProvider for X25519PrivateKey
Implements ReferenceProvider to provide a unique reference for the key.
impl ReferenceProvider for X25519PublicKey
Implements ReferenceProvider to provide a unique reference for the key.
impl ReferenceProvider for XID
Implements ReferenceProvider for XID to generate a Reference from the XID.