summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-12-27 20:51:40 -0800
committerMatthew Miller <matthew@millerti.me>2022-12-27 20:51:40 -0800
commitcbfa15930382f98e215c2e68103e5ac8770b22fe (patch)
treee17b6e2055007d97f07e0457219f4e660fc6f01e /packages/browser/src
parent81d5cdb0960f5b7ba96cc67baf162c49056a20a5 (diff)
Be more cautious with transports
Diffstat (limited to 'packages/browser/src')
-rw-r--r--packages/browser/src/methods/startRegistration.ts9
1 files changed, 8 insertions, 1 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(),