summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/browser/src/methods/startRegistration.ts9
-rw-r--r--packages/typescript-types/src/index.ts3
2 files changed, 10 insertions, 2 deletions
diff --git a/packages/browser/src/methods/startRegistration.ts b/packages/browser/src/methods/startRegistration.ts
index f72a10b..bceff2a 100644
--- a/packages/browser/src/methods/startRegistration.ts
+++ b/packages/browser/src/methods/startRegistration.ts
@@ -2,6 +2,7 @@ import {
PublicKeyCredentialCreationOptionsJSON,
RegistrationCredential,
RegistrationResponseJSON,
+ AuthenticatorTransportFuture,
} from '@simplewebauthn/typescript-types';
import { utf8StringToBuffer } from '../helpers/utf8StringToBuffer';
@@ -55,13 +56,19 @@ export async function startRegistration(
const { id, rawId, response, type } = credential;
+ // Continue to play it safe with `getTransports()` for now, even when L3 types say it's required
+ let transports: AuthenticatorTransportFuture[] | undefined = undefined;
+ if (typeof response.getTransports === 'function') {
+ transports = response.getTransports();
+ }
+
return {
id,
rawId: bufferToBase64URLString(rawId),
response: {
attestationObject: bufferToBase64URLString(response.attestationObject),
clientDataJSON: bufferToBase64URLString(response.clientDataJSON),
- transports: response.getTransports(),
+ transports,
},
type,
clientExtensionResults: credential.getClientExtensionResults(),
diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts
index 13d63bd..85f3ef5 100644
--- a/packages/typescript-types/src/index.ts
+++ b/packages/typescript-types/src/index.ts
@@ -128,7 +128,8 @@ export interface AuthenticationResponseJSON {
export interface AuthenticatorAttestationResponseJSON {
clientDataJSON: Base64URLString;
attestationObject: Base64URLString;
- transports: AuthenticatorTransportFuture[];
+ // Optional in L2, but becomes required in L3. Play it safe until L3 becomes Recommendation
+ transports?: AuthenticatorTransportFuture[];
}
/**