isValidPath static method

bool isValidPath(
  1. String path
)

Checks if a given BIP32 derivation path is valid.

path is the BIP32 derivation path to validate.

Returns true if the path is valid, otherwise false.

Implementation

static bool isValidPath(String path) {
  /// Define a regular expression to match valid BIP32 derivation paths.
  final regex = RegExp(r"^(m\/)?(\d+'?\/)*\d+'?$");

  /// Check if the [path] matches the regular expression.
  return regex.hasMatch(path);
}