getAuthFactorToken method
Retrieve the TMR JWT associated with an authentication factor.
sessionId
- The user's session ID.
authFactorType
- The type of authentication factor. Can be "EM" or "SMS".
authFactorValue
- The value of authentication factor.
challenge
- The challenge sent by SSKS to the user's authentication method if any.
Returns a SealdSsksTMRPluginGetFactorTokenResponse containing the retrieved token.
Implementation
SealdSsksTMRPluginGetFactorTokenResponse getAuthFactorToken(
String sessionId, String authFactorType, String authFactorValue,
{String? challenge}) {
final Pointer<Utf8> nativeSessionId = sessionId.toNativeUtf8();
final Pointer<Utf8> nativeAuthFactorType = authFactorType.toNativeUtf8();
final Pointer<Utf8> nativeAuthFactorValue = authFactorValue.toNativeUtf8();
final Pointer<Utf8> nativeChallenge = challenge?.toNativeUtf8() ?? nullptr;
final Pointer<Pointer<NativeSealdSsksTMRPluginGetFactorTokenResponse>>
result =
calloc<Pointer<NativeSealdSsksTMRPluginGetFactorTokenResponse>>();
final Pointer<Pointer<NativeSealdError>> err =
calloc<Pointer<NativeSealdError>>();
final int resultCode = _bindings.SealdSsksTMRPlugin_GetFactorToken(
_ptr.pointer(),
nativeSessionId,
nativeAuthFactorType,
nativeAuthFactorValue,
nativeChallenge,
result,
err);
calloc.free(nativeSessionId);
calloc.free(nativeAuthFactorType);
calloc.free(nativeAuthFactorValue);
calloc.free(nativeChallenge);
if (resultCode != 0) {
calloc.free(result);
throw SealdException._fromCPtr(err);
} else {
final SealdSsksTMRPluginGetFactorTokenResponse res =
SealdSsksTMRPluginGetFactorTokenResponse._fromC(result.value);
calloc.free(result);
calloc.free(err);
return res;
}
}