SecretUri.fromStr constructor

SecretUri.fromStr(
  1. String str
)

Implementation

factory SecretUri.fromStr(String str) {
  final matches = _secretPhraseRegex.allMatches(str);
  if (matches.length != 1) {
    throw SubstrateBip39Exception.invalidFormat();
  }
  final match = matches.first;

  final junctions =
      _junctionRegex.allMatches(match.namedGroup('path')!).map((junction) {
    return DeriveJunction.fromStr(junction.group(1)!);
  }).toList();

  final phrase = match.namedGroup('phrase') ?? devPhrase;
  final password = match.namedGroup('password');

  return SecretUri(phrase, password, junctions);
}