@mrgnw/anahtar 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onDestroy, onMount } from 'svelte';
|
|
3
2
|
import { guessDeviceName } from '../device.js';
|
|
4
|
-
import OtpInput from './OtpInput.svelte';
|
|
3
|
+
import type OtpInput from './OtpInput.svelte';
|
|
5
4
|
import PasskeyPrompt from './PasskeyPrompt.svelte';
|
|
6
5
|
|
|
7
6
|
interface Props {
|
|
@@ -20,13 +19,12 @@ let otpInput = $state<OtpInput>();
|
|
|
20
19
|
|
|
21
20
|
let conditionalAbort: AbortController | null = null;
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
$effect(() => {
|
|
24
23
|
tryConditionalWebAuthn();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (congratsTimeout) clearTimeout(congratsTimeout);
|
|
24
|
+
return () => {
|
|
25
|
+
conditionalAbort?.abort();
|
|
26
|
+
if (congratsTimeout) clearTimeout(congratsTimeout);
|
|
27
|
+
};
|
|
30
28
|
});
|
|
31
29
|
|
|
32
30
|
async function tryConditionalWebAuthn() {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onDestroy } from 'svelte';
|
|
3
|
-
|
|
4
2
|
interface Props {
|
|
5
3
|
countdownSeconds?: number;
|
|
6
4
|
onRegister: () => Promise<void>;
|
|
@@ -13,16 +11,21 @@ let countdown = $state(countdownSeconds);
|
|
|
13
11
|
let failed = $state(false);
|
|
14
12
|
let registering = $state(false);
|
|
15
13
|
|
|
16
|
-
let interval
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
let interval: ReturnType<typeof setInterval> | null = null;
|
|
15
|
+
|
|
16
|
+
$effect(() => {
|
|
17
|
+
interval = setInterval(() => {
|
|
18
|
+
countdown -= 1;
|
|
19
|
+
if (countdown <= 0) {
|
|
20
|
+
clearInterval(interval!);
|
|
21
|
+
interval = null;
|
|
22
|
+
triggerRegistration();
|
|
23
|
+
}
|
|
24
|
+
}, 1000);
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
if (interval) clearInterval(interval);
|
|
28
|
+
};
|
|
26
29
|
});
|
|
27
30
|
|
|
28
31
|
async function triggerRegistration() {
|