isValidHardenedPath function

bool isValidHardenedPath(
  1. String path
)

Parse and validate a path that is compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.

path string (e.g. m/44'/784'/0'/0'/0').

Implementation

bool isValidHardenedPath(String path) {
  if (!RegExp(r"^m/44'/784'/[0-9]+'/[0-9]+'/[0-9]+'+$").hasMatch(path)) {
    return false;
  }
  return true;
}