feat(user): rename to identity
Some checks failed
/ build-web (push) Successful in 4m1s
/ release (push) Has been cancelled
/ build-mobile (push) Has been cancelled
/ build-desktop (linux) (push) Has been cancelled

feat(identity): add getIota function with caching
This commit is contained in:
Alois 2026-08-30 19:26:42 +02:00
commit 042141c781
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
40 changed files with 613 additions and 668 deletions

View file

@ -32,7 +32,7 @@
"@tensamin/storage": "workspace:*",
"@tensamin/tauri": "workspace:*",
"@tensamin/tauth": "workspace:*",
"@tensamin/user": "workspace:*",
"@tensamin/identity": "workspace:*",
"decimal.js-light": "^2.5.1",
"eventemitter3": "^5.0.4",
"lucide-react": "^1.29.0",

View file

@ -1,4 +1,4 @@
import type { User } from "@tensamin/user/context";
import type { User } from "@tensamin/identity/context";
import {
Avatar,
AvatarImage,

View file

@ -1,4 +1,4 @@
import type { User } from "@tensamin/user/context";
import type { User } from "@tensamin/identity/context";
import { Avatar, AvatarFallback, AvatarImage, Button } from "@methanium/ui";
import { Text } from "@methanium/ui/markdown";
import { ChevronDown, ChevronUp } from "lucide-react";

View file

@ -15,7 +15,7 @@ import {
} from "lucide-react";
import { useLocation, useNavigate, useSearch } from "@tanstack/react-router";
import { joinCall, useCall } from "@tensamin/call/store";
import Wrapper from "@tensamin/user/wrapper";
import Wrapper from "@tensamin/identity/wrapper";
import { Skeleton } from "@methanium/ui";
import {
Select,

View file

@ -1,4 +1,4 @@
import Wrapper from "@tensamin/user/wrapper";
import Wrapper from "@tensamin/identity/wrapper";
import { Basic, Loading } from "./modals/basic";
import List from "@/features/conversation/list/body";
@ -34,7 +34,7 @@ import SidebarBox from "@tensamin/call/sidebarBox";
import { useShowMobileNavbar } from "@/routes/app/useShowMobileNavbar";
import { Ellipsis, Check } from "lucide-react";
import { useState } from "react";
import { useUser, type User } from "@tensamin/user/context";
import { useUser, type User } from "@tensamin/identity/context";
import { mtp, userPresencePreferenceSchema } from "@tensamin/shared/data";
import { useMTP } from "@tensamin/mtp";
import {

View file

@ -1,5 +1,5 @@
import { Basic, Loading } from "@/components/modals/basic";
import Wrapper from "@tensamin/user/wrapper";
import Wrapper from "@tensamin/identity/wrapper";
import {
ContextMenu,
ContextMenuContent,

View file

@ -26,7 +26,7 @@ import ChatContext from "@tensamin/chat/context";
import { useCall, useInitializeCall } from "@tensamin/call/store";
import { useIsSpeaking } from "@tensamin/call/speakingState";
import { Provider as MTPProvider } from "@tensamin/mtp";
import UserProvider from "@tensamin/user/context";
import UserProvider from "@tensamin/identity/context";
import DeeplinkContext, { useDeeplinks } from "@tensamin/tauri/deeplinkHandler";
import NotificationsProvider from "@tensamin/notifications/context";
import PwaRuntime from "@tensamin/pwa/runtime";

View file

@ -20,6 +20,7 @@ import { isTauri } from "@tauri-apps/api/core";
import { useSession } from "@tensamin/storage/session";
import { useStorage } from "@tensamin/storage/context";
import { ShieldAlert } from "lucide-react";
import { useUser } from "@tensamin/identity/context";
// The page
export default function Page() {
@ -56,6 +57,7 @@ function AddConversationButton() {
const { send, sendSealedRelay } = useMTP();
const { contacts, insertContact } = useSession();
const { load } = useStorage();
const { getIota } = useUser();
const [loading, setLoading] = useState(false);
const [open, setOpen] = useState(false);
const [error, setError] = useState<string | null>(null);
@ -110,23 +112,15 @@ function AddConversationButton() {
try {
const userId = await load("user_id");
const iota = await send("GetIotaData", { UserId: userId });
if (iota.type !== "GetIotaData") {
setError(`Iota lookup failed: ${iota.type}`);
return;
}
const iota = await getIota(userId);
const response = await sendSealedRelay(
"AddConversation",
{ ChatPartnerId: user.data.UserId },
{
nextHop: { kind: "iota", id: iota.data.IotaId },
nextHop: { kind: "iota", id: iota.IotaId },
finalRecipientId: userId,
metadataRecipients: [
{ value: iota.data.PublicKey, encoding: "base64" },
],
contentRecipients: [
{ value: iota.data.PublicKey, encoding: "base64" },
],
metadataRecipients: [{ value: iota.PublicKey, encoding: "base64" }],
contentRecipients: [{ value: iota.PublicKey, encoding: "base64" }],
},
);
requireRelaySuccess(response);

View file

@ -65,7 +65,7 @@ export default defineConfig({
"@tensamin/settings",
"@tensamin/storage",
"@tensamin/mtp",
"@tensamin/user",
"@tensamin/identity",
"@tensamin/tauri",
"@tensamin/chat",
],
@ -118,7 +118,7 @@ export default defineConfig({
"@tensamin/storage/context",
"@tensamin/tauri",
"@tensamin/tauth",
"@tensamin/user",
"@tensamin/identity",
],
},
build: {