Skip to main content

rind 0.1.0 copy "rind: ^0.1.0" to clipboard
rind: ^0.1.0 copied to clipboard

Fast, misuse-resistant cryptography for Dart and Flutter, through FFI to rind, a pure-Rust library: AEADs, hashes, HMAC, HKDF, PBKDF2, X25519, Ed25519, ECDSA, ECDH, RSA, and ML-KEM.

example/example.dart

// SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0

import 'dart:convert';
import 'dart:typed_data';

import 'package:rind/rind.dart';

void main() {
  final key = Uint8List(32);
  fillRandom(key);

  final aead = AeadKey(AeadAlgorithm.chacha20Poly1305, key);
  // Never reuse a nonce with one key; RandomizedNonceKey picks its own.
  final nonce = Nonce.assumeUniqueForKey(Uint8List(12));
  final sealed = aead.seal(nonce, utf8.encode('hello'));
  print(utf8.decode(aead.open(nonce, sealed)));

  final pair = EcdsaKeyPair.generate(EcdsaSigningAlgorithm.p256Sha256Asn1);
  final signature = pair.sign(utf8.encode('hello'));
  final verifier = PublicKey(
    VerificationAlgorithm.ecdsaP256Sha256Asn1,
    pair.publicKey.bytes,
  );
  verifier.verify(utf8.encode('hello'), signature);
}
0
likes
140
points
--
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Fast, misuse-resistant cryptography for Dart and Flutter, through FFI to rind, a pure-Rust library: AEADs, hashes, HMAC, HKDF, PBKDF2, X25519, Ed25519, ECDSA, ECDH, RSA, and ML-KEM.

Repository (GitHub)
View/report issues
Contributing

Topics

#cryptography #crypto #ffi #encryption

License

unknown (license)

Dependencies

code_assets, crypto, ffi, hooks

More

Packages that depend on rind