pub struct ProtocolObjectContext { /* private fields */ }Expand description
Authenticated storage context for one immutable semantic object.
Store protection cannot be paired with a Circle-encrypted domain:
ⓘ
use crate::storage::{ProtocolObjectContext, ProtocolObjectDomain};
use crate::ObjectHash;
let root = ObjectHash::digest(b"store");
let _ = ProtocolObjectContext::signed_plaintext(root, ProtocolObjectDomain::CircleMetadata);Circle protection cannot be paired with a Store domain:
ⓘ
use crate::storage::{ProtocolObjectContext, ProtocolObjectDomain};
use crate::{EncryptionService, ObjectHash};
let root = ObjectHash::digest(b"store");
let encryption = EncryptionService::from_key([7; 32]);
let _ = ProtocolObjectContext::circle(
root,
ProtocolObjectDomain::StoreCommit,
encryption,
);Implementations§
Source§impl ProtocolObjectContext
impl ProtocolObjectContext
pub fn store_encrypted( store_root_hash: ObjectHash, domain: StoreEncryptedProtocolObjectDomain, ) -> Self
pub fn signed_plaintext( store_root_hash: ObjectHash, domain: SignedStoreProtocolObjectDomain, ) -> Self
pub fn circle( store_root_hash: ObjectHash, domain: CircleProtocolObjectDomain, encryption: EncryptionService, ) -> Self
pub fn recipient_sealed( store_root_hash: ObjectHash, domain: RecipientSealedProtocolObjectDomain, ) -> Self
pub fn store_root_hash(&self) -> ObjectHash
pub fn domain(&self) -> ProtectedObjectDomain
pub fn protection(&self) -> &ProtocolObjectProtection
pub fn validate_path(&self, semantic_prefix: &str) -> Result<(), StorageError>
pub fn validate_extension(&self, extension: &str) -> Result<(), StorageError>
pub fn validate_reference( &self, object: &ExactObjectRef, semantic_prefix: &str, ) -> Result<(), StorageError>
Sourcepub fn semantic_prefix_of<'slot>(
&self,
slot: &'slot ObjectSlot,
) -> Option<&'slot str>
pub fn semantic_prefix_of<'slot>( &self, slot: &'slot ObjectSlot, ) -> Option<&'slot str>
The semantic path slot names, when the slot names an object of this
context’s domain.
A slot’s logical key is its semantic path plus the domain’s extension,
so the path is recoverable from the key alone. Returns None for a slot
this domain would not have written — which is how a caller that learned
of a slot by listing a provider prefix, rather than by following a
signed reference, discards what does not belong to it.
pub fn validate_slot( &self, slot: &ObjectSlot, semantic_prefix: &str, ) -> Result<(), StorageError>
Auto Trait Implementations§
impl Freeze for ProtocolObjectContext
impl RefUnwindSafe for ProtocolObjectContext
impl Send for ProtocolObjectContext
impl Sync for ProtocolObjectContext
impl Unpin for ProtocolObjectContext
impl UnsafeUnpin for ProtocolObjectContext
impl UnwindSafe for ProtocolObjectContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more