generate method

List<int> generate({
  1. String password = "",
  2. String salt = _TonSeedGeneratorConst.defaultTonSalt,
  3. bool validateTonMnemonic = false,
})

Generates a seed from the mnemonic, with optional passphrase and salt. If validateTonMnemonic is true, it validates the mnemonic before generating the seed.

Implementation

List<int> generate({
  String password = "",
  String salt = _TonSeedGeneratorConst.defaultTonSalt,
  bool validateTonMnemonic = false,
}) {
  if (validateTonMnemonic) {
    TomMnemonicValidator().validate(mnemonic, password: password);
  }

  /// Generates entropy from the mnemonic and passphrase.
  final hash = TonEntropyGeneratorUtils.generateEnteropy(
    mnemonic,
    password: password,
  );

  /// Derives a key using PBKDF2 with the generated hash, salt, and a specified number of iterations.
  return QuickCrypto.pbkdf2DeriveKey(
    password: hash,
    salt: StringUtils.encode(salt),
    iterations: _TonSeedGeneratorConst.seedPbkdf2Rounds,
  );
}