fix: only use the private key, not extended
This commit is contained in:
parent
da80872c3c
commit
dfe87396b9
|
@ -6,14 +6,18 @@ import {
|
||||||
import { useLume } from "../LumeProvider";
|
import { useLume } from "../LumeProvider";
|
||||||
import React, { useContext } from "react";
|
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() {
|
export function useLumeIndentity() {
|
||||||
const { isLoggedIn, setIsLoggedIn } = useLume();
|
const { isLoggedIn, setIsLoggedIn } = useLume();
|
||||||
const ctx = useContext(LumeIdentityContext);
|
const ctx = useContext(LumeIdentityContext);
|
||||||
|
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
throw new Error("useLumeIdentity should be used inside LumeIdentityContext.Provider")
|
throw new Error(
|
||||||
|
"useLumeIdentity should be used inside LumeIdentityContext.Provider",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { setOpen } = ctx;
|
const { setOpen } = ctx;
|
||||||
|
@ -21,7 +25,7 @@ export function useLumeIndentity() {
|
||||||
return {
|
return {
|
||||||
isSignedIn: isLoggedIn,
|
isSignedIn: isLoggedIn,
|
||||||
async signIn(key: Uint8Array) {
|
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') `
|
// await loginComplete(); # this function is buggy `auth.ts:42 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'promise') `
|
||||||
setIsLoggedIn(true);
|
setIsLoggedIn(true);
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
|
Loading…
Reference in New Issue