OrchardSpendValidatingKey.fromBytes constructor

OrchardSpendValidatingKey.fromBytes(
  1. List<int> bytes
)

Implementation

factory OrchardSpendValidatingKey.fromBytes(List<int> bytes) {
  if (bytes.exc(
            length: 32,
            operation: "OrchardSpendValidatingKey",
            reason: "Invalid OrchardSpendValidatingKey bytes length.",
          )[31] &
          0x80 !=
      0) {
    throw CoreErrors.orchardFailed(
      "OrchardSpendValidatingKey",
      reason: "Invalid spend verification key.",
    );
  }
  // Single validating parse (includes the identity check); afterwards
  // only raw bytes are kept.
  final key = RedPallasSpendPublicKey.fromBytes(bytes);
  return OrchardSpendValidatingKey._(BuBytes.from(bytes), key);
}