validateWithDidDoc method

ValidationResult validateWithDidDoc(
  1. String didDoc, {
  2. int? fromHeightInc,
  3. int? untilHeightExc,
})

Implementation

ValidationResult validateWithDidDoc(String didDoc,
    {int? fromHeightInc, int? untilHeightExc}) {
  final nativeDidDoc = didDoc.toNativeUtf8();
  final nativeFrom = fromHeightInc.asOptional();
  final nativeUntil = untilHeightExc.asOptional();
  try {
    final ffiResult = DartApi.native.signedJson
        .validateWithDidDoc(_ffi, nativeDidDoc, nativeFrom, nativeUntil)
        .extract((resp) => resp.asPointer<Void>());
    return ValidationResult(ffiResult, true);
  } finally {
    if (nativeUntil != nullptr) {
      calloc.free(nativeUntil);
    }
    if (nativeFrom != nullptr) {
      calloc.free(nativeFrom);
    }
    calloc.free(nativeDidDoc);
  }
}