From 9c2fba56e0f68f976c1abe486f9fd3c6e93b437e Mon Sep 17 00:00:00 2001
From: polwex <polwex@sortug.com>
Date: Wed, 16 Jul 2025 11:59:08 +0700
Subject: 'm'

---
 components/login/ShipCredsForm.tsx | 39 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

(limited to 'components/login/ShipCredsForm.tsx')

diff --git a/components/login/ShipCredsForm.tsx b/components/login/ShipCredsForm.tsx
index ac58e86..d84a474 100644
--- a/components/login/ShipCredsForm.tsx
+++ b/components/login/ShipCredsForm.tsx
@@ -9,8 +9,15 @@ import {
 } from "react-native";
 import PrimaryButton from "../PrimaryButton";
 import { useState } from "react";
-import { createFancyPasskey, pkDecrypt, pkEncrypt } from "@/lib/passkey";
+import {
+  createFancyPasskey,
+  createPasskey,
+  pkDecrypt,
+  pkEncrypt,
+} from "@/lib/passkey";
 import toast, { Toaster } from "react-hot-toast";
+import { makeWalletFromP } from "@/lib/urbit/wallet";
+import { hex2buf } from "@/lib/utils/bit";
 
 export function ShipForm() {
   const colors = lightColors;
@@ -20,11 +27,35 @@ export function ShipForm() {
   const [encryptedTicket, setenc] = useState("");
   const [isLoading, setIsLoading] = useState(false);
   async function onSubmit() {
+    const wallet = await makeWalletFromP(patp, ticket);
+    console.log("seed", wallet.ownership.seed);
+    const privkey = wallet.ownership.keys.private;
+    const clean = privkey.replace(/^0x/i, "");
+    const byteLength = clean.length / 2;
+    toast(`bytes: ${byteLength}`);
+    const bufer = hex2buf(privkey);
+    toast(`buffer size: ${bufer.byteLength}`);
+    const ba = Uint8Array.fromHex(clean);
+    toast(`uintarray byte length: ${ba.byteLength}`);
+    console.log({
+      bufl: bufer.length,
+      bufbl: bufer.byteLength,
+      ul: ba.length,
+      ubl: ba.byteLength,
+    });
+  }
+  async function makeFPk() {
     console.log("running", { patp, ticket });
     const passkey = await createFancyPasskey();
     console.log({ passkey });
     toast(passkey);
   }
+  async function makePk() {
+    console.log("running", { patp, ticket });
+    const passkey = await createPasskey();
+    if ("error" in passkey) return toast.error(passkey.error);
+    console.log({ passkey });
+  }
   async function enc() {
     const done = await pkEncrypt(ticket);
     console.log({ encryptedTicket });
@@ -64,6 +95,12 @@ export function ShipForm() {
         style={{ marginTop: 0 }}
         isLoading={isLoading}
       />
+      <PrimaryButton
+        label="Make Passkey"
+        onPress={makePk}
+        style={{ marginTop: 0 }}
+        isLoading={isLoading}
+      />
       <PrimaryButton
         label="Encrypt"
         onPress={enc}
-- 
cgit v1.2.3

