From 6bdbee533ca3c54a2744d2caf744fc1b728dc7de Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Mon, 14 Sep 2020 18:53:48 -0400 Subject: [PATCH] TypeScript and doc fixes --- src/@types/global.d.ts | 6 ++++++ src/client.js | 8 ++++---- src/matrix.ts | 30 ++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index c8a131443..2f541ee99 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -14,12 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. */ +import * as Olm from "olm"; + export {}; declare global { namespace NodeJS { interface Global { localStorage: Storage; + Olm: Olm; } } + interface Global { + Olm: Olm; + } } diff --git a/src/client.js b/src/client.js index 5651dece6..a1bb0dec0 100644 --- a/src/client.js +++ b/src/client.js @@ -248,12 +248,12 @@ function keyFromRecoverySession(session, decryptionKey) { * device. * Args: * {string} name The name of the secret being requested. - * {string} user_id (string) The user ID of the client requesting - * {string} device_id The device ID of the client requesting the secret. - * {string} request_id The ID of the request. Used to match a + * {string} userId The user ID of the client requesting + * {string} deviceId The device ID of the client requesting the secret. + * {string} requestId The ID of the request. Used to match a * corresponding `crypto.secrets.request_cancelled`. The request ID will be * unique per sender, device pair. - * {DeviceTrustLevel} device_trust: The trust status of the device requesting + * {DeviceTrustLevel} deviceTrust: The trust status of the device requesting * the secret as returned by {@link module:client~MatrixClient#checkDeviceTrust}. */ export function MatrixClient(opts) { diff --git a/src/matrix.ts b/src/matrix.ts index 46c009f2b..eabafe94f 100644 --- a/src/matrix.ts +++ b/src/matrix.ts @@ -121,11 +121,41 @@ interface ICreateClientOpts { scheduler?: MatrixScheduler; request?: Request; userId?: string; + deviceId?: string; accessToken?: string; identityServer?: any; localTimeoutMs?: number; useAuthorizationHeader?: boolean; queryParams?: Record; + deviceToImport?: { + olmDevice: { + pickledAccount: string; + sessions: Array>; + pickleKey: string; + }; + userId: string; + deviceId: string; + }; + sessionStore?: any; + unstableClientRelationAggregation?: boolean; + verificationMethods?: Array; + forceTURN?: boolean; + fallbackICEServerAllowed?: boolean; + cryptoCallbacks?: { + getCrossSigningKey?: (keyType: string, pubKey: Uint8Array) => Promise; + saveCrossSigningKeys?: (keys: Record) => unknown; + shouldUpgradeDeviceVerifications?: ( + users: Record + ) => Promise>; + getSecretStorageKey?: ( + keys: {keys: Record}, name: string + ) => Promise<[string, Uint8Array] | null>; + cacheSecretStorageKey?: (keyId: string, key: Uint8Array) => unknown; + onSecretRequested?: ( + name: string, userId: string, deviceId: string, + requestId: string, deviceTrust: any + ) => Promise; + }; } /**