Skip to content

Commit

Permalink
Update WebAuthn method calls to use object parameters (#687)
Browse files Browse the repository at this point in the history
Refactored `startAuthentication` and `startRegistration` calls to use object syntax for passing parameters. This improves code clarity and aligns with expected API usage patterns.
Spomky authored Feb 1, 2025
1 parent 90ef21b commit 523735f
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/stimulus/assets/dist/controller.js
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ class default_1 extends Controller {
}
async _processSignin(optionsResponseJson, useBrowserAutofill) {
try {
const authenticatorResponse = await startAuthentication(optionsResponseJson, useBrowserAutofill);
const authenticatorResponse = await startAuthentication({ optionsJSON: optionsResponseJson, useBrowserAutofill });
this._dispatchEvent('webauthn:authenticator:response', { response: authenticatorResponse });
const assertionResponse = await this._getAssertionResponse(authenticatorResponse);
if (assertionResponse !== false && this.requestSuccessRedirectUriValue) {
@@ -62,7 +62,7 @@ class default_1 extends Controller {
if (!optionsResponseJson) {
return;
}
const authenticatorResponse = await startRegistration(optionsResponseJson);
const authenticatorResponse = await startRegistration({ optionsJSON: optionsResponseJson });
this._dispatchEvent('webauthn:authenticator:response', { response: authenticatorResponse });
const attestationResponseJSON = await this._getAttestationResponse(authenticatorResponse);
if (attestationResponseJSON !== false && this.creationSuccessRedirectUriValue) {
4 changes: 2 additions & 2 deletions src/stimulus/assets/src/controller.ts
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ export default class extends Controller {
private async _processSignin(optionsResponseJson: Object, useBrowserAutofill: boolean): Promise<void> {
try {
// @ts-ignore
const authenticatorResponse = await startAuthentication(optionsResponseJson, useBrowserAutofill);
const authenticatorResponse = await startAuthentication({ optionsJSON: optionsResponseJson, useBrowserAutofill });
this._dispatchEvent('webauthn:authenticator:response', { response: authenticatorResponse });

const assertionResponse = await this._getAssertionResponse(authenticatorResponse);
@@ -109,7 +109,7 @@ export default class extends Controller {
}

// @ts-ignore
const authenticatorResponse = await startRegistration(optionsResponseJson);
const authenticatorResponse = await startRegistration({ optionsJSON: optionsResponseJson });
this._dispatchEvent('webauthn:authenticator:response', { response: authenticatorResponse });

const attestationResponseJSON = await this._getAttestationResponse(authenticatorResponse);

0 comments on commit 523735f

Please sign in to comment.