mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Send support for Sender Key
This commit is contained in:
@@ -139,6 +139,7 @@ const dataInterface: ClientInterface = {
|
||||
getSenderKeyById,
|
||||
removeAllSenderKeys,
|
||||
getAllSenderKeys,
|
||||
removeSenderKeyById,
|
||||
|
||||
createOrUpdateSession,
|
||||
createOrUpdateSessions,
|
||||
@@ -759,6 +760,9 @@ async function removeAllSenderKeys(): Promise<void> {
|
||||
async function getAllSenderKeys(): Promise<Array<SenderKeyType>> {
|
||||
return channels.getAllSenderKeys();
|
||||
}
|
||||
async function removeSenderKeyById(id: string): Promise<void> {
|
||||
return channels.removeSenderKeyById(id);
|
||||
}
|
||||
|
||||
// Sessions
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@ export type DataInterface = {
|
||||
getSenderKeyById: (id: string) => Promise<SenderKeyType | undefined>;
|
||||
removeAllSenderKeys: () => Promise<void>;
|
||||
getAllSenderKeys: () => Promise<Array<SenderKeyType>>;
|
||||
removeSenderKeyById: (id: string) => Promise<void>;
|
||||
|
||||
createOrUpdateSession: (data: SessionType) => Promise<void>;
|
||||
createOrUpdateSessions: (array: Array<SessionType>) => Promise<void>;
|
||||
|
||||
@@ -130,6 +130,7 @@ const dataInterface: ServerInterface = {
|
||||
getSenderKeyById,
|
||||
removeAllSenderKeys,
|
||||
getAllSenderKeys,
|
||||
removeSenderKeyById,
|
||||
|
||||
createOrUpdateSession,
|
||||
createOrUpdateSessions,
|
||||
@@ -2215,6 +2216,10 @@ async function getAllSenderKeys(): Promise<Array<SenderKeyType>> {
|
||||
|
||||
return rows;
|
||||
}
|
||||
async function removeSenderKeyById(id: string): Promise<void> {
|
||||
const db = getInstance();
|
||||
prepare(db, 'DELETE FROM senderKeys WHERE id = $id').run({ id });
|
||||
}
|
||||
|
||||
const SESSIONS_TABLE = 'sessions';
|
||||
function createOrUpdateSessionSync(data: SessionType): void {
|
||||
@@ -4857,9 +4862,11 @@ async function removeAll(): Promise<void> {
|
||||
// Anything that isn't user-visible data
|
||||
async function removeAllConfiguration(): Promise<void> {
|
||||
const db = getInstance();
|
||||
const patch: Partial<ConversationType> = { senderKeyInfo: undefined };
|
||||
|
||||
db.transaction(() => {
|
||||
db.exec(`
|
||||
db.prepare(
|
||||
`
|
||||
DELETE FROM identityKeys;
|
||||
DELETE FROM items;
|
||||
DELETE FROM preKeys;
|
||||
@@ -4868,7 +4875,11 @@ async function removeAllConfiguration(): Promise<void> {
|
||||
DELETE FROM signedPreKeys;
|
||||
DELETE FROM unprocessed;
|
||||
DELETE FROM jobs;
|
||||
`);
|
||||
UPDATE conversations SET json = json_patch(json, $patch);
|
||||
`
|
||||
).run({
|
||||
$patch: patch,
|
||||
});
|
||||
})();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user