summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-06-25 10:42:30 -0700
committerMatthew Miller <matthew@millerti.me>2023-06-25 10:42:30 -0700
commit87c3275a771272a84bb178374b381bcaefbdacec (patch)
tree62eae3ef9d52b3f16034ac1385e9c181ff1615f1 /packages/browser/src
parent925c837870e189dc592ad075c9055f6ccdc93e68 (diff)
Populate new values when available
Diffstat (limited to 'packages/browser/src')
-rw-r--r--packages/browser/src/methods/startRegistration.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/browser/src/methods/startRegistration.ts b/packages/browser/src/methods/startRegistration.ts
index 546347b..5b97a5e 100644
--- a/packages/browser/src/methods/startRegistration.ts
+++ b/packages/browser/src/methods/startRegistration.ts
@@ -64,6 +64,26 @@ export async function startRegistration(
transports = response.getTransports();
}
+ // L3 says this is required, but browser and webview support are still not guaranteed.
+ let responsePublicKeyAlgorithm: number | undefined = undefined;
+ if (typeof response.getPublicKeyAlgorithm === 'function') {
+ responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();
+ }
+
+ let responsePublicKey: string | undefined = undefined;
+ if (typeof response.getPublicKey === 'function') {
+ const _publicKey = response.getPublicKey();
+ if (_publicKey !== null) {
+ responsePublicKey = bufferToBase64URLString(_publicKey);
+ }
+ }
+
+ // L3 says this is required, but browser and webview support are still not guaranteed.
+ let responseAuthenticatorData: string | undefined;
+ if (typeof response.getAuthenticatorData === 'function') {
+ responseAuthenticatorData = bufferToBase64URLString(response.getAuthenticatorData());
+ }
+
return {
id,
rawId: bufferToBase64URLString(rawId),
@@ -71,6 +91,9 @@ export async function startRegistration(
attestationObject: bufferToBase64URLString(response.attestationObject),
clientDataJSON: bufferToBase64URLString(response.clientDataJSON),
transports,
+ publicKeyAlgorithm: responsePublicKeyAlgorithm,
+ publicKey: responsePublicKey,
+ authenticatorData: responseAuthenticatorData,
},
type,
clientExtensionResults: credential.getClientExtensionResults(),