askarKeyAeadGetParams function

AskarResult<AeadParams> askarKeyAeadGetParams(
  1. LocalKeyHandle handle
)

Implementation

AskarResult<AeadParams> askarKeyAeadGetParams(LocalKeyHandle handle) {
  Pointer<NativeAeadParams> aeadParamsPtr = calloc<NativeAeadParams>();

  try {
    final result = nativeAskarKeyAeadGetParams(handle.toInt(), aeadParamsPtr);

    final errorCode = ErrorCode.fromInt(result);

    final value =
        (errorCode == ErrorCode.success)
            ? readNativeAeadParams(aeadParamsPtr.ref)
            : AeadParams(0, 0);

    return AskarResult<AeadParams>(errorCode, value);
  } finally {
    freePointer(aeadParamsPtr);
  }
}