mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
689fd7cb95
We now extend the default Eslint configuration and enforce styling with prettier for all of our frontend code.
33 lines
914 B
TypeScript
33 lines
914 B
TypeScript
import u2fApi from "u2f-api";
|
|
|
|
import { InitiateU2FSignInPath, CompleteU2FSignInPath } from "./Api";
|
|
import { Post, PostWithOptionalResponse } from "./Client";
|
|
import { SignInResponse } from "./SignIn";
|
|
|
|
interface InitiateU2FSigninResponse {
|
|
appId: string;
|
|
challenge: string;
|
|
registeredKeys: {
|
|
appId: string;
|
|
keyHandle: string;
|
|
version: string;
|
|
}[];
|
|
}
|
|
|
|
export async function initiateU2FSignin() {
|
|
return Post<InitiateU2FSigninResponse>(InitiateU2FSignInPath);
|
|
}
|
|
|
|
interface CompleteU2FSigninBody {
|
|
signResponse: u2fApi.SignResponse;
|
|
targetURL?: string;
|
|
}
|
|
|
|
export function completeU2FSignin(signResponse: u2fApi.SignResponse, targetURL: string | undefined) {
|
|
const body: CompleteU2FSigninBody = { signResponse };
|
|
if (targetURL) {
|
|
body.targetURL = targetURL;
|
|
}
|
|
return PostWithOptionalResponse<SignInResponse>(CompleteU2FSignInPath, body);
|
|
}
|