This commit is contained in:
peintnermax
2024-05-07 10:04:03 +02:00
parent a85eb93939
commit 6764e6fc66
4 changed files with 12 additions and 10 deletions

View File

@@ -6,7 +6,7 @@ import { NextRequest, NextResponse, userAgent } from "next/server";
export async function POST(request: NextRequest) {
const body = await request.json();
if (body) {
let { passkeyId, passkeyName, publicKeyCredential, sessionId } = body;
let { u2fId, passkeyName, publicKeyCredential, sessionId } = body;
if (!!!passkeyName) {
const { browser, device, os } = userAgent(request);
@@ -27,7 +27,7 @@ export async function POST(request: NextRequest) {
if (userId) {
const req: VerifyU2FRegistrationRequest = {
publicKeyCredential,
u2fId: passkeyId,
u2fId,
userId,
tokenName: passkeyName,
};

View File

@@ -21,7 +21,7 @@ import {
CreateSessionResponse,
GetBrandingSettingsResponse,
GetPasswordComplexitySettingsResponse,
AddMyAuthFactorOTPResponse,
RegisterU2FResponse,
GetLegalAndSupportSettingsResponse,
AddHumanUserResponse,
BrandingSettings,
@@ -509,7 +509,7 @@ export async function createPasskeyRegistrationLink(
export async function registerU2F(
userId: string,
domain: string
): Promise<any> {
): Promise<RegisterU2FResponse> {
const userservice = user.getUser(server);
return userservice.registerU2F({

View File

@@ -6,7 +6,7 @@ import { useForm } from "react-hook-form";
import { useRouter } from "next/navigation";
import { Spinner } from "./Spinner";
import Alert from "./Alert";
import { AuthRequest, RegisterPasskeyResponse } from "@zitadel/server";
import { RegisterU2FResponse } from "@zitadel/server";
import { coerceToArrayBuffer, coerceToBase64Url } from "#/utils/base64";
type Inputs = {};
@@ -55,7 +55,7 @@ export default function RegisterU2F({
}
async function submitVerify(
passkeyId: string,
u2fId: string,
passkeyName: string,
publicKeyCredential: any,
sessionId: string
@@ -67,7 +67,7 @@ export default function RegisterU2F({
"Content-Type": "application/json",
},
body: JSON.stringify({
passkeyId,
u2fId,
passkeyName,
publicKeyCredential,
sessionId,
@@ -85,8 +85,8 @@ export default function RegisterU2F({
}
function submitRegisterAndContinue(value: Inputs): Promise<boolean | void> {
return submitRegister().then((resp: RegisterPasskeyResponse) => {
const passkeyId = resp.passkeyId;
return submitRegister().then((resp: RegisterU2FResponse) => {
const u2fId = resp.u2fId;
if (
resp.publicKeyCredentialCreationOptions &&
@@ -145,7 +145,7 @@ export default function RegisterU2F({
),
},
};
return submitVerify(passkeyId, "", data, sessionId).then(() => {
return submitVerify(u2fId, "", data, sessionId).then(() => {
const params = new URLSearchParams();
if (organization) {