2019-11-19 06:37:36 +07:00
|
|
|
import { CompleteTOTPSignInPath } from "./Api";
|
2021-01-02 17:58:24 +07:00
|
|
|
import { PostWithOptionalResponse } from "./Client";
|
2019-11-19 06:37:36 +07:00
|
|
|
import { SignInResponse } from "./SignIn";
|
|
|
|
|
|
|
|
interface CompleteU2FSigninBody {
|
|
|
|
token: string;
|
|
|
|
targetURL?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function completeTOTPSignIn(passcode: string, targetURL: string | undefined) {
|
|
|
|
const body: CompleteU2FSigninBody = { token: `${passcode}` };
|
|
|
|
if (targetURL) {
|
|
|
|
body.targetURL = targetURL;
|
|
|
|
}
|
|
|
|
return PostWithOptionalResponse<SignInResponse>(CompleteTOTPSignInPath, body);
|
2021-01-02 17:58:24 +07:00
|
|
|
}
|