rust_crypto library

Cryptography library for Dart and Flutter. Uses RustCrypto WASM module

  • hashes/digests: sha1, sha2, blake3, md5, crc32
  • hmac
  • argon2
  • aes-gcm-siv

Classes

AesGcmSiv
Argon2
Argon2Config
Blake3
EnvVariable
ExternalType
FsHash
FuncTy
GlobalTy
Hashes
Hmac
i64
Utility static functions for I64 use i64.fromInt or i64.fromBigInt to create use i64.toInt or i64.toBigInt to convert use i64.getInt64, i64.getUint64, i64.setInt64 and i64.setUint64 to read bytes data
MemoryTy
ModuleConfig
ModuleConfigWasmi
ModuleConfigWasmtime
PreopenedDir
A preopened directory that the WASM module will be able to access
RustCryptoWorld
RustCryptoWorldImports
Sha2
TableTy
U8Array16
WasiConfig
The configuration and arguments for the WASI module.
WasiDirectory
A Wasi in-memory directory for the browser executor.
WasiFd
A Wasi file system item One of WasiFile or WasiDirectory.
WasiFile
A Wasi in-memory file for the browser executor.
WasiStackLimits
The configured limits of the Wasm stack.
WasmExternal
A WASM external value that can be imported or exported.
WasmFeatures
https://docs.wasmtime.dev/stability-wasm-proposals-support.html
WasmFunction
A Wasm function.
WasmGlobal
A global value that can be read with get and written with set when the global is mutable.
WasmImport
A WASM import that can be used in WasmInstanceBuilder.addImports to construct a WasmInstance.
WasmInstance
The module instance that was created from a module and can be used to call functions with getFunction or access any of the exports. You can limit the execution of the module with fuel. You may use WasmModule.builder to create a new WasmInstanceBuilder and then WasmInstanceBuilder.build to construct a WasmInstance.
WasmInstanceBuilder
Constructs a new WasmInstance from a WasmModule by adding imports with addImport and constructing other WasmExternal values (createMemory, createGlobal or createTable). You may use WasmModule.builder to create a new WasmInstanceBuilder. To instantiate this builder you may use WasmInstanceBuilder.build or WasmInstanceBuilder.build.
WasmInstanceFuel
Returns the fuel that can be used to limit the amount of computations performed by the instance.
WasmMemory
A linear memory (array of bytes) that can be used to share data with the WASM module.
WasmModule
A compiled WASM module. You may introspect it by using getImports and getExports. You may use builder to create a WasmInstance from it to execute it or use its exports.
WasmModuleExport
WasmModule exports entry.
WasmModuleImport
WasmModule import entry.
WasmRunLibrary
Static namespace for configuring the dynamic library for wasm_run
WasmRuntimeFeatures
WasmSharedMemory
A linear memory (array of bytes) that can be used to share data with the WASM module. This memory can be shared between multiple instances of the same module in different threads.
WasmTable
A Table that can be used to store object references and functions.
WasmValue
A WASM value.
WasmValueRef
A WASM reference value.
WasmWasiFeatures
https://docs.wasmtime.dev/stability-wasi-proposals-support.html
WorkersConfig
Configuration for spawning workers.

Enums

AesKind
Argon2Algorithm
Argon2Version
HashKind
SharedMemoryWaitResult
Result of SharedMemory.atomicWait32 and SharedMemory.atomicWait64
ValueTy
WasmExternalKind
Possible kinds of import or export entries.

Functions

compileWasmModule(Uint8List bytes, {ModuleConfig? config}) Future<WasmModule>
Compiles a Wasm module asynchronously.
compileWasmModuleSync(Uint8List bytes, {ModuleConfig? config}) WasmModule
Compiles a Wasm module synchronously. You should use compileWasmModule, unless the module is small.
rustCryptoInstance({required WasiConfig wasiConfig, Future<WasmModule> loadModule()?}) Future<RustCryptoWorld>
Creates a RustCryptoWorld with the given wasiConfig. It setsUp the dynamic library for wasm_run for native platforms and loads the dart_wit_component WASM module from the file system or from the releases of wasm_run repository.
wasmRuntimeFeatures() Future<WasmRuntimeFeatures>
Information of the Wasm Runtime. Contains the default and supported WasmFeatures used when compiling a WASM module, the name of the runtime, it's version and whether it is the browser's runtime or not.

Typedefs

HmacError = String
Returned when the HMAC key does not have the expected length.
I64 = Object
int for dart:io, JsBigInt for dart:html Utility static functions in: i64. use i64.fromInt or i64.fromBigInt to create use i64.toInt or i64.toBigInt to convert use i64.getInt64, i64.getUint64, i64.setInt64 and i64.setUint64 to read bytes data
PasswordHash = String
This type corresponds to the parsed representation of a PHC string as described in the PHC string format specification ($argon2id$v=19$...).