summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers/webAuthnAbortService.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-09-28 23:49:55 -0700
committerMatthew Miller <matthew@millerti.me>2023-09-28 23:50:01 -0700
commit75e07cfbedab2ceb80ef7f39486e7aed5ef7975c (patch)
tree880df606defbf358fc74c70903e5d5cea92a798e /packages/browser/src/helpers/webAuthnAbortService.ts
parentdaf1104c9bb635ecdcff994b4b1d76f202d09eaa (diff)
Add new method to manually cancel active ceremony
Diffstat (limited to 'packages/browser/src/helpers/webAuthnAbortService.ts')
-rw-r--r--packages/browser/src/helpers/webAuthnAbortService.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/browser/src/helpers/webAuthnAbortService.ts b/packages/browser/src/helpers/webAuthnAbortService.ts
index ce6979c..da5380b 100644
--- a/packages/browser/src/helpers/webAuthnAbortService.ts
+++ b/packages/browser/src/helpers/webAuthnAbortService.ts
@@ -21,6 +21,21 @@ class BaseWebAuthnAbortService {
this.controller = newController;
return newController.signal;
}
+
+ /**
+ * Manually cancel any active WebAuthn registration or authentication attempt.
+ */
+ cancelCeremony() {
+ if (this.controller) {
+ const abortError = new Error(
+ 'Manually cancelling existing WebAuthn API call',
+ );
+ abortError.name = 'AbortError';
+ this.controller.abort(abortError);
+
+ this.controller = undefined;
+ }
+ }
}
/**