derivePrivateKey static method

Future<Felt> derivePrivateKey({
  1. required String seedPhrase,
  2. required int derivationIndex,
})

Implementation

static Future<s.Felt> derivePrivateKey({
  required String seedPhrase,
  required int derivationIndex,
}) async {
  // Prepare the input for the compute function
  Map<String, dynamic> computationInput = {
    'seedPhrase': seedPhrase,
    'derivationIndex': derivationIndex,
  };

  // Derive the private key in an isolate to avoid blocking UI thread
  return compute((Map<String, dynamic> input) {
    String seedPhrase = input['seedPhrase'];
    int derivationIndex = input['derivationIndex'];

    return s.derivePrivateKey(
      mnemonic: seedPhrase,
      index: derivationIndex,
    );
  }, computationInput);
}