pinenacl
0.6.0, released 2 years ago by poolunder.com
Dart implementation of TweetNaCl cryptographic library with high-level APIs
What it does
Provides authenticated encryption, digital signatures, hashing, and key derivation using Curve25519 and Ed25519. It wraps TweetNaCl functions into Dart-friendly classes and methods.
AI-written summary of version 0.6.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need fast, auditable cryptography in a pure Dart app
- Implementing secure messaging or key exchange
- Generating and verifying Ed25519 signatures
- Deriving keys from passwords with PBKDF2
Skip it when
- You need platform-specific native crypto APIs for performance
- You require integration with existing native libraries like OpenSSL
Strengths
- Pure Dart, no native dependencies
- Supports multiple cryptographic primitives (Box, SealedBox, SecretBox, Ed25519, HMAC, SHA-256/512, BLAKE2b)
- Well-documented API mirroring PyNaCl
- Cross-platform (android, ios, web, windows, macos, linux)
Weaknesses
- No native acceleration, may be slower than platform libs
- Large feature set may be overkill for simple use cases
- No built-in key storage or secure enclave integration
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Add dependency in pubspec and import package:pinenacl/api.dart
import 'package:pinenacl/api.dart';
final keyPair = await KeyPair.generate();
final box = Box(keyPair.publicKey, keyPair.privateKey);
final ciphertext = box.encrypt('hello');
final plaintext = box.decrypt(ciphertext);Alternatives
Packages that do the same job and could replace pinenacl.
- crypto
Provides SHA, MD5, and HMAC hashing functions for Dart.
96Compare - crypto_keys
Library for signing, verifying, encrypting and decrypting using pointycastle.
71Compare - cryptography_plus
Cryptographic algorithms for encryption, signatures, key agreement, and hashing across platforms.
68Compare - cryptography
Cross‑platform cryptographic algorithms for Dart and Flutter.
67Compare
Works with
Packages commonly used together with pinenacl: ones it builds on, ones built on it, and its own family.
- dartssh2Built on pinenaclSSH and SFTP client written in pure Dart
- dart_pusher_channelsBuilt on pinenaclPure‑Dart client for the Pusher Channels real‑time protocol.
- ed25519_hd_keyBuilt on pinenaclBIP-0032 like hierarchical deterministic key derivation for the ed25519 curve
- ssiBuilt on pinenaclAffinidi Self-Sovereign Identity library for Dart and Flutter.
- reown_appkitBuilt on pinenaclFlutter toolkit for WalletConnect onchain UX
- dart_pgBuilt on pinenaclAn OpenPGP implementation in Dart for encryption, decryption, and key management.
- stellar_flutter_sdkBuilt on pinenaclStellar SDK for Flutter to query Horizon and Soroban RPC, and manage transactions.
- pusher_client_socketBuilt on pinenaclConnect to a Pusher server using WebSockets across all platforms.