summaryrefslogtreecommitdiff
path: root/components/login
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-07-16 10:46:39 +0700
committerpolwex <polwex@sortug.com>2025-07-16 10:46:39 +0700
commit8ae0d2779c26f74e64a1db2b028bd2ac2f599cb4 (patch)
tree8add90087aae10a57817b3ef0bfc9fa884646d00 /components/login
parentdc0ad21f0e857adb87d710dd0f2f9affd0a9cbc9 (diff)
encryption done if heavy
Diffstat (limited to 'components/login')
-rw-r--r--components/login/ShipCredsForm.tsx33
1 files changed, 31 insertions, 2 deletions
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 (
<View style={styles.bottomSection}>
@@ -48,10 +64,23 @@ export function ShipForm() {
style={{ marginTop: 0 }}
isLoading={isLoading}
/>
+ <PrimaryButton
+ label="Encrypt"
+ onPress={enc}
+ style={{ marginTop: 0 }}
+ isLoading={isLoading}
+ />
+ <PrimaryButton
+ label="Decrypt"
+ onPress={dec}
+ style={{ marginTop: 0 }}
+ isLoading={isLoading}
+ />
<TouchableOpacity style={styles.footer}>
<Text style={styles.footerText}>No Urbit ID? Get yours.</Text>
</TouchableOpacity>
+ <Toaster position={"top-center"} />
</View>
);
}