pub struct AttachmentEncryptionStream { /* private fields */ }Expand description
Incremental encryption compatible with released clients’ combined
nonce12 || ciphertext || tag16 attachment format.
The host writes Self::nonce first, each Self::update result to a
private staged file, then AttachmentStreamFinal::authentication_tag.
It publishes the staged file only after finish succeeds.
Implementations§
Source§impl AttachmentEncryptionStream
impl AttachmentEncryptionStream
Sourcepub fn new(key_bytes: Vec<u8>) -> Result<Self, SoftchatError>
pub fn new(key_bytes: Vec<u8>) -> Result<Self, SoftchatError>
Start one random-nonce attachment encryption stream.
§Errors
Returns a stable failure unless key_bytes contains exactly 32 bytes.
Sourcepub fn nonce(&self) -> Vec<u8> ⓘ
pub fn nonce(&self) -> Vec<u8> ⓘ
Return the 12-byte prefix that must be written before ciphertext.
Sourcepub fn update(&self, plaintext: Vec<u8>) -> Result<Vec<u8>, SoftchatError>
pub fn update(&self, plaintext: Vec<u8>) -> Result<Vec<u8>, SoftchatError>
Encrypt one bounded plaintext chunk.
§Errors
Returns a stable failure after finish/cancel or when cumulative or per-call bounds are exceeded.
Sourcepub fn finish(&self) -> Result<AttachmentStreamFinal, SoftchatError>
pub fn finish(&self) -> Result<AttachmentStreamFinal, SoftchatError>
Finish authentication and consume the stream.
§Errors
Returns a stable failure after finish or cancellation.
Trait Implementations§
Source§impl Debug for AttachmentEncryptionStream
impl Debug for AttachmentEncryptionStream
Source§impl<UT> LiftRef<UT> for AttachmentEncryptionStream
impl<UT> LiftRef<UT> for AttachmentEncryptionStream
Source§impl<UT> LowerError<UT> for AttachmentEncryptionStream
impl<UT> LowerError<UT> for AttachmentEncryptionStream
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Lower this value for scaffolding function return Read more
Source§impl<UT> LowerReturn<UT> for AttachmentEncryptionStream
impl<UT> LowerReturn<UT> for AttachmentEncryptionStream
Source§type ReturnType = <Arc<AttachmentEncryptionStream> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<AttachmentEncryptionStream> as LowerReturn<UniFfiTag>>::ReturnType
The type that should be returned by scaffolding functions for this type. Read more
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
Lower the return value from an scaffolding call Read more
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Lower the return value for failed argument lifts Read more
Source§impl<UT> TypeId<UT> for AttachmentEncryptionStream
impl<UT> TypeId<UT> for AttachmentEncryptionStream
const TYPE_ID_META: MetadataBuffer
Auto Trait Implementations§
impl !Freeze for AttachmentEncryptionStream
impl RefUnwindSafe for AttachmentEncryptionStream
impl Send for AttachmentEncryptionStream
impl Sync for AttachmentEncryptionStream
impl Unpin for AttachmentEncryptionStream
impl UnsafeUnpin for AttachmentEncryptionStream
impl UnwindSafe for AttachmentEncryptionStream
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
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read more