From 5159b20b0888af32116460af3eb29eee2979ffa4 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 22 Aug 2023 15:35:11 +0100 Subject: [PATCH 1/2] Export de-facto public types out of @types --- src/matrix.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/matrix.ts b/src/matrix.ts index 9d3049399b7..26ca8c36b18 100644 --- a/src/matrix.ts +++ b/src/matrix.ts @@ -60,6 +60,18 @@ export * from "./@types/PushRules"; export * from "./@types/partials"; export * from "./@types/requests"; export * from "./@types/search"; +export * from "./@types/beacon"; +export * from "./@types/topic"; +export * from "./@types/location"; +export * from "./@types/threepids"; +export * from "./@types/auth"; +export * from "./@types/polls"; +export * from "./@types/local_notifications"; +export * from "./@types/registration"; +export * from "./@types/read_receipts"; +export * from "./@types/crypto"; +export * from "./@types/extensible_events"; +export * from "./@types/IIdentityServerProvider"; export * from "./models/room-summary"; export * from "./models/event-status"; export * as ContentHelpers from "./content-helpers"; From d4a03d92611fb2b4a5f5c8e896b2ba80a5247d1b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 22 Aug 2023 15:48:51 +0100 Subject: [PATCH 2/2] Make typedoc happier --- src/@types/crypto.ts | 30 ++------------------------- src/common-crypto/CryptoBackend.ts | 33 +++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/@types/crypto.ts b/src/@types/crypto.ts index 77118401436..010882966f4 100644 --- a/src/@types/crypto.ts +++ b/src/@types/crypto.ts @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -import type { IClearEvent } from "../models/event"; import type { ISignatures } from "./signed"; export type OlmGroupSessionExtraData = { @@ -22,33 +21,8 @@ export type OlmGroupSessionExtraData = { sharedHistory?: boolean; }; -/** - * The result of a (successful) call to {@link Crypto.decryptEvent} - */ -export interface IEventDecryptionResult { - /** - * The plaintext payload for the event (typically containing type and content fields). - */ - clearEvent: IClearEvent; - /** - * List of curve25519 keys involved in telling us about the senderCurve25519Key and claimedEd25519Key. - * See {@link MatrixEvent#getForwardingCurve25519KeyChain}. - */ - forwardingCurve25519KeyChain?: string[]; - /** - * Key owned by the sender of this event. See {@link MatrixEvent#getSenderKey}. - */ - senderCurve25519Key?: string; - /** - * ed25519 key claimed by the sender of this event. See {@link MatrixEvent#getClaimedEd25519Key}. - */ - claimedEd25519Key?: string; - untrusted?: boolean; - /** - * The sender doesn't authorize the unverified devices to decrypt his messages - */ - encryptedDisabledForUnverifiedDevices?: boolean; -} +// Backwards compatible re-export +export type { EventDecryptionResult as IEventDecryptionResult } from "../common-crypto/CryptoBackend"; interface Extensible { [key: string]: any; diff --git a/src/common-crypto/CryptoBackend.ts b/src/common-crypto/CryptoBackend.ts index b99410d0749..0340d2522ad 100644 --- a/src/common-crypto/CryptoBackend.ts +++ b/src/common-crypto/CryptoBackend.ts @@ -15,12 +15,11 @@ limitations under the License. */ import type { IDeviceLists, IToDeviceEvent } from "../sync-accumulator"; -import { MatrixEvent } from "../models/event"; +import { IClearEvent, MatrixEvent } from "../models/event"; import { Room } from "../models/room"; import { CryptoApi } from "../crypto-api"; import { CrossSigningInfo, UserTrustLevel } from "../crypto/CrossSigning"; import { IEncryptedEventInfo } from "../crypto/api"; -import { IEventDecryptionResult } from "../@types/crypto"; /** * Common interface for the crypto implementations @@ -71,7 +70,7 @@ export interface CryptoBackend extends SyncCryptoCallbacks, CryptoApi { * @returns a promise which resolves once we have finished decrypting. * Rejects with an error if there is a problem decrypting the event. */ - decryptEvent(event: MatrixEvent): Promise; + decryptEvent(event: MatrixEvent): Promise; /** * Get information about the encryption of an event @@ -181,3 +180,31 @@ export interface OnSyncCompletedData { export interface CheckOwnCrossSigningTrustOpts { allowPrivateKeyRequests?: boolean; } + +/** + * The result of a (successful) call to {@link CryptoBackend.decryptEvent} + */ +export interface EventDecryptionResult { + /** + * The plaintext payload for the event (typically containing type and content fields). + */ + clearEvent: IClearEvent; + /** + * List of curve25519 keys involved in telling us about the senderCurve25519Key and claimedEd25519Key. + * See {@link MatrixEvent#getForwardingCurve25519KeyChain}. + */ + forwardingCurve25519KeyChain?: string[]; + /** + * Key owned by the sender of this event. See {@link MatrixEvent#getSenderKey}. + */ + senderCurve25519Key?: string; + /** + * ed25519 key claimed by the sender of this event. See {@link MatrixEvent#getClaimedEd25519Key}. + */ + claimedEd25519Key?: string; + untrusted?: boolean; + /** + * The sender doesn't authorize the unverified devices to decrypt his messages + */ + encryptedDisabledForUnverifiedDevices?: boolean; +}