Send support for Sender Key
This commit is contained in:
parent
d8417e562b
commit
e6f1ec2b6b
30 changed files with 2290 additions and 911 deletions
|
@ -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,
|
||||
});
|
||||
})();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue