decodeSaplingExtendedSpendingKey static method

List<int> decodeSaplingExtendedSpendingKey(
  1. String extendedKey,
  2. String hrp
)

Implementation

static List<int> decodeSaplingExtendedSpendingKey(
  String extendedKey,
  String hrp,
) {
  try {
    final decode = Bech32Decoder.decodeWithoutHRP(extendedKey);
    if (decode.$1 == hrp) return decode.$2;
    throw CoreErrors.zcashInvalidKeyData(
      "Sapling spending",
      reason: "Mismatch network hrp.",
    );
  } on BuError {
    rethrow;
  } catch (_) {
    throw CoreErrors.zcashInvalidKeyData("Sapling spending");
  }
}