blob: 2123774d3f0008b0cd45890b2ee12915518f1975 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
"use client";
import { authenticateWithPasskey, createPasskey } from "@/lib/passkey";
import PrimaryButton from "../PrimaryButton";
import { SymbolView, SymbolViewProps, SymbolWeight } from "expo-symbols";
import { useState } from "react";
import toast from "react-hot-toast";
import { Platform, StyleProp, ViewStyle } from "react-native";
export function Passkee() {
const [isLoading, setIsLoading] = useState(false);
async function handleCreate() {
//
const ok = await createPasskey();
if (!ok) toast.error("Error generating passkey");
else toast.success("Passkey generated!");
}
async function handleCheck() {
//
const ok = await authenticateWithPasskey();
if (!ok) toast.error("Can't login");
else toast.success("Passkey auth successful");
}
return (
<>
<PrimaryButton
label="Create Passkey"
onPress={handleCreate}
isLoading={isLoading}
style={{ marginBottom: 16 }}
/>
<PrimaryButton
label="Check Passkey"
onPress={handleCheck}
isLoading={isLoading}
style={{ marginBottom: 16 }}
/>
</>
);
}
|