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

@ -4,7 +4,6 @@ import {
base64ToBytes,
ConnectionState,
MTPClient,
MTPProtocolError,
} from "mtp";
import createAsyncQueue from "@tensamin/shared/asyncQueue";
import {
@ -22,7 +21,6 @@ import {
type MTPContextType,
type ProtocolMessage,
removeMissingContacts,
sealedRelayResultFromFrame,
type SealedRelaySend,
useMessageHandlers,
} from "./mtpContext";
@ -212,16 +210,13 @@ export function BrowserProvider(props: {
() => async (type, data, options) => {
const client = clientRef.current;
if (!client) throw new Error("mtp is not connected");
try {
return sealedRelayResultFromFrame(
await client.requestSealedRelay(type, data, options),
);
} catch (error) {
if (error instanceof MTPProtocolError) {
return sealedRelayResultFromFrame(error.frame);
}
throw error;
}
await client.sendSealedRelay(type, data, {
nextHopId: options.nextHop.id,
finalRecipientId: options.finalRecipientId,
metadataRecipients: options.metadataRecipients,
contentRecipients: options.contentRecipients,
});
return { type: "Success", data: {} };
},
[],
);