Pakete, Repositories und App-Kategorien suchen

Paketdetailsv0.1.0

serverpod_argon2

Argon2-Passwort-Hashing (argon2id, argon2i, argon2d) mit Unterstützung durch die Zig-Standardbibliothek. Enthält vorab gebaute Native-Bibliotheken für Dart und Flutter sowie ein WebAssembly-Modul für das Web, sodass keine lokale Toolchain erforderlich ist...

AndroidiOSLinuxmacOSWebWindows
30-Tage-Downloads
149.000
Likes
3
Pub-Punkte
140

Paket installieren

flutter pub add serverpod_argon2

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Ein Flutter/Dart-Paket zur sicheren Passwort-Hashing mit dem Argon2-Algorithmus (argon2id, argon2i, argon2d). Aufbauend auf der Zig-Standardbibliothek bietet es vorkompilierte native Binärdateien für Android, iOS, Linux, macOS, Windows und ein WebAssembly-Modul für Web-Umgebungen. Dies gewährleistet hohe Leistung und Sicherheit ohne lokale Toolchains. Ideal für Anwendungen, die eine robuste Passwortspeicherung und Authentifizierung benötigen.

Anwendungsfälle

  • Sichere Passwortspeicherung
  • Benutzer-Authentifizierungssysteme
  • Einhaltung von Sicherheitsstandards
  • Passwort-Hashing in mobilen und Web-Anwendungen
  • Schutz sensibler Benutzeranmeldeinformationen

Hauptmerkmale

  • Unterstützt alle Argon2-Varianten
  • Vorab erstellte native Bibliotheken für alle Plattformen
  • WebAssembly-Unterstützung für Web
  • Kein lokaler Toolchain erforderlich
  • Hochleistung und Sicherheit

Geeignet für

  • Anwendungen, die Benutzerpasswörter verarbeiten
  • Sicherheitsorientierte Backend-Dienste
  • Plattformübergreifende Flutter-Apps
  • Systeme, die starke Passwort-Hashing erfordern
  • Entwickler, die auf einfache Einrichtung Wert legen

Hinweise

  • Erfordert Dart 3.0 oder höher
  • Beschränkt auf Argon2-Hashing
  • Abhängig von externem, auf Zig basierendem Native-Code
  • Kann die App-Größe leicht erhöhen aufgrund von nativen Binärdateien
  • Nicht geeignet für Nicht-Passwort-Hashing-Anwendungsfälle

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

serverpod_argon2

Argon2 password hashing for Dart and Flutter, backed by the Argon2 implementation in the Zig standard library.

  • Native platforms load a prebuilt shared library through build hooks (native assets).
  • The web loads the same code compiled to WebAssembly, embedded in the package. This works with both dart2js and dart2wasm.
  • No toolchain is needed. Prebuilt libraries ship in the package for every supported target.

Usage

import 'package:serverpod_argon2/serverpod_argon2.dart';

final argon2 = await Argon2.load();

// $argon2id$v=19$m=19456,t=2,p=1$<salt>$<hash>
final encoded = argon2.hash('correct horse battery staple');

final ok = argon2.verify('correct horse battery staple', encoded);

hash defaults to Argon2Parameters.owasp (argon2id, 19 MiB, 2 iterations) and a random 16 byte salt. verify accepts PHC strings from any Argon2 implementation, as long as they use version 19. deriveKey returns raw bytes and takes the optional RFC 9106 secret and associatedData inputs.

Hashing runs on the calling thread and is slow by design. On native platforms, move it off the main isolate:

final encoded = await Isolate.run(() => argon2.hash(password));
Parallelism

The library is built single-threaded, so the p lanes are computed one after another. Hashes with p > 1 are still correct and compatible with other implementations, but take p times longer than a multithreaded implementation would. For more throughput, hash on several isolates.

Supported targets

OS Architectures
macOS arm64 (11.0+), x64 (10.15+)
iOS arm64 (13.0+), arm64 and x64 simulators
Android arm64, arm, x64
Linux x64, arm64, arm, riscv64
Windows x64, arm64
Web Any browser with WebAssembly

The libraries are pure Zig and link no libc. On Linux they run on any glibc or musl distribution.

Performance

benchmark/argon2_benchmark.dart compares against the pure Dart implementations in pointycastle and cryptography, after checking all three produce identical output. The file header shows how to run it in each mode. Results on an Intel Mac, argon2id with OWASP parameters, in ms per hash:

Implementation Dart JIT Dart AOT JavaScript (Node)
serverpod_argon2 43 46 40
cryptography 200 183 647
pointycastle 307 274 5996

Developing

A git checkout has no prebuilt libraries, so the build hook compiles from source. That needs the zig version in build.zig.zon (minimum_zig_version), either installed directly or through anyzig.

  • zig build test runs the RFC 9106 vectors against the Zig code.
  • dart test -p vm,chrome runs the Dart tests natively and in the browser.

Publishing

See PUBLISH.md.

Kategorien

Abhängigkeiten

Abhängigkeiten 2 Einträge

  • code_assets>=1.2.1 <3.0.0
  • hooks^2.0.0

Quell-Repository

Projekte, die dieses Paket verwenden

Noch keine Daten verfügbar.

Ranglisten