Skip to content

Commit cc79b74

Browse files
committed
Update comments in PasskeyRegistrationModal to correct step numbering for clarity in the WebAuthn registration process.
1 parent ca9c030 commit cc79b74

File tree

1 file changed

+5
-4
lines changed
  • packages/template-retail-react-app/app/components/passkey-registration-modal

1 file changed

+5
-4
lines changed

packages/template-retail-react-app/app/components/passkey-registration-modal/index.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ const PasskeyRegistrationModal = ({isOpen, onClose}) => {
103103
throw new Error('WebAuthn API not available in this browser')
104104
}
105105

106-
// Step 4: navigator.credentials.create() will show a browser/system prompt
106+
// navigator.credentials.create() will show a browser/system prompt
107107
// This may appear to hang if the user doesn't interact with the prompt
108108
const credential = await navigator.credentials.create({publicKey})
109109

110110
if (!credential) {
111111
throw new Error('Failed to create credential: user cancelled or operation failed')
112112
}
113113

114-
// Step 5: Convert credential to JSON format before sending to SLAS
114+
// Step 4: Convert credential to JSON format before sending to SLAS
115115
// https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential/toJSON
116116
let credentialJson
117117
try {
@@ -134,14 +134,14 @@ const PasskeyRegistrationModal = ({isOpen, onClose}) => {
134134
}
135135
}
136136

137-
// Step 6: Finish WebAuthn registration
137+
// Step 5: Finish WebAuthn registration
138138
await finishWebauthnUserRegistration.mutateAsync({
139139
username: customer.email,
140140
credential: credentialJson,
141141
pwd_action_token: code
142142
})
143143

144-
// Step 7: Close OTP modal and main modal on success
144+
// Step 6: Close OTP modal and main modal on success
145145
setIsOtpAuthOpen(false)
146146
onClose()
147147

@@ -151,6 +151,7 @@ const PasskeyRegistrationModal = ({isOpen, onClose}) => {
151151
const message = /Unauthorized/i.test(err.message)
152152
? formatMessage(INVALID_TOKEN_ERROR_MESSAGE)
153153
: formatMessage(API_ERROR_MESSAGE)
154+
154155
// Return error result for OTP component to display
155156
return {
156157
success: false,

0 commit comments

Comments
 (0)