validateConnector method
Validate an added connector that was added without a preValidationToken.
connectorId
- The ID of the connector to validate.
challenge
- The challenge.
Returns the validated SealdConnector instance.
Implementation
SealdConnector validateConnector(String connectorId, String challenge) {
if (_closed) {
throw SealdException(
code: "INSTANCE_CLOSED",
id: "FLUTTER_INSTANCE_CLOSED",
description: "Instance already closed.");
}
final Pointer<Utf8> nativeConnectorId = connectorId.toNativeUtf8();
final Pointer<Utf8> nativeChallenge = challenge.toNativeUtf8();
final Pointer<Pointer<NativeSealdConnector>> result =
calloc<Pointer<NativeSealdConnector>>();
final Pointer<Pointer<NativeSealdError>> err =
calloc<Pointer<NativeSealdError>>();
final int resultCode = _bindings.SealdSdk_ValidateConnector(
_ptr.pointer(), nativeConnectorId, nativeChallenge, result, err);
calloc.free(nativeConnectorId);
calloc.free(nativeChallenge);
if (resultCode != 0) {
calloc.free(result);
throw SealdException._fromCPtr(err);
} else {
final SealdConnector c = SealdConnector._fromC(result.value);
calloc.free(result);
calloc.free(err);
return c;
}
}