summaryrefslogtreecommitdiff
path: root/components/login
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-07-16 11:59:08 +0700
committerpolwex <polwex@sortug.com>2025-07-16 11:59:08 +0700
commit9c2fba56e0f68f976c1abe486f9fd3c6e93b437e (patch)
tree22470efb92a9f1b673136d7c0bdadc06abb3ba35 /components/login
parent8ae0d2779c26f74e64a1db2b028bd2ac2f599cb4 (diff)
'm'
Diffstat (limited to 'components/login')
-rw-r--r--components/login/ShipCredsForm.tsx39
1 files changed, 38 insertions, 1 deletions
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 });
@@ -65,6 +96,12 @@ export function ShipForm() {
isLoading={isLoading}
/>
<PrimaryButton
+ label="Make Passkey"
+ onPress={makePk}
+ style={{ marginTop: 0 }}
+ isLoading={isLoading}
+ />
+ <PrimaryButton
label="Encrypt"
onPress={enc}
style={{ marginTop: 0 }}