UUID-keyed lookups in SignalProtocolStore
This commit is contained in:
parent
6323aedd9b
commit
c7e7d55af4
46 changed files with 2094 additions and 1447 deletions
|
@ -19,6 +19,8 @@ import type { ProcessGroupCallRingRequestResult } from '../types/Calling';
|
|||
import { StorageAccessType } from '../types/Storage.d';
|
||||
import type { AttachmentType } from '../types/Attachment';
|
||||
import { BodyRangesType } from '../types/Util';
|
||||
import type { QualifiedAddressStringType } from '../types/QualifiedAddress';
|
||||
import type { UUIDStringType } from '../types/UUID';
|
||||
import type { RemoveAllConfiguration } from '../types/RemoveAllConfiguration';
|
||||
|
||||
export type AttachmentDownloadJobTypeType =
|
||||
|
@ -57,14 +59,17 @@ export type EmojiType = {
|
|||
shortName: string;
|
||||
lastUsage: number;
|
||||
};
|
||||
|
||||
export type IdentityKeyType = {
|
||||
firstUse: boolean;
|
||||
id: string;
|
||||
id: UUIDStringType | `conversation:${UUIDStringType}`;
|
||||
nonblockingApproval: boolean;
|
||||
publicKey: ArrayBuffer;
|
||||
timestamp: number;
|
||||
verified: number;
|
||||
};
|
||||
export type IdentityKeyIdType = IdentityKeyType['id'];
|
||||
|
||||
export type ItemKeyType = keyof StorageAccessType;
|
||||
export type AllItemsType = Partial<StorageAccessType>;
|
||||
export type ItemType<K extends ItemKeyType> = {
|
||||
|
@ -76,10 +81,13 @@ export type MessageTypeUnhydrated = {
|
|||
json: string;
|
||||
};
|
||||
export type PreKeyType = {
|
||||
id: number;
|
||||
id: `${UUIDStringType}:${number}`;
|
||||
keyId: number;
|
||||
ourUuid: UUIDStringType;
|
||||
privateKey: ArrayBuffer;
|
||||
publicKey: ArrayBuffer;
|
||||
};
|
||||
export type PreKeyIdType = PreKeyType['id'];
|
||||
export type SearchResultMessageType = {
|
||||
json: string;
|
||||
snippet: string;
|
||||
|
@ -114,7 +122,7 @@ export type SentMessageDBType = {
|
|||
|
||||
export type SenderKeyType = {
|
||||
// Primary key
|
||||
id: string;
|
||||
id: `${QualifiedAddressStringType}--${string}`;
|
||||
// These two are combined into one string to give us the final id
|
||||
senderId: string;
|
||||
distributionId: string;
|
||||
|
@ -122,21 +130,28 @@ export type SenderKeyType = {
|
|||
data: Buffer;
|
||||
lastUpdatedDate: number;
|
||||
};
|
||||
export type SenderKeyIdType = SenderKeyType['id'];
|
||||
export type SessionType = {
|
||||
id: string;
|
||||
id: QualifiedAddressStringType;
|
||||
ourUuid: UUIDStringType;
|
||||
uuid: UUIDStringType;
|
||||
conversationId: string;
|
||||
deviceId: number;
|
||||
record: string;
|
||||
version?: number;
|
||||
};
|
||||
export type SessionIdType = SessionType['id'];
|
||||
export type SignedPreKeyType = {
|
||||
confirmed: boolean;
|
||||
// eslint-disable-next-line camelcase
|
||||
created_at: number;
|
||||
id: number;
|
||||
ourUuid: UUIDStringType;
|
||||
id: `${UUIDStringType}:${number}`;
|
||||
keyId: number;
|
||||
privateKey: ArrayBuffer;
|
||||
publicKey: ArrayBuffer;
|
||||
};
|
||||
export type SignedPreKeyIdType = SignedPreKeyType['id'];
|
||||
|
||||
export type StickerType = Readonly<{
|
||||
id: number;
|
||||
|
@ -227,23 +242,27 @@ export type DataInterface = {
|
|||
removeIndexedDBFiles: () => Promise<void>;
|
||||
|
||||
createOrUpdateIdentityKey: (data: IdentityKeyType) => Promise<void>;
|
||||
getIdentityKeyById: (id: string) => Promise<IdentityKeyType | undefined>;
|
||||
getIdentityKeyById: (
|
||||
id: IdentityKeyIdType
|
||||
) => Promise<IdentityKeyType | undefined>;
|
||||
bulkAddIdentityKeys: (array: Array<IdentityKeyType>) => Promise<void>;
|
||||
removeIdentityKeyById: (id: string) => Promise<void>;
|
||||
removeIdentityKeyById: (id: IdentityKeyIdType) => Promise<void>;
|
||||
removeAllIdentityKeys: () => Promise<void>;
|
||||
getAllIdentityKeys: () => Promise<Array<IdentityKeyType>>;
|
||||
|
||||
createOrUpdatePreKey: (data: PreKeyType) => Promise<void>;
|
||||
getPreKeyById: (id: number) => Promise<PreKeyType | undefined>;
|
||||
getPreKeyById: (id: PreKeyIdType) => Promise<PreKeyType | undefined>;
|
||||
bulkAddPreKeys: (array: Array<PreKeyType>) => Promise<void>;
|
||||
removePreKeyById: (id: number) => Promise<void>;
|
||||
removePreKeyById: (id: PreKeyIdType) => Promise<void>;
|
||||
removeAllPreKeys: () => Promise<void>;
|
||||
getAllPreKeys: () => Promise<Array<PreKeyType>>;
|
||||
|
||||
createOrUpdateSignedPreKey: (data: SignedPreKeyType) => Promise<void>;
|
||||
getSignedPreKeyById: (id: number) => Promise<SignedPreKeyType | undefined>;
|
||||
getSignedPreKeyById: (
|
||||
id: SignedPreKeyIdType
|
||||
) => Promise<SignedPreKeyType | undefined>;
|
||||
bulkAddSignedPreKeys: (array: Array<SignedPreKeyType>) => Promise<void>;
|
||||
removeSignedPreKeyById: (id: number) => Promise<void>;
|
||||
removeSignedPreKeyById: (id: SignedPreKeyIdType) => Promise<void>;
|
||||
removeAllSignedPreKeys: () => Promise<void>;
|
||||
getAllSignedPreKeys: () => Promise<Array<SignedPreKeyType>>;
|
||||
|
||||
|
@ -254,10 +273,10 @@ export type DataInterface = {
|
|||
getAllItems: () => Promise<AllItemsType>;
|
||||
|
||||
createOrUpdateSenderKey: (key: SenderKeyType) => Promise<void>;
|
||||
getSenderKeyById: (id: string) => Promise<SenderKeyType | undefined>;
|
||||
getSenderKeyById: (id: SenderKeyIdType) => Promise<SenderKeyType | undefined>;
|
||||
removeAllSenderKeys: () => Promise<void>;
|
||||
getAllSenderKeys: () => Promise<Array<SenderKeyType>>;
|
||||
removeSenderKeyById: (id: string) => Promise<void>;
|
||||
removeSenderKeyById: (id: SenderKeyIdType) => Promise<void>;
|
||||
|
||||
insertSentProto: (
|
||||
proto: SentProtoType,
|
||||
|
@ -296,7 +315,7 @@ export type DataInterface = {
|
|||
unprocessed: Array<UnprocessedType>;
|
||||
}): Promise<void>;
|
||||
bulkAddSessions: (array: Array<SessionType>) => Promise<void>;
|
||||
removeSessionById: (id: string) => Promise<void>;
|
||||
removeSessionById: (id: SessionIdType) => Promise<void>;
|
||||
removeSessionsByConversation: (conversationId: string) => Promise<void>;
|
||||
removeAllSessions: () => Promise<void>;
|
||||
getAllSessions: () => Promise<Array<SessionType>>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue