blob: 098c8b716008e202e4acdd0441a2ca3438715d0e (
plain)
1
|
{"version":3,"file":"crypto-api.js","names":[],"sources":["../src/crypto-api.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport type { IMegolmSessionData } from \"./@types/crypto\";\nimport { Room } from \"./models/room\";\n\n/**\n * Public interface to the cryptography parts of the js-sdk\n *\n * @remarks Currently, this is a work-in-progress. In time, more methods will be added here.\n */\nexport interface CryptoApi {\n /**\n * Global override for whether the client should ever send encrypted\n * messages to unverified devices. This provides the default for rooms which\n * do not specify a value.\n *\n * If true, all unverified devices will be blacklisted by default\n */\n globalBlacklistUnverifiedDevices: boolean;\n\n /**\n * Checks if the user has previously published cross-signing keys\n *\n * This means downloading the devicelist for the user and checking if the list includes\n * the cross-signing pseudo-device.\n *\n * @returns true if the user has previously published cross-signing keys\n */\n userHasCrossSigningKeys(): Promise<boolean>;\n\n /**\n * Perform any background tasks that can be done before a message is ready to\n * send, in order to speed up sending of the message.\n *\n * @param room - the room the event is in\n */\n prepareToEncrypt(room: Room): void;\n\n /**\n * Discard any existing megolm session for the given room.\n *\n * This will ensure that a new session is created on the next call to {@link prepareToEncrypt},\n * or the next time a message is sent.\n *\n * This should not normally be necessary: it should only be used as a debugging tool if there has been a\n * problem with encryption.\n *\n * @param roomId - the room to discard sessions for\n */\n forceDiscardSession(roomId: string): Promise<void>;\n\n /**\n * Get a list containing all of the room keys\n *\n * This should be encrypted before returning it to the user.\n *\n * @returns a promise which resolves to a list of\n * session export objects\n */\n exportRoomKeys(): Promise<IMegolmSessionData[]>;\n}\n"],"mappings":""}
|