summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-08-16 22:34:15 -0700
committerMatthew Miller <matthew@millerti.me>2022-08-16 22:34:15 -0700
commit8432ac818889a7b36bbfb4c620365d0ea3189b0f (patch)
tree9d0e672bd72628a8edc8696b97d4a0aa789aa872 /packages/browser/src
parent2de1972b2461837a83a40a6bbb6cb51719002d3b (diff)
Capitalize the "A" in "Webauthn"
Diffstat (limited to 'packages/browser/src')
-rw-r--r--packages/browser/src/helpers/__mocks__/browserSupportsWebauthn.ts2
-rw-r--r--packages/browser/src/helpers/browserSupportsWebAuthn.test.ts (renamed from packages/browser/src/helpers/browserSupportsWebauthn.test.ts)8
-rw-r--r--packages/browser/src/helpers/browserSupportsWebAuthn.ts (renamed from packages/browser/src/helpers/browserSupportsWebauthn.ts)2
-rw-r--r--packages/browser/src/helpers/platformAuthenticatorIsAvailable.ts4
-rw-r--r--packages/browser/src/index.test.ts6
-rw-r--r--packages/browser/src/index.ts4
-rw-r--r--packages/browser/src/methods/startAuthentication.test.ts12
-rw-r--r--packages/browser/src/methods/startAuthentication.ts4
-rw-r--r--packages/browser/src/methods/startRegistration.test.ts6
-rw-r--r--packages/browser/src/methods/startRegistration.ts4
10 files changed, 26 insertions, 26 deletions
diff --git a/packages/browser/src/helpers/__mocks__/browserSupportsWebauthn.ts b/packages/browser/src/helpers/__mocks__/browserSupportsWebauthn.ts
index 20d5d88..5751167 100644
--- a/packages/browser/src/helpers/__mocks__/browserSupportsWebauthn.ts
+++ b/packages/browser/src/helpers/__mocks__/browserSupportsWebauthn.ts
@@ -1,2 +1,2 @@
// We just need a simple mock so we can control whether this returns `true` or `false`
-export const browserSupportsWebauthn = jest.fn();
+export const browserSupportsWebAuthn = jest.fn();
diff --git a/packages/browser/src/helpers/browserSupportsWebauthn.test.ts b/packages/browser/src/helpers/browserSupportsWebAuthn.test.ts
index 5308315..20d96c2 100644
--- a/packages/browser/src/helpers/browserSupportsWebauthn.test.ts
+++ b/packages/browser/src/helpers/browserSupportsWebAuthn.test.ts
@@ -1,4 +1,4 @@
-import { browserSupportsWebauthn } from './browserSupportsWebauthn';
+import { browserSupportsWebAuthn } from './browserSupportsWebAuthn';
beforeEach(() => {
// @ts-ignore 2741
@@ -6,12 +6,12 @@ beforeEach(() => {
});
test('should return true when browser supports WebAuthn', () => {
- expect(browserSupportsWebauthn()).toBe(true);
+ expect(browserSupportsWebAuthn()).toBe(true);
});
test('should return false when browser does not support WebAuthn', () => {
delete (window as any).PublicKeyCredential;
- expect(browserSupportsWebauthn()).toBe(false);
+ expect(browserSupportsWebAuthn()).toBe(false);
});
test('should return false when window is undefined', () => {
@@ -20,7 +20,7 @@ test('should return false when window is undefined', () => {
windowSpy.mockImplementation(() => undefined);
expect(window).toBe(undefined);
- expect(browserSupportsWebauthn()).toBe(false);
+ expect(browserSupportsWebAuthn()).toBe(false);
// Restore original window value.
windowSpy.mockRestore();
diff --git a/packages/browser/src/helpers/browserSupportsWebauthn.ts b/packages/browser/src/helpers/browserSupportsWebAuthn.ts
index 030256f..79fe673 100644
--- a/packages/browser/src/helpers/browserSupportsWebauthn.ts
+++ b/packages/browser/src/helpers/browserSupportsWebAuthn.ts
@@ -1,7 +1,7 @@
/**
* Determine if the browser is capable of Webauthn
*/
-export function browserSupportsWebauthn(): boolean {
+export function browserSupportsWebAuthn(): boolean {
return (
window?.PublicKeyCredential !== undefined && typeof window.PublicKeyCredential === 'function'
);
diff --git a/packages/browser/src/helpers/platformAuthenticatorIsAvailable.ts b/packages/browser/src/helpers/platformAuthenticatorIsAvailable.ts
index af9cbcc..7dc1505 100644
--- a/packages/browser/src/helpers/platformAuthenticatorIsAvailable.ts
+++ b/packages/browser/src/helpers/platformAuthenticatorIsAvailable.ts
@@ -1,4 +1,4 @@
-import { browserSupportsWebauthn } from './browserSupportsWebauthn';
+import { browserSupportsWebAuthn } from './browserSupportsWebAuthn';
/**
* Determine whether the browser can communicate with a built-in authenticator, like
@@ -7,7 +7,7 @@ import { browserSupportsWebauthn } from './browserSupportsWebauthn';
* This method will _not_ be able to tell you the name of the platform authenticator.
*/
export async function platformAuthenticatorIsAvailable(): Promise<boolean> {
- if (!browserSupportsWebauthn()) {
+ if (!browserSupportsWebAuthn()) {
return false;
}
diff --git a/packages/browser/src/index.test.ts b/packages/browser/src/index.test.ts
index e82191c..945ea1a 100644
--- a/packages/browser/src/index.test.ts
+++ b/packages/browser/src/index.test.ts
@@ -8,10 +8,10 @@ test('should export method `startAuthentication`', () => {
expect(index.startAuthentication).toBeDefined();
});
-test('should export method `browserSupportsWebauthn`', () => {
- expect(index.browserSupportsWebauthn).toBeDefined();
+test('should export method `browserSupportsWebAuthn`', () => {
+ expect(index.browserSupportsWebAuthn).toBeDefined();
});
test('should export method `platformAuthenticatorIsAvailable`', () => {
- expect(index.browserSupportsWebauthn).toBeDefined();
+ expect(index.browserSupportsWebAuthn).toBeDefined();
});
diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts
index e288b7c..41e040f 100644
--- a/packages/browser/src/index.ts
+++ b/packages/browser/src/index.ts
@@ -4,14 +4,14 @@
*/
import { startRegistration } from './methods/startRegistration';
import { startAuthentication } from './methods/startAuthentication';
-import { browserSupportsWebauthn } from './helpers/browserSupportsWebauthn';
+import { browserSupportsWebAuthn } from './helpers/browserSupportsWebAuthn';
import { platformAuthenticatorIsAvailable } from './helpers/platformAuthenticatorIsAvailable';
import { browserSupportsWebAuthnAutofill } from './helpers/browserSupportsWebAuthnAutofill';
export {
startRegistration,
startAuthentication,
- browserSupportsWebauthn,
+ browserSupportsWebAuthn,
browserSupportsWebAuthnAutofill,
platformAuthenticatorIsAvailable,
};
diff --git a/packages/browser/src/methods/startAuthentication.test.ts b/packages/browser/src/methods/startAuthentication.test.ts
index 31ace90..1936a9e 100644
--- a/packages/browser/src/methods/startAuthentication.test.ts
+++ b/packages/browser/src/methods/startAuthentication.test.ts
@@ -5,7 +5,7 @@ import {
AuthenticationExtensionsClientOutputs,
} from '@simplewebauthn/typescript-types';
-import { browserSupportsWebauthn } from '../helpers/browserSupportsWebauthn';
+import { browserSupportsWebAuthn } from '../helpers/browserSupportsWebAuthn';
import { browserSupportsWebAuthnAutofill } from '../helpers/browserSupportsWebAuthnAutofill';
import { utf8StringToBuffer } from '../helpers/utf8StringToBuffer';
import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString';
@@ -15,11 +15,11 @@ import { webauthnAbortService } from '../helpers/webAuthnAbortService';
import { startAuthentication } from './startAuthentication';
-jest.mock('../helpers/browserSupportsWebauthn');
+jest.mock('../helpers/browserSupportsWebAuthn');
jest.mock('../helpers/browserSupportsWebAuthnAutofill');
const mockNavigatorGet = window.navigator.credentials.get as jest.Mock;
-const mockSupportsWebauthn = browserSupportsWebauthn as jest.Mock;
+const mockSupportsWebAuthn = browserSupportsWebAuthn as jest.Mock;
const mockSupportsAutofill = browserSupportsWebAuthnAutofill as jest.Mock;
const mockAuthenticatorData = 'mockAuthenticatorData';
@@ -58,13 +58,13 @@ beforeEach(() => {
});
});
- mockSupportsWebauthn.mockReturnValue(true);
+ mockSupportsWebAuthn.mockReturnValue(true);
mockSupportsAutofill.mockResolvedValue(true);
});
afterEach(() => {
mockNavigatorGet.mockReset();
- mockSupportsWebauthn.mockReset();
+ mockSupportsWebAuthn.mockReset();
mockSupportsAutofill.mockReset();
});
@@ -126,7 +126,7 @@ test('should return base64url-encoded response values', async () => {
});
test("should throw error if WebAuthn isn't supported", async () => {
- mockSupportsWebauthn.mockReturnValue(false);
+ mockSupportsWebAuthn.mockReturnValue(false);
await expect(startAuthentication(goodOpts1)).rejects.toThrow(
'WebAuthn is not supported in this browser',
diff --git a/packages/browser/src/methods/startAuthentication.ts b/packages/browser/src/methods/startAuthentication.ts
index 6bc36d7..4cbe688 100644
--- a/packages/browser/src/methods/startAuthentication.ts
+++ b/packages/browser/src/methods/startAuthentication.ts
@@ -7,7 +7,7 @@ import {
import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString';
import { base64URLStringToBuffer } from '../helpers/base64URLStringToBuffer';
import { bufferToUTF8String } from '../helpers/bufferToUTF8String';
-import { browserSupportsWebauthn } from '../helpers/browserSupportsWebauthn';
+import { browserSupportsWebAuthn } from '../helpers/browserSupportsWebAuthn';
import { browserSupportsWebAuthnAutofill } from '../helpers/browserSupportsWebAuthnAutofill';
import { toPublicKeyCredentialDescriptor } from '../helpers/toPublicKeyCredentialDescriptor';
import { identifyAuthenticationError } from '../helpers/identifyAuthenticationError';
@@ -24,7 +24,7 @@ export async function startAuthentication(
requestOptionsJSON: PublicKeyCredentialRequestOptionsJSON,
useBrowserAutofill = false,
): Promise<AuthenticationCredentialJSON> {
- if (!browserSupportsWebauthn()) {
+ if (!browserSupportsWebAuthn()) {
throw new Error('WebAuthn is not supported in this browser');
}
diff --git a/packages/browser/src/methods/startRegistration.test.ts b/packages/browser/src/methods/startRegistration.test.ts
index 381830e..9a7196b 100644
--- a/packages/browser/src/methods/startRegistration.test.ts
+++ b/packages/browser/src/methods/startRegistration.test.ts
@@ -5,7 +5,7 @@ import {
RegistrationCredential,
} from '@simplewebauthn/typescript-types';
import { generateCustomError } from '../helpers/__jest__/generateCustomError';
-import { browserSupportsWebauthn } from '../helpers/browserSupportsWebauthn';
+import { browserSupportsWebAuthn } from '../helpers/browserSupportsWebAuthn';
import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString';
import { WebAuthnError } from '../helpers/structs';
import { webauthnAbortService } from '../helpers/webAuthnAbortService';
@@ -14,10 +14,10 @@ import { utf8StringToBuffer } from '../helpers/utf8StringToBuffer';
import { startRegistration } from './startRegistration';
-jest.mock('../helpers/browserSupportsWebauthn');
+jest.mock('../helpers/browserSupportsWebAuthn');
const mockNavigatorCreate = window.navigator.credentials.create as jest.Mock;
-const mockSupportsWebauthn = browserSupportsWebauthn as jest.Mock;
+const mockSupportsWebauthn = browserSupportsWebAuthn as jest.Mock;
const mockAttestationObject = 'mockAtte';
const mockClientDataJSON = 'mockClie';
diff --git a/packages/browser/src/methods/startRegistration.ts b/packages/browser/src/methods/startRegistration.ts
index f809405..e103c11 100644
--- a/packages/browser/src/methods/startRegistration.ts
+++ b/packages/browser/src/methods/startRegistration.ts
@@ -7,7 +7,7 @@ import {
import { utf8StringToBuffer } from '../helpers/utf8StringToBuffer';
import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString';
import { base64URLStringToBuffer } from '../helpers/base64URLStringToBuffer';
-import { browserSupportsWebauthn } from '../helpers/browserSupportsWebauthn';
+import { browserSupportsWebAuthn } from '../helpers/browserSupportsWebAuthn';
import { toPublicKeyCredentialDescriptor } from '../helpers/toPublicKeyCredentialDescriptor';
import { identifyRegistrationError } from '../helpers/identifyRegistrationError';
import { webauthnAbortService } from '../helpers/webAuthnAbortService';
@@ -20,7 +20,7 @@ import { webauthnAbortService } from '../helpers/webAuthnAbortService';
export async function startRegistration(
creationOptionsJSON: PublicKeyCredentialCreationOptionsJSON,
): Promise<RegistrationCredentialJSON> {
- if (!browserSupportsWebauthn()) {
+ if (!browserSupportsWebAuthn()) {
throw new Error('WebAuthn is not supported in this browser');
}