UNPKG

@towns-protocol/sdk

Version:

For more details, visit the following resources:

52 lines 2.85 kB
import { GroupEncryptionCrypto, UserDevice } from '@towns-protocol/encryption'; import { BaseDecryptionExtensions, DecryptionExtensionsOptions, DecryptionSessionError, EncryptedContentItem, EntitlementsDelegate, GroupSessionsData, KeyFulfilmentData, KeySolicitationContent, KeySolicitationData, KeySolicitationItem } from './decryptionExtensions'; import { EncryptedData, UserInboxPayload_GroupEncryptionSessions } from '@towns-protocol/proto'; import { Client } from './client'; export declare class ClientDecryptionExtensions extends BaseDecryptionExtensions { private readonly client; private isMobileSafariBackgrounded; private validatedEvents; private unpackEnvelopeOpts?; constructor(client: Client, crypto: GroupEncryptionCrypto, delegate: EntitlementsDelegate, userId: string, userDevice: UserDevice, unpackEnvelopeOpts: { disableSignatureValidation?: boolean; } | undefined, logId: string, opts: DecryptionExtensionsOptions); hasStream(streamId: string): boolean; isUserInboxStreamUpToDate(upToDateStreams: Set<string>): boolean; shouldPauseTicking(): boolean; decryptGroupEvent(streamId: string, eventId: string, kind: string, // kind of data encryptedData: EncryptedData): Promise<void>; downloadNewMessages(): Promise<void>; getKeySolicitations(streamId: string): KeySolicitationContent[]; /** * Override the default implementation to use the number of members in the stream * to determine the delay time. */ getRespondDelayMSForKeySolicitation(streamId: string, userId: string, opts: { ephemeral: boolean; }): number; isUserEntitledToKeyExchange(streamId: string, userId: string, opts?: { skipOnChainValidation: boolean; }): Promise<boolean>; isValidEvent(item: KeySolicitationItem): { isValid: boolean; reason?: string; }; onDecryptionError(item: EncryptedContentItem, err: DecryptionSessionError): void; ackNewGroupSession(_session: UserInboxPayload_GroupEncryptionSessions): Promise<void>; encryptAndShareGroupSessions({ streamId, item, sessions, algorithm, }: GroupSessionsData): Promise<void>; sendKeySolicitation({ streamId, isNewDevice, missingSessionIds, ephemeral, }: KeySolicitationData & { ephemeral?: boolean; }): Promise<void>; sendKeyFulfillment({ streamId, userAddress, deviceKey, sessionIds, ephemeral, }: KeyFulfilmentData & { ephemeral?: boolean; }): Promise<{ error?: unknown; }>; uploadDeviceKeys(): Promise<void>; onStart(): void; onStop(): Promise<void>; private mobileSafariPageVisibilityChanged; private convertEphemeralToNonEphemeral; getPriorityForStream(streamId: string, highPriorityIds: Set<string>, recentStreamIds: Set<string>): number; } //# sourceMappingURL=clientDecryptionExtensions.d.ts.map