Skip to content
pubscout

http_security_pinning

2.0.0, released 6 weeks ago by an unverified publisher

SPKI SHA-256 TLS certificate pinning for Flutter with a drop-in HttpClient.

WASM-ready
$ flutter pub add http_security_pinning
Source repository

What it does

Provides a drop-in dart:io HttpClient implementation that enforces SPKI SHA-256 certificate pinning for secure connections. It also includes Ed25519 response signature checks on Flutter Web.

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

Use it when

  • You need TLS certificate pinning to prevent man-in-the-middle attacks on mobile and desktop.
  • You want a drop-in HttpClient replacement that works with package:http and package:dio.

Skip it when

  • You do not control your server keys and cannot ship backup pins before key rotations.
  • You are relying on native WebViews or plugins that use their own network stack without HttpOverrides.

Strengths

  • Drop-in compatibility with dart:io HttpClient, package:http, and package:dio.
  • Supports per-host pin policies, wildcards, and unpinned host handling.
  • Includes cross-platform support including Android, iOS, desktop, and web signature checks.

Weaknesses

  • Server key rotations without a backup pin will break the app until a client update is installed.
  • Flutter Web does not support TLS pinning and relies on a weaker response-signature scheme.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
4

Requires obtaining your server certificate pins using OpenSSL or discovery mode and configuring minimum Android/iOS platform versions.

import 'package:http/io_client.dart';
import 'package:http_security_pinning/http_security_pinning.dart';

Future<void> main() async {
  final client = IOClient(HttpSecurityPinningClient([
    'PRIMARY0PIN000000000000000000000000000000AA=',
    'BACKUP00PIN000000000000000000000000000000AA=',
  ]));
  try {
    final response = await client.get(Uri.parse('https://api.example.com/'));
    print(response.statusCode);
  } finally {
    client.close();
  }
}

Alternatives

Packages that do the same job and could replace http_security_pinning.

  • dio

    A powerful HTTP client for Dart which can be combined with this package via adapters for advanced request handling.

Works with

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