From 8ae0d2779c26f74e64a1db2b028bd2ac2f599cb4 Mon Sep 17 00:00:00 2001 From: polwex Date: Wed, 16 Jul 2025 10:46:39 +0700 Subject: encryption done if heavy --- components/login/ShipCredsForm.tsx | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'components') diff --git a/components/login/ShipCredsForm.tsx b/components/login/ShipCredsForm.tsx index 15712c2..ac58e86 100644 --- a/components/login/ShipCredsForm.tsx +++ b/components/login/ShipCredsForm.tsx @@ -1,6 +1,5 @@ "use client"; import { ColorScheme, lightColors } from "@/constants"; -import { BottomTabBarButtonProps } from "@react-navigation/bottom-tabs"; import { StyleSheet, TextInput, @@ -10,15 +9,32 @@ import { } from "react-native"; import PrimaryButton from "../PrimaryButton"; import { useState } from "react"; +import { createFancyPasskey, pkDecrypt, pkEncrypt } from "@/lib/passkey"; +import toast, { Toaster } from "react-hot-toast"; export function ShipForm() { const colors = lightColors; const styles = getStyles(colors); const [patp, setPatp] = useState("~mirtyl-wacdec"); const [ticket, setTicket] = useState("~posseg-winnub-fogluc-dirmes"); + const [encryptedTicket, setenc] = useState(""); const [isLoading, setIsLoading] = useState(false); async function onSubmit() { - console.log({ patp, ticket }); + console.log("running", { patp, ticket }); + const passkey = await createFancyPasskey(); + console.log({ passkey }); + toast(passkey); + } + async function enc() { + const done = await pkEncrypt(ticket); + console.log({ encryptedTicket }); + setenc(done); + toast(done); + } + async function dec() { + const decryptedTicket = await pkDecrypt(encryptedTicket); + console.log({ decryptedTicket }); + toast(decryptedTicket); } return ( @@ -48,10 +64,23 @@ export function ShipForm() { style={{ marginTop: 0 }} isLoading={isLoading} /> + + No Urbit ID? Get yours. + ); } -- cgit v1.2.3