Add historical DM decryption

This commit is contained in:
Jack Kingsman
2026-01-18 21:22:22 -08:00
parent 30e3eb47be
commit 42572aa234
22 changed files with 1761 additions and 53 deletions
+1
View File
@@ -137,6 +137,7 @@ await api.sendAdvertisement(true);
// Contacts/Channels
await api.getContacts();
await api.createContact(publicKey, name, tryHistorical); // Create contact, optionally decrypt historical DMs
await api.getChannels();
await api.createChannel('#test');
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -13,7 +13,7 @@
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
<script type="module" crossorigin src="/assets/index-C-0BydkT.js"></script>
<script type="module" crossorigin src="/assets/index-Ck-mz-Y8.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CcSjAzwK.css">
</head>
<body>
+5 -22
View File
@@ -467,32 +467,15 @@ export function App() {
// Create contact handler
const handleCreateContact = useCallback(
async (name: string, publicKey: string, tryHistorical: boolean) => {
const newContact: Contact = {
public_key: publicKey,
name,
type: 0,
flags: 0,
last_path: null,
last_path_len: -1,
last_advert: null,
lat: null,
lon: null,
last_seen: null,
on_radio: false,
last_contacted: null,
last_read_at: null,
};
setContacts((prev) => [...prev, newContact]);
const created = await api.createContact(publicKey, name || undefined, tryHistorical);
const data = await api.getContacts();
setContacts(data);
setActiveConversation({
type: 'contact',
id: publicKey,
name: getContactDisplayName(name, publicKey),
id: created.public_key,
name: getContactDisplayName(created.name, created.public_key),
});
if (tryHistorical) {
console.log('Contact historical decryption not yet supported');
}
},
[]
);
+5
View File
@@ -94,6 +94,11 @@ export const api = {
fetchJson<{ status: string }>(`/contacts/${publicKey}`, {
method: 'DELETE',
}),
createContact: (publicKey: string, name?: string, tryHistorical?: boolean) =>
fetchJson<Contact>('/contacts', {
method: 'POST',
body: JSON.stringify({ public_key: publicKey, name, try_historical: tryHistorical }),
}),
markContactRead: (publicKey: string) =>
fetchJson<{ status: string; public_key: string }>(`/contacts/${publicKey}/mark-read`, {
method: 'POST',