1
|
{"version":3,"file":"dehydration.js","names":["_anotherJson","_interopRequireDefault","require","_olmlib","_indexeddbCryptoStore","_aes","_logger","_httpApi","DEHYDRATION_ALGORITHM","exports","oneweek","DehydrationManager","constructor","crypto","_defineProperty2","default","getDehydrationKeyFromCache","cryptoStore","doTxn","IndexedDBCryptoStore","STORE_ACCOUNT","txn","getSecretStorePrivateKey","result","key","keyInfo","deviceDisplayName","time","pickleKey","Buffer","from","olmDevice","decrypted","decryptAES","decodeBase64","now","Date","delay","Math","max","timeoutId","global","setTimeout","dehydrateDevice","bind","setKeyAndQueueDehydration","matches","setKey","clearTimeout","undefined","storeSecretStorePrivateKey","length","i","inProgress","logger","log","encryptAES","encodeBase64","account","Olm","Account","create","e2eKeys","JSON","parse","identity_keys","maxKeys","max_number_of_one_time_keys","generate_one_time_keys","generate_fallback_key","otks","one_time_keys","fallbacks","fallback_key","mark_keys_as_published","pickledAccount","pickle","Uint8Array","deviceData","algorithm","passphrase","dehydrateResult","baseApis","http","authedRequest","Method","Put","device_data","initial_device_display_name","prefix","deviceId","device_id","deviceKeys","algorithms","supportedAlgorithms","user_id","userId","keys","ed25519","curve25519","deviceSignature","sign","anotherjson","stringify","signatures","crossSigningInfo","getId","signObject","oneTimeKeys","keyId","Object","entries","k","signature","fallbackKeys","fallback","Post","encodeURI","stop"],"sources":["../../src/crypto/dehydration.ts"],"sourcesContent":["/*\nCopyright 2020-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 anotherjson from \"another-json\";\n\nimport type { IDeviceKeys, IOneTimeKey } from \"../@types/crypto\";\nimport { decodeBase64, encodeBase64 } from \"./olmlib\";\nimport { IndexedDBCryptoStore } from \"../crypto/store/indexeddb-crypto-store\";\nimport { decryptAES, encryptAES } from \"./aes\";\nimport { logger } from \"../logger\";\nimport { Crypto } from \"./index\";\nimport { Method } from \"../http-api\";\nimport { SecretStorageKeyDescription } from \"../secret-storage\";\n\nexport interface IDehydratedDevice {\n device_id: string; // eslint-disable-line camelcase\n device_data: SecretStorageKeyDescription & {\n // eslint-disable-line camelcase\n algorithm: string;\n account: string; // pickle\n };\n}\n\nexport interface IDehydratedDeviceKeyInfo {\n passphrase?: string;\n}\n\nexport const DEHYDRATION_ALGORITHM = \"org.matrix.msc2697.v1.olm.libolm_pickle\";\n\nconst oneweek = 7 * 24 * 60 * 60 * 1000;\n\nexport class DehydrationManager {\n private inProgress = false;\n private timeoutId: any;\n private key?: Uint8Array;\n private keyInfo?: { [props: string]: any };\n private deviceDisplayName?: string;\n\n public constructor(private readonly crypto: Crypto) {\n this.getDehydrationKeyFromCache();\n }\n\n public getDehydrationKeyFromCache(): Promise<void> {\n return this.crypto.cryptoStore.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.crypto.cryptoStore.getSecretStorePrivateKey(\n txn,\n async (result) => {\n if (result) {\n const { key, keyInfo, deviceDisplayName, time } = result;\n const pickleKey = Buffer.from(this.crypto.olmDevice.pickleKey);\n const decrypted = await decryptAES(key, pickleKey, DEHYDRATION_ALGORITHM);\n this.key = decodeBase64(decrypted);\n this.keyInfo = keyInfo;\n this.deviceDisplayName = deviceDisplayName;\n const now = Date.now();\n const delay = Math.max(1, time + oneweek - now);\n this.timeoutId = global.setTimeout(this.dehydrateDevice.bind(this), delay);\n }\n },\n \"dehydration\",\n );\n });\n }\n\n /** set the key, and queue periodic dehydration to the server in the background */\n public async setKeyAndQueueDehydration(\n key: Uint8Array,\n keyInfo: { [props: string]: any } = {},\n deviceDisplayName?: string,\n ): Promise<void> {\n const matches = await this.setKey(key, keyInfo, deviceDisplayName);\n if (!matches) {\n // start dehydration in the background\n this.dehydrateDevice();\n }\n }\n\n public async setKey(\n key: Uint8Array,\n keyInfo: { [props: string]: any } = {},\n deviceDisplayName?: string,\n ): Promise<boolean | undefined> {\n if (!key) {\n // unsetting the key -- cancel any pending dehydration task\n if (this.timeoutId) {\n global.clearTimeout(this.timeoutId);\n this.timeoutId = undefined;\n }\n // clear storage\n await this.crypto.cryptoStore.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.crypto.cryptoStore.storeSecretStorePrivateKey(txn, \"dehydration\", null);\n });\n this.key = undefined;\n this.keyInfo = undefined;\n return;\n }\n\n // Check to see if it's the same key as before. If it's different,\n // dehydrate a new device. If it's the same, we can keep the same\n // device. (Assume that keyInfo and deviceDisplayName will be the\n // same if the key is the same.)\n let matches: boolean = !!this.key && key.length == this.key.length;\n for (let i = 0; matches && i < key.length; i++) {\n if (key[i] != this.key![i]) {\n matches = false;\n }\n }\n if (!matches) {\n this.key = key;\n this.keyInfo = keyInfo;\n this.deviceDisplayName = deviceDisplayName;\n }\n return matches;\n }\n\n /** returns the device id of the newly created dehydrated device */\n public async dehydrateDevice(): Promise<string | undefined> {\n if (this.inProgress) {\n logger.log(\"Dehydration already in progress -- not starting new dehydration\");\n return;\n }\n this.inProgress = true;\n if (this.timeoutId) {\n global.clearTimeout(this.timeoutId);\n this.timeoutId = undefined;\n }\n try {\n const pickleKey = Buffer.from(this.crypto.olmDevice.pickleKey);\n\n // update the crypto store with the timestamp\n const key = await encryptAES(encodeBase64(this.key!), pickleKey, DEHYDRATION_ALGORITHM);\n await this.crypto.cryptoStore.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.crypto.cryptoStore.storeSecretStorePrivateKey(txn, \"dehydration\", {\n keyInfo: this.keyInfo,\n key,\n deviceDisplayName: this.deviceDisplayName!,\n time: Date.now(),\n });\n });\n logger.log(\"Attempting to dehydrate device\");\n\n logger.log(\"Creating account\");\n // create the account and all the necessary keys\n const account = new global.Olm.Account();\n account.create();\n const e2eKeys = JSON.parse(account.identity_keys());\n\n const maxKeys = account.max_number_of_one_time_keys();\n // FIXME: generate in small batches?\n account.generate_one_time_keys(maxKeys / 2);\n account.generate_fallback_key();\n const otks: Record<string, string> = JSON.parse(account.one_time_keys());\n const fallbacks: Record<string, string> = JSON.parse(account.fallback_key());\n account.mark_keys_as_published();\n\n // dehydrate the account and store it on the server\n const pickledAccount = account.pickle(new Uint8Array(this.key!));\n\n const deviceData: { [props: string]: any } = {\n algorithm: DEHYDRATION_ALGORITHM,\n account: pickledAccount,\n };\n if (this.keyInfo!.passphrase) {\n deviceData.passphrase = this.keyInfo!.passphrase;\n }\n\n logger.log(\"Uploading account to server\");\n // eslint-disable-next-line camelcase\n const dehydrateResult = await this.crypto.baseApis.http.authedRequest<{ device_id: string }>(\n Method.Put,\n \"/dehydrated_device\",\n undefined,\n {\n device_data: deviceData,\n initial_device_display_name: this.deviceDisplayName,\n },\n {\n prefix: \"/_matrix/client/unstable/org.matrix.msc2697.v2\",\n },\n );\n\n // send the keys to the server\n const deviceId = dehydrateResult.device_id;\n logger.log(\"Preparing device keys\", deviceId);\n const deviceKeys: IDeviceKeys = {\n algorithms: this.crypto.supportedAlgorithms,\n device_id: deviceId,\n user_id: this.crypto.userId,\n keys: {\n [`ed25519:${deviceId}`]: e2eKeys.ed25519,\n [`curve25519:${deviceId}`]: e2eKeys.curve25519,\n },\n };\n const deviceSignature = account.sign(anotherjson.stringify(deviceKeys));\n deviceKeys.signatures = {\n [this.crypto.userId]: {\n [`ed25519:${deviceId}`]: deviceSignature,\n },\n };\n if (this.crypto.crossSigningInfo.getId(\"self_signing\")) {\n await this.crypto.crossSigningInfo.signObject(deviceKeys, \"self_signing\");\n }\n\n logger.log(\"Preparing one-time keys\");\n const oneTimeKeys: Record<string, IOneTimeKey> = {};\n for (const [keyId, key] of Object.entries(otks.curve25519)) {\n const k: IOneTimeKey = { key };\n const signature = account.sign(anotherjson.stringify(k));\n k.signatures = {\n [this.crypto.userId]: {\n [`ed25519:${deviceId}`]: signature,\n },\n };\n oneTimeKeys[`signed_curve25519:${keyId}`] = k;\n }\n\n logger.log(\"Preparing fallback keys\");\n const fallbackKeys: Record<string, IOneTimeKey> = {};\n for (const [keyId, key] of Object.entries(fallbacks.curve25519)) {\n const k: IOneTimeKey = { key, fallback: true };\n const signature = account.sign(anotherjson.stringify(k));\n k.signatures = {\n [this.crypto.userId]: {\n [`ed25519:${deviceId}`]: signature,\n },\n };\n fallbackKeys[`signed_curve25519:${keyId}`] = k;\n }\n\n logger.log(\"Uploading keys to server\");\n await this.crypto.baseApis.http.authedRequest(\n Method.Post,\n \"/keys/upload/\" + encodeURI(deviceId),\n undefined,\n {\n \"device_keys\": deviceKeys,\n \"one_time_keys\": oneTimeKeys,\n \"org.matrix.msc2732.fallback_keys\": fallbackKeys,\n },\n );\n logger.log(\"Done dehydrating\");\n\n // dehydrate again in a week\n this.timeoutId = global.setTimeout(this.dehydrateDevice.bind(this), oneweek);\n\n return deviceId;\n } finally {\n this.inProgress = false;\n }\n }\n\n public stop(): void {\n if (this.timeoutId) {\n global.clearTimeout(this.timeoutId);\n this.timeoutId = undefined;\n }\n }\n}\n"],"mappings":";;;;;;;;AAgBA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,QAAA,GAAAL,OAAA;AAxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BO,MAAMM,qBAAqB,GAAG,yCAAyC;AAACC,OAAA,CAAAD,qBAAA,GAAAA,qBAAA;AAE/E,MAAME,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AAE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