|
16 | 16 | * under the License. |
17 | 17 | */ |
18 | 18 |
|
19 | | -import {arrayBufferToBase64url, base64urlToArrayBuffer, AsgardeoRuntimeError} from '@asgardeo/javascript'; |
| 19 | +import { |
| 20 | + arrayBufferToBase64url, |
| 21 | + base64urlToArrayBuffer, |
| 22 | + AsgardeoRuntimeError, |
| 23 | + createPackageComponentLogger, |
| 24 | +} from '@asgardeo/javascript'; |
| 25 | + |
| 26 | +const logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger( |
| 27 | + '@asgardeo/browser', |
| 28 | + 'WebAuthn', |
| 29 | +); |
20 | 30 |
|
21 | 31 | /** |
22 | 32 | * Handles WebAuthn/Passkey authentication flow for browser environments. |
@@ -125,8 +135,7 @@ const handleWebAuthnAuthentication = async (challengeData: string): Promise<stri |
125 | 135 | let rpIdToUse: string = challengeRpId; |
126 | 136 |
|
127 | 137 | if (challengeRpId && !currentDomain.endsWith(challengeRpId) && challengeRpId !== currentDomain) { |
128 | | - // eslint-disable-next-line no-console |
129 | | - console.warn(`RP ID mismatch detected. Challenge RP ID: ${challengeRpId}, Current domain: ${currentDomain}`); |
| 138 | + logger.warn(`RP ID mismatch detected. Challenge RP ID: ${challengeRpId}, Current domain: ${currentDomain}`); |
130 | 139 | rpIdToUse = currentDomain; |
131 | 140 | } |
132 | 141 |
|
@@ -179,8 +188,7 @@ const handleWebAuthnAuthentication = async (challengeData: string): Promise<stri |
179 | 188 |
|
180 | 189 | return JSON.stringify(tokenResponse); |
181 | 190 | } catch (error) { |
182 | | - // eslint-disable-next-line no-console |
183 | | - console.error('WebAuthn authentication failed:', error); |
| 191 | + logger.error('WebAuthn authentication failed:'); |
184 | 192 |
|
185 | 193 | if (error instanceof AsgardeoRuntimeError) { |
186 | 194 | throw error; |
|
0 commit comments