From 41538dd2189f26dfe0dd74a426f8172d32e0c593 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 18 May 2022 16:16:12 -0700 Subject: Upgrade AuthenticatorTransport to "Future" --- packages/typescript-types/src/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'packages/typescript-types/src') diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts index 6381b80..a2ac847 100644 --- a/packages/typescript-types/src/index.ts +++ b/packages/typescript-types/src/index.ts @@ -148,10 +148,11 @@ export interface AuthenticatorAttestationResponseFuture extends AuthenticatorAtt } /** - * Communication methods by which an authenticator can talk with the browser to perform WebAuthn - * registration and authentication. + * A super class of TypeScript's `AuthenticatorTransport` that includes support for the latest + * transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to + * know about it (sometime after 4.6.3) */ -export type AuthenticatorTransport = "ble" | "internal" | "nfc" | "usb" | "cable"; +export type AuthenticatorTransportFuture = "ble" | "internal" | "nfc" | "usb" | "cable"; /** * The two types of credentials as defined by bit 3 ("Backup Eligibility") in authenticator data: -- cgit v1.2.3 From 44bc82b8521472efcb829944782829742f529d16 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 18 May 2022 16:17:08 -0700 Subject: Update transport types to "Future" --- packages/typescript-types/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages/typescript-types/src') diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts index a2ac847..b35ff4a 100644 --- a/packages/typescript-types/src/index.ts +++ b/packages/typescript-types/src/index.ts @@ -44,7 +44,7 @@ export interface PublicKeyCredentialRequestOptionsJSON export interface PublicKeyCredentialDescriptorJSON extends Omit { id: Base64URLString; - transports?: AuthenticatorTransport[]; + transports?: AuthenticatorTransportFuture[]; } export interface PublicKeyCredentialUserEntityJSON @@ -68,7 +68,7 @@ export interface RegistrationCredentialJSON rawId: Base64URLString; response: AuthenticatorAttestationResponseJSON; clientExtensionResults: AuthenticationExtensionsClientOutputs; - transports?: AuthenticatorTransport[]; + transports?: AuthenticatorTransportFuture[]; } /** @@ -123,7 +123,7 @@ export type AuthenticatorDevice = { // Number of times this authenticator is expected to have been used counter: number; // From browser's `startRegistration()` -> RegistrationCredentialJSON.transports (API L2 and up) - transports?: AuthenticatorTransport[]; + transports?: AuthenticatorTransportFuture[]; }; /** @@ -141,7 +141,7 @@ export type Base64URLString = string; * Properties marked optional are not supported in all browsers. */ export interface AuthenticatorAttestationResponseFuture extends AuthenticatorAttestationResponse { - getTransports?: () => AuthenticatorTransport[]; + getTransports?: () => AuthenticatorTransportFuture[]; getAuthenticatorData?: () => ArrayBuffer; getPublicKey?: () => ArrayBuffer; getPublicKeyAlgorithm?: () => COSEAlgorithmIdentifier[]; -- cgit v1.2.3 From f51a8b528f5cea10aa181f6112928f968b3c14ca Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 18 May 2022 16:17:39 -0700 Subject: Create PublicKeyCredentialDescriptorFuture --- packages/typescript-types/src/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'packages/typescript-types/src') diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts index b35ff4a..c3f843c 100644 --- a/packages/typescript-types/src/index.ts +++ b/packages/typescript-types/src/index.ts @@ -154,6 +154,15 @@ export interface AuthenticatorAttestationResponseFuture extends AuthenticatorAtt */ export type AuthenticatorTransportFuture = "ble" | "internal" | "nfc" | "usb" | "cable"; +/** + * A super class of TypeScript's `PublicKeyCredentialDescriptor` that knows about the latest + * transports. Should eventually be replaced by TypeScript's when TypeScript gets updated to + * know about it (sometime after 4.6.3) + */ +export interface PublicKeyCredentialDescriptorFuture extends Omit { + transports?: AuthenticatorTransportFuture[]; +} + /** * The two types of credentials as defined by bit 3 ("Backup Eligibility") in authenticator data: * - `"singleDevice"` credentials will never be backed up -- cgit v1.2.3 From 03da18fac7b3a9c6c1de0468469bb3624af3f0b3 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 18 May 2022 16:19:53 -0700 Subject: Point PublicKeyCredentialDescriptor to "Future" --- packages/server/src/authentication/generateAuthenticationOptions.ts | 4 ++-- packages/server/src/registration/generateRegistrationOptions.ts | 4 ++-- packages/typescript-types/src/index.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'packages/typescript-types/src') diff --git a/packages/server/src/authentication/generateAuthenticationOptions.ts b/packages/server/src/authentication/generateAuthenticationOptions.ts index f176835..54a81a3 100644 --- a/packages/server/src/authentication/generateAuthenticationOptions.ts +++ b/packages/server/src/authentication/generateAuthenticationOptions.ts @@ -1,7 +1,7 @@ import type { AuthenticationExtensionsClientInputs, PublicKeyCredentialRequestOptionsJSON, - PublicKeyCredentialDescriptor, + PublicKeyCredentialDescriptorFuture, UserVerificationRequirement, } from '@simplewebauthn/typescript-types'; import base64url from 'base64url'; @@ -9,7 +9,7 @@ import base64url from 'base64url'; import generateChallenge from '../helpers/generateChallenge'; export type GenerateAuthenticationOptionsOpts = { - allowCredentials?: PublicKeyCredentialDescriptor[]; + allowCredentials?: PublicKeyCredentialDescriptorFuture[]; challenge?: string | Buffer; timeout?: number; userVerification?: UserVerificationRequirement; diff --git a/packages/server/src/registration/generateRegistrationOptions.ts b/packages/server/src/registration/generateRegistrationOptions.ts index c55b308..f3cf5c2 100644 --- a/packages/server/src/registration/generateRegistrationOptions.ts +++ b/packages/server/src/registration/generateRegistrationOptions.ts @@ -4,7 +4,7 @@ import type { AuthenticatorSelectionCriteria, COSEAlgorithmIdentifier, PublicKeyCredentialCreationOptionsJSON, - PublicKeyCredentialDescriptor, + PublicKeyCredentialDescriptorFuture, PublicKeyCredentialParameters, } from '@simplewebauthn/typescript-types'; import base64url from 'base64url'; @@ -20,7 +20,7 @@ export type GenerateRegistrationOptionsOpts = { userDisplayName?: string; timeout?: number; attestationType?: AttestationConveyancePreference; - excludeCredentials?: PublicKeyCredentialDescriptor[]; + excludeCredentials?: PublicKeyCredentialDescriptorFuture[]; authenticatorSelection?: AuthenticatorSelectionCriteria; extensions?: AuthenticationExtensionsClientInputs; supportedAlgorithmIDs?: COSEAlgorithmIdentifier[]; diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts index c3f843c..b4bafc0 100644 --- a/packages/typescript-types/src/index.ts +++ b/packages/typescript-types/src/index.ts @@ -42,7 +42,7 @@ export interface PublicKeyCredentialRequestOptionsJSON } export interface PublicKeyCredentialDescriptorJSON - extends Omit { + extends Omit { id: Base64URLString; transports?: AuthenticatorTransportFuture[]; } -- cgit v1.2.3