fix: ArrayBuffer type casts for WebAuthn ceremony in TS 5.x
Uint8Array.buffer returns ArrayBufferLike which is incompatible with PublicKeyCredentialCreationOptions/RequestOptions in strict mode. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f48a98d520
commit
36584014ae
|
|
@ -64,13 +64,13 @@ function SignInForm() {
|
|||
const challenge = Uint8Array.from(atob(options.challenge.replace(/-/g, "+").replace(/_/g, "/")), c => c.charCodeAt(0));
|
||||
|
||||
const publicKeyOptions: PublicKeyCredentialRequestOptions = {
|
||||
challenge,
|
||||
challenge: challenge.buffer as ArrayBuffer,
|
||||
rpId: options.rpId,
|
||||
userVerification: options.userVerification as UserVerificationRequirement,
|
||||
timeout: options.timeout,
|
||||
allowCredentials: options.allowCredentials?.map((c: { type: string; id: string; transports?: string[] }) => ({
|
||||
type: c.type as PublicKeyCredentialType,
|
||||
id: Uint8Array.from(atob(c.id.replace(/-/g, "+").replace(/_/g, "/")), ch => ch.charCodeAt(0)),
|
||||
id: Uint8Array.from(atob(c.id.replace(/-/g, "+").replace(/_/g, "/")), ch => ch.charCodeAt(0)).buffer as ArrayBuffer,
|
||||
transports: c.transports as AuthenticatorTransport[],
|
||||
})),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -94,10 +94,10 @@ export default function SignUpPage() {
|
|||
}
|
||||
|
||||
const publicKeyOptions: PublicKeyCredentialCreationOptions = {
|
||||
challenge: fromBase64url(options.challenge),
|
||||
challenge: fromBase64url(options.challenge).buffer as ArrayBuffer,
|
||||
rp: options.rp,
|
||||
user: {
|
||||
id: fromBase64url(options.user.id),
|
||||
id: fromBase64url(options.user.id).buffer as ArrayBuffer,
|
||||
name: options.user.name,
|
||||
displayName: options.user.displayName,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue