Struct lib_gistit::file::EncryptedFile[][src]

pub struct EncryptedFile { /* fields omitted */ }
Expand description

Represents a encrypted gistit file data. This data structure is expected to hold encrypted but not encoded bytes in encrypted_bytes, the nounce which is a 12 bytes randomly generated byte array, and a pointer to the previous unencrypted File handler.

Implementations

Creates a new EncryptedFile handler from encrypted and encoded byte array. That means it should contain the expected encryption header and be base64 encoded.

Will create a new temporary file in your system temp directory and write decoded and still encrypted contents into it.

note that there is no prev unencrypted File handler

Errors

Fails with IoError if can’t create or write to the file handler. Fails with FileError if the encryption header is invalid.

Set a file name, if attempt to decrypt without a file name this will be set to a random string.

Converts Self into File handler by applying the decryption process with the provided secret.

Errors

Fails with EncryptionError if nonce or secret is incorrect

Trait Implementations

Formats the value using the given formatter. Read more

Returns a reference to the original File handler if any.

Returns a reference to the underlying data. Can be encrypted depending on the source

Converts Self into the sendable form of the data

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more