Skip to content
pubscout

webcrypto

0.6.2, released 9 days ago by google.dev

Cross-platform implementation of Web Cryptography APIs for Dart.

WASM-ready
$ flutter pub add webcrypto
Source repository

What it does

Provides a cross-platform implementation of the Web Cryptography API across Android, iOS, Web, Windows, Linux, and macOS. Outside the browser it embeds BoringSSL using dart:ffi, and inside the browser it wraps window.crypto.

AI-written summary of version 0.6.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need cryptographic operations like hashing, signing, encryption, or key derivation that work identically across mobile, web, and desktop.
  • You want to use standard Web Cryptography APIs in Dart and Flutter.

Skip it when

  • You need features missing from the Web Cryptography API or package limitations like deriveKey, wrapKey, unwrapKey, or AES-KW.
  • Your system lacks cmake or a C compiler required to build BoringSSL via hooks.

Strengths

  • Consistent API across mobile, web, and desktop platforms.
  • Backed by BoringSSL natively and window.crypto on the web.
  • Extensive feature set including AES, RSA, ECDSA, HMAC, and hashing algorithms.

Weaknesses

  • Requires cmake and a C compiler (like gcc or clang) for native builds.
  • Native implementation executes on the main thread.
  • Some browser and platform specific compatibility limitations and known issues.

Setup

Kind
FFI (native library)
Effort
Medium
Code generation
No
Direct dependencies
5

Your system must have cmake and a C compiler (like gcc or clang) installed to build BoringSSL using hooks.

import 'dart:convert' show utf8;
import 'package:webcrypto/webcrypto.dart';

Future<void> main() async {
  final digest = await Hash.sha256.digestBytes(utf8.encode('Hello World'));
}

Alternatives

Packages that do the same job and could replace webcrypto.

Works with

Packages commonly used together with webcrypto: ones it builds on, ones built on it, and its own family.