From dfe87396b9770a8c37d22bd7d30c0904bd16082c Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 12 Oct 2023 05:02:33 -0400 Subject: [PATCH] fix: only use the private key, not extended --- .../lume/LumeIdentity/LumeIdentityContext.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/lume/LumeIdentity/LumeIdentityContext.ts b/src/components/lume/LumeIdentity/LumeIdentityContext.ts index f87ab1c..7c595c3 100644 --- a/src/components/lume/LumeIdentity/LumeIdentityContext.ts +++ b/src/components/lume/LumeIdentity/LumeIdentityContext.ts @@ -6,22 +6,26 @@ import { import { useLume } from "../LumeProvider"; import React, { useContext } from "react"; -export const LumeIdentityContext = React.createContext<{open: boolean, setOpen: (open: boolean) => void} | undefined>(undefined); +export const LumeIdentityContext = React.createContext< + { open: boolean; setOpen: (open: boolean) => void } | undefined +>(undefined); export function useLumeIndentity() { - const {isLoggedIn, setIsLoggedIn} = useLume(); - const ctx = useContext(LumeIdentityContext); + const { isLoggedIn, setIsLoggedIn } = useLume(); + const ctx = useContext(LumeIdentityContext); - if(!ctx) { - throw new Error("useLumeIdentity should be used inside LumeIdentityContext.Provider") + if (!ctx) { + throw new Error( + "useLumeIdentity should be used inside LumeIdentityContext.Provider", + ); } - const {setOpen} = ctx; + const { setOpen } = ctx; return { isSignedIn: isLoggedIn, async signIn(key: Uint8Array) { - await login(key); + await login(key.slice(0, 32)); // await loginComplete(); # this function is buggy `auth.ts:42 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'promise') ` setIsLoggedIn(true); setOpen(false);