Skip to content

Commit 0c32dcc

Browse files
committed
Tweak returns for tighter typing
1 parent 42447c4 commit 0c32dcc

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

packages/server/src/registration/verifyRegistrationResponse.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,15 @@ export async function verifyRegistrationResponse(
275275
throw new Error(`Unsupported Attestation Format: ${fmt}`);
276276
}
277277

278-
const toReturn: VerifiedRegistrationResponse = {
279-
verified,
280-
};
278+
if (!verified) {
279+
return { verified: false };
280+
}
281281

282-
if (toReturn.verified) {
283-
const { credentialDeviceType, credentialBackedUp } = parseBackupFlags(
284-
flags,
285-
);
282+
const { credentialDeviceType, credentialBackedUp } = parseBackupFlags(flags);
286283

287-
toReturn.registrationInfo = {
284+
return {
285+
verified: true,
286+
registrationInfo: {
288287
fmt,
289288
aaguid: convertAAGUIDToString(aaguid),
290289
credentialType,
@@ -301,10 +300,8 @@ export async function verifyRegistrationResponse(
301300
origin: clientDataJSON.origin,
302301
rpID: matchedRPID,
303302
authenticatorExtensionResults: extensionsData,
304-
};
305-
}
306-
307-
return toReturn;
303+
},
304+
};
308305
}
309306

310307
/**

0 commit comments

Comments
 (0)