Skip to main content

passnote_crypto 1.1.0 copy "passnote_crypto: ^1.1.0" to clipboard
passnote_crypto: ^1.1.0 copied to clipboard

Crypto for Passnote: XChaCha20-Poly1305, Argon2id key derivation from a BIP39 passphrase, X25519/Ed25519 device identity, and SPAKE2 pairing.

example/passnote_crypto_example.dart

// Derive a key from a passphrase, encrypt a record with it, and compute the
// public discovery tag. Inside Passnote these calls run behind the builder;
// use them directly only for custom wiring.
import 'dart:convert';

import 'package:passnote_crypto/passnote_crypto.dart';

Future<void> main() async {
  final passphrase = generateMnemonic(words: 12).join(' ');
  final key = await deriveKey(passphrase, 'myapp:v1');

  final cipher = XChaChaPoly1305Cipher(key);
  final frame = await cipher.encrypt(utf8.encode('a secret record'));
  print(utf8.decode(await cipher.decrypt(frame))); // a secret record

  // Safe to broadcast: a one-way hash of the key.
  print(roomTag(key));
}
0
likes
0
points
248
downloads

Publisher

verified publishernodsoftware.net

Weekly Downloads

Crypto for Passnote: XChaCha20-Poly1305, Argon2id key derivation from a BIP39 passphrase, X25519/Ed25519 device identity, and SPAKE2 pairing.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

bip39, crypto, cryptography, meta, passnote, pointycastle

More

Packages that depend on passnote_crypto