summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/authentication/generateAuthenticationOptions.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2024-04-12 13:38:30 -0700
committerMatthew Miller <matthew@millerti.me>2024-04-12 13:38:30 -0700
commiteb1988a9cff91988263f39101e6769c39cf27b60 (patch)
treecdbdfbd45f0a5c5a0cf7250a7454ccfb1e954df6 /packages/server/src/authentication/generateAuthenticationOptions.ts
parentb2a6e96005660431dc4598eb5d717802b6c238e3 (diff)
Require rpID arg when generating auth options
Diffstat (limited to 'packages/server/src/authentication/generateAuthenticationOptions.ts')
-rw-r--r--packages/server/src/authentication/generateAuthenticationOptions.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/server/src/authentication/generateAuthenticationOptions.ts b/packages/server/src/authentication/generateAuthenticationOptions.ts
index 44ed2b7..61895f5 100644
--- a/packages/server/src/authentication/generateAuthenticationOptions.ts
+++ b/packages/server/src/authentication/generateAuthenticationOptions.ts
@@ -9,6 +9,7 @@ import { isoBase64URL, isoUint8Array } from '../helpers/iso/index.ts';
import { generateChallenge } from '../helpers/generateChallenge.ts';
export type GenerateAuthenticationOptionsOpts = {
+ rpID: string;
allowCredentials?: {
id: Base64URLString;
transports?: AuthenticatorTransportFuture[];
@@ -17,7 +18,6 @@ export type GenerateAuthenticationOptionsOpts = {
timeout?: number;
userVerification?: UserVerificationRequirement;
extensions?: AuthenticationExtensionsClientInputs;
- rpID?: string;
};
/**
@@ -34,7 +34,7 @@ export type GenerateAuthenticationOptionsOpts = {
* @param rpID Valid domain name (after `https://`)
*/
export async function generateAuthenticationOptions(
- options: GenerateAuthenticationOptionsOpts = {},
+ options: GenerateAuthenticationOptionsOpts,
): Promise<PublicKeyCredentialRequestOptionsJSON> {
const {
allowCredentials,
@@ -54,6 +54,7 @@ export async function generateAuthenticationOptions(
}
return {
+ rpId: rpID,
challenge: isoBase64URL.fromBuffer(_challenge),
allowCredentials: allowCredentials?.map((cred) => {
if (!isoBase64URL.isBase64URL(cred.id)) {
@@ -69,6 +70,5 @@ export async function generateAuthenticationOptions(
timeout,
userVerification,
extensions,
- rpId: rpID,
};
}