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 random() -> Result<Self, SoftchatError>
pub fn random() -> Result<Self, SoftchatError>
Start one stream with a Rust-generated 256-bit attachment key.
The returned Self::encryption_descriptor is the released
base64-encoded enc value retained in authenticated attachment
metadata. Raw key bytes never cross the language boundary.
§Errors
Returns a stable attachment-encryption failure.
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 encryption_descriptor(&self) -> String
pub fn encryption_descriptor(&self) -> String
Return the released-client base64 enc metadata value.
This descriptor grants decryption authority and must never be logged.
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
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
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
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
§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
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more