- Secret Generator: generate secure random number bytes or hex strings for use as secrets in Nostr.
import 'package:dartstr_utils/dartstr_utils.dart';
final secretBytes = SecretGenerator.secretBytes(32);
print('secretBytes: $secretBytes');
final secretHex = SecretGenerator.secretHex(64);
print('secretHex: $secretHex');
This package is part of the Dartstr monorepo, which contains a set of modular and compatible Dart packages of different Nostr NIPS and utilities. Import just the packages of NIPS you need and keep your project lightweight. See the Dartstr monorepo for all available packages.