{"version":3,"file":"keybackup.js","names":[],"sources":["../../src/crypto/keybackup.ts"],"sourcesContent":["/*\nCopyright 2021 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 { ISigned } from \"../@types/signed\";\nimport { IEncryptedPayload } from \"./aes\";\n\nexport interface Curve25519SessionData {\n ciphertext: string;\n ephemeral: string;\n mac: string;\n}\n\n/* eslint-disable camelcase */\nexport interface IKeyBackupSession {\n first_message_index: number;\n forwarded_count: number;\n is_verified: boolean;\n session_data: T;\n}\n\nexport interface IKeyBackupRoomSessions {\n [sessionId: string]: IKeyBackupSession;\n}\n\nexport interface ICurve25519AuthData {\n public_key: string;\n private_key_salt?: string;\n private_key_iterations?: number;\n private_key_bits?: number;\n}\n\nexport interface IAes256AuthData {\n iv: string;\n mac: string;\n private_key_salt?: string;\n private_key_iterations?: number;\n}\n\nexport interface IKeyBackupInfo {\n algorithm: string;\n auth_data: ISigned & (ICurve25519AuthData | IAes256AuthData);\n count?: number;\n etag?: string;\n version?: string; // number contained within\n}\n/* eslint-enable camelcase */\n\nexport interface IKeyBackupPrepareOpts {\n /**\n * Whether to use Secure Secret Storage to store the key encrypting key backups.\n * Optional, defaults to false.\n */\n secureSecretStorage: boolean;\n}\n\nexport interface IKeyBackupRestoreResult {\n total: number;\n imported: number;\n}\n\nexport interface IKeyBackupRestoreOpts {\n cacheCompleteCallback?: () => void;\n progressCallback?: (progress: { stage: string }) => void;\n}\n"],"mappings":""}