Fetch PNI group credentials

This commit is contained in:
Fedor Indutny 2022-07-08 13:46:25 -07:00 committed by GitHub
parent b9ba732724
commit a450e13a99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 1911 additions and 875 deletions

View file

@ -205,6 +205,7 @@ const dataInterface: ClientInterface = {
updateConversations,
removeConversation,
updateAllConversationColors,
removeAllProfileKeyCredentials,
getAllConversations,
getAllConversationIds,
@ -1161,7 +1162,7 @@ async function getMessageBySender({
sent_at,
}: {
source: string;
sourceUuid: string;
sourceUuid: UUIDStringType;
sourceDevice: number;
sent_at: number;
}) {
@ -1271,7 +1272,7 @@ async function getOlderStories(options: {
limit?: number;
receivedAt?: number;
sentAt?: number;
sourceUuid?: string;
sourceUuid?: UUIDStringType;
}): Promise<Array<MessageType>> {
return channels.getOlderStories(options);
}
@ -1794,6 +1795,10 @@ async function updateAllConversationColors(
);
}
async function removeAllProfileKeyCredentials(): Promise<void> {
return channels.removeAllProfileKeyCredentials();
}
function getMaxMessageCounter(): Promise<number | undefined> {
return channels.getMaxMessageCounter();
}

View file

@ -202,7 +202,7 @@ export type UnprocessedType = {
messageAgeSec?: number;
source?: string;
sourceUuid?: string;
sourceUuid?: UUIDStringType;
sourceDevice?: number;
destinationUuid?: string;
serverGuid?: string;
@ -213,7 +213,7 @@ export type UnprocessedType = {
export type UnprocessedUpdateType = {
source?: string;
sourceUuid?: string;
sourceUuid?: UUIDStringType;
sourceDevice?: number;
serverGuid?: string;
serverTimestamp?: number;
@ -257,8 +257,8 @@ export type StoryDistributionWithMembersType = Readonly<
export type StoryReadType = Readonly<{
authorId: UUIDStringType;
conversationId: UUIDStringType;
storyId: UUIDStringType;
conversationId: string;
storyId: string;
storyReadDate: number;
}>;
@ -362,6 +362,7 @@ export type DataInterface = {
value: CustomColorType;
}
) => Promise<void>;
removeAllProfileKeyCredentials: () => Promise<void>;
getAllConversations: () => Promise<Array<ConversationType>>;
getAllConversationIds: () => Promise<Array<string>>;
@ -439,7 +440,7 @@ export type DataInterface = {
_removeAllReactions: () => Promise<void>;
getMessageBySender: (options: {
source: string;
sourceUuid: string;
sourceUuid: UUIDStringType;
sourceDevice: number;
sent_at: number;
}) => Promise<MessageType | undefined>;
@ -462,7 +463,7 @@ export type DataInterface = {
limit?: number;
receivedAt?: number;
sentAt?: number;
sourceUuid?: string;
sourceUuid?: UUIDStringType;
}) => Promise<Array<MessageType>>;
// getNewerMessagesByConversation is JSON on server, full message on Client
getMessageMetricsForConversation: (

View file

@ -200,6 +200,7 @@ const dataInterface: ServerInterface = {
updateConversations,
removeConversation,
updateAllConversationColors,
removeAllProfileKeyCredentials,
getAllConversations,
getAllConversationIds,
@ -2033,7 +2034,7 @@ async function getMessageBySender({
sent_at,
}: {
source: string;
sourceUuid: string;
sourceUuid: UUIDStringType;
sourceDevice: number;
sent_at: number;
}): Promise<MessageType | undefined> {
@ -2443,7 +2444,7 @@ async function getOlderStories({
limit?: number;
receivedAt?: number;
sentAt?: number;
sourceUuid?: string;
sourceUuid?: UUIDStringType;
}): Promise<Array<MessageType>> {
const db = getInstance();
const rows: JSONRows = db
@ -5067,3 +5068,15 @@ async function updateAllConversationColors(
}),
});
}
async function removeAllProfileKeyCredentials(): Promise<void> {
const db = getInstance();
db.exec(
`
UPDATE conversations
SET
json = json_remove(json, '$.profileKeyCredential')
`
);
}