AesEncryptFileWeb class
Flutter Web implementation of AesEncryptFilePlatform.
Encryption and decryption use the browser's native WebCrypto engine (AES-256-CTR), producing output that is wire-compatible with the Android (OpenSSL) and iOS (CommonCrypto) native implementations.
File I/O on web
Because browsers do not expose a writable local filesystem, this
implementation maintains an in-memory virtual filesystem
(_virtualFileSystem). The caller should:
- Pre-load source bytes under the desired
inputPathkey via storeVirtualFile before calling encryptFile / decryptFile, or - Pass a URL (http:/https:/blob:) as
inputPath; the implementation will fetch the bytes automatically.
Encrypted / decrypted output is stored in _virtualFileSystem under
outputPath. Retrieve the bytes with getVirtualFile.
- Inheritance
-
- Object
- PlatformInterface
- AesEncryptFilePlatform
- AesEncryptFileWeb
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
decryptBytes(
{required Uint8List cipherBytes, required String key, String? iv}) → Future< Uint8List> -
Decrypts
cipherBytes(format:[16-byte IV][ciphertext]) and returns the original plaintext.override -
decryptFile(
{required String inputPath, required String outputPath, required String key, String? iv}) → Future< bool> -
Decrypts the file at
inputPathand writes the result tooutputPath.override -
encryptBytes(
{required Uint8List plainBytes, required String key, String? iv}) → Future< Uint8List> -
Encrypts
plainBytesand returns[16-byte IV][ciphertext].override -
encryptFile(
{required String inputPath, required String outputPath, required String key, String? iv}) → Future< bool> -
Encrypts the file at
inputPathand writes the result tooutputPath.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getVirtualFile(
String path) → Uint8List? -
Returns the bytes previously written to
path, ornullif absent. -
registerWith(
Registrar registrar) → void -
storeVirtualFile(
String path, Uint8List bytes) → void -
Stores
bytesunderpathso they can be used as input to encryptFile or decryptFile.