From 86b2cd1f8295ebbef3767a40e2716bf55b9c661e Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 27 Nov 2020 11:11:11 +0000 Subject: [PATCH] Use typeof in customisations to avoid repeating --- src/customisations/Security.ts | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/customisations/Security.ts b/src/customisations/Security.ts index eb7c27dcc5..96b5b62cdb 100644 --- a/src/customisations/Security.ts +++ b/src/customisations/Security.ts @@ -67,24 +67,13 @@ function setupEncryptionNeeded(kind: SetupEncryptionKind): boolean { // them all as optional. This allows customisers to only define and export the // customisations they need while still maintaining type safety. export interface ISecurityCustomisations { - examineLoginResponse?: ( - response: any, - credentials: IMatrixClientCreds, - ) => void; - persistCredentials?: ( - credentials: IMatrixClientCreds, - ) => void; - createSecretStorageKey?: () => Uint8Array, - getSecretStorageKey?: () => Uint8Array, - catchAccessSecretStorageError?: ( - e: Error, - ) => void, - setupEncryptionNeeded?: ( - kind: SetupEncryptionKind, - ) => boolean, - getDehydrationKey?: ( - keyInfo: ISecretStorageKeyInfo, - ) => Promise, + examineLoginResponse?: typeof examineLoginResponse; + persistCredentials?: typeof persistCredentials; + createSecretStorageKey?: typeof createSecretStorageKey, + getSecretStorageKey?: typeof getSecretStorageKey, + catchAccessSecretStorageError?: typeof catchAccessSecretStorageError, + setupEncryptionNeeded?: typeof setupEncryptionNeeded, + getDehydrationKey?: typeof getDehydrationKey, } // A real customisation module will define and export one or more of the