1
|
{"version":3,"file":"rust-crypto.js","names":["RustSdkCryptoJs","_interopRequireWildcard","require","_logger","_CrossSigning","_RoomEncryptor","_OutgoingRequestProcessor","_KeyClaimManager","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","RustCrypto","constructor","olmMachine","http","_userId","_deviceId","_defineProperty2","outgoingRequestProcessor","OutgoingRequestProcessor","keyClaimManager","KeyClaimManager","stop","stopped","close","encryptEvent","event","_room","roomId","getRoomId","encryptor","roomEncryptors","Error","decryptEvent","res","decryptRoomEvent","JSON","stringify","event_id","getId","type","getWireType","sender","getSender","state_key","getStateKey","content","getWireContent","origin_server_ts","getTs","RoomId","clearEvent","parse","claimedEd25519Key","senderClaimedEd25519Key","senderCurve25519Key","forwardingCurve25519KeyChain","getEventEncryptionInfo","_event$getSenderKey","ret","senderKey","getSenderKey","undefined","algorithm","encrypted","authenticated","mismatchedSender","checkUserTrust","userId","UserTrustLevel","checkDeviceTrust","deviceId","DeviceTrustLevel","userHasCrossSigningKeys","prepareToEncrypt","room","ensureEncryptionSession","forceDiscardSession","_this$roomEncryptors$","exportRoomKeys","receiveSyncChanges","events","oneTimeKeysCounts","Map","unusedFallbackKeys","Set","result","DeviceLists","preprocessToDeviceMessages","preprocessOneTimeKeyCounts","preprocessUnusedFallbackKeys","onCryptoEvent","config","getContent","existingEncryptor","RoomEncryptor","members","getEncryptionTargetMembers","logger","debug","map","u","membership","updateTrackedUsers","UserId","onSyncCompleted","syncState","outgoingRequestLoop","onRoomMembership","member","oldMembership","enc","outgoingRequestLoopRunning","outgoingRequests","length","msg","makeOutgoingRequest","e","error","exports"],"sources":["../../src/rust-crypto/rust-crypto.ts"],"sourcesContent":["/*\nCopyright 2022 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 * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-js\";\n\nimport type { IEventDecryptionResult, IMegolmSessionData } from \"../@types/crypto\";\nimport type { IToDeviceEvent } from \"../sync-accumulator\";\nimport type { IEncryptedEventInfo } from \"../crypto/api\";\nimport { MatrixEvent } from \"../models/event\";\nimport { Room } from \"../models/room\";\nimport { RoomMember } from \"../models/room-member\";\nimport { CryptoBackend, OnSyncCompletedData } from \"../common-crypto/CryptoBackend\";\nimport { logger } from \"../logger\";\nimport { IHttpOpts, MatrixHttpApi } from \"../http-api\";\nimport { DeviceTrustLevel, UserTrustLevel } from \"../crypto/CrossSigning\";\nimport { RoomEncryptor } from \"./RoomEncryptor\";\nimport { OutgoingRequest, OutgoingRequestProcessor } from \"./OutgoingRequestProcessor\";\nimport { KeyClaimManager } from \"./KeyClaimManager\";\n\n/**\n * An implementation of {@link CryptoBackend} using the Rust matrix-sdk-crypto.\n */\nexport class RustCrypto implements CryptoBackend {\n public globalErrorOnUnknownDevices = false;\n\n /** whether {@link stop} has been called */\n private stopped = false;\n\n /** whether {@link outgoingRequestLoop} is currently running */\n private outgoingRequestLoopRunning = false;\n\n /** mapping of roomId → encryptor class */\n private roomEncryptors: Record<string, RoomEncryptor> = {};\n\n private keyClaimManager: KeyClaimManager;\n private outgoingRequestProcessor: OutgoingRequestProcessor;\n\n public constructor(\n private readonly olmMachine: RustSdkCryptoJs.OlmMachine,\n http: MatrixHttpApi<IHttpOpts & { onlyData: true }>,\n _userId: string,\n _deviceId: string,\n ) {\n this.outgoingRequestProcessor = new OutgoingRequestProcessor(olmMachine, http);\n this.keyClaimManager = new KeyClaimManager(olmMachine, this.outgoingRequestProcessor);\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // CryptoBackend implementation\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n public stop(): void {\n // stop() may be called multiple times, but attempting to close() the OlmMachine twice\n // will cause an error.\n if (this.stopped) {\n return;\n }\n this.stopped = true;\n\n this.keyClaimManager.stop();\n\n // make sure we close() the OlmMachine; doing so means that all the Rust objects will be\n // cleaned up; in particular, the indexeddb connections will be closed, which means they\n // can then be deleted.\n this.olmMachine.close();\n }\n\n public async encryptEvent(event: MatrixEvent, _room: Room): Promise<void> {\n const roomId = event.getRoomId()!;\n const encryptor = this.roomEncryptors[roomId];\n\n if (!encryptor) {\n throw new Error(`Cannot encrypt event in unconfigured room ${roomId}`);\n }\n\n await encryptor.encryptEvent(event);\n }\n\n public async decryptEvent(event: MatrixEvent): Promise<IEventDecryptionResult> {\n const roomId = event.getRoomId();\n if (!roomId) {\n // presumably, a to-device message. These are normally decrypted in preprocessToDeviceMessages\n // so the fact it has come back here suggests that decryption failed.\n //\n // once we drop support for the libolm crypto implementation, we can stop passing to-device messages\n // through decryptEvent and hence get rid of this case.\n throw new Error(\"to-device event was not decrypted in preprocessToDeviceMessages\");\n }\n const res = (await this.olmMachine.decryptRoomEvent(\n JSON.stringify({\n event_id: event.getId(),\n type: event.getWireType(),\n sender: event.getSender(),\n state_key: event.getStateKey(),\n content: event.getWireContent(),\n origin_server_ts: event.getTs(),\n }),\n new RustSdkCryptoJs.RoomId(event.getRoomId()!),\n )) as RustSdkCryptoJs.DecryptedRoomEvent;\n return {\n clearEvent: JSON.parse(res.event),\n claimedEd25519Key: res.senderClaimedEd25519Key,\n senderCurve25519Key: res.senderCurve25519Key,\n forwardingCurve25519KeyChain: res.forwardingCurve25519KeyChain,\n };\n }\n\n public getEventEncryptionInfo(event: MatrixEvent): IEncryptedEventInfo {\n // TODO: make this work properly. Or better, replace it.\n\n const ret: Partial<IEncryptedEventInfo> = {};\n\n ret.senderKey = event.getSenderKey() ?? undefined;\n ret.algorithm = event.getWireContent().algorithm;\n\n if (!ret.senderKey || !ret.algorithm) {\n ret.encrypted = false;\n return ret as IEncryptedEventInfo;\n }\n ret.encrypted = true;\n ret.authenticated = true;\n ret.mismatchedSender = true;\n return ret as IEncryptedEventInfo;\n }\n\n public checkUserTrust(userId: string): UserTrustLevel {\n // TODO\n return new UserTrustLevel(false, false, false);\n }\n\n public checkDeviceTrust(userId: string, deviceId: string): DeviceTrustLevel {\n // TODO\n return new DeviceTrustLevel(false, false, false, false);\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // CryptoApi implementation\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n public globalBlacklistUnverifiedDevices = false;\n\n public async userHasCrossSigningKeys(): Promise<boolean> {\n // TODO\n return false;\n }\n\n public prepareToEncrypt(room: Room): void {\n const encryptor = this.roomEncryptors[room.roomId];\n\n if (encryptor) {\n encryptor.ensureEncryptionSession();\n }\n }\n\n public forceDiscardSession(roomId: string): Promise<void> {\n return this.roomEncryptors[roomId]?.forceDiscardSession();\n }\n\n public async exportRoomKeys(): Promise<IMegolmSessionData[]> {\n // TODO\n return [];\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // SyncCryptoCallbacks implementation\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n /**\n * Apply sync changes to the olm machine\n * @param events - the received to-device messages\n * @param oneTimeKeysCounts - the received one time key counts\n * @param unusedFallbackKeys - the received unused fallback keys\n * @returns A list of preprocessed to-device messages.\n */\n private async receiveSyncChanges({\n events,\n oneTimeKeysCounts = new Map<string, number>(),\n unusedFallbackKeys = new Set<string>(),\n }: {\n events?: IToDeviceEvent[];\n oneTimeKeysCounts?: Map<string, number>;\n unusedFallbackKeys?: Set<string>;\n }): Promise<IToDeviceEvent[]> {\n const result = await this.olmMachine.receiveSyncChanges(\n events ? JSON.stringify(events) : \"[]\",\n new RustSdkCryptoJs.DeviceLists(),\n oneTimeKeysCounts,\n unusedFallbackKeys,\n );\n\n // receiveSyncChanges returns a JSON-encoded list of decrypted to-device messages.\n return JSON.parse(result);\n }\n\n /** called by the sync loop to preprocess incoming to-device messages\n *\n * @param events - the received to-device messages\n * @returns A list of preprocessed to-device messages.\n */\n public preprocessToDeviceMessages(events: IToDeviceEvent[]): Promise<IToDeviceEvent[]> {\n // send the received to-device messages into receiveSyncChanges. We have no info on device-list changes,\n // one-time-keys, or fallback keys, so just pass empty data.\n return this.receiveSyncChanges({ events });\n }\n\n /** called by the sync loop to preprocess one time key counts\n *\n * @param oneTimeKeysCounts - the received one time key counts\n * @returns A list of preprocessed to-device messages.\n */\n public async preprocessOneTimeKeyCounts(oneTimeKeysCounts: Map<string, number>): Promise<void> {\n await this.receiveSyncChanges({ oneTimeKeysCounts });\n }\n\n /** called by the sync loop to preprocess unused fallback keys\n *\n * @param unusedFallbackKeys - the received unused fallback keys\n * @returns A list of preprocessed to-device messages.\n */\n public async preprocessUnusedFallbackKeys(unusedFallbackKeys: Set<string>): Promise<void> {\n await this.receiveSyncChanges({ unusedFallbackKeys });\n }\n\n /** called by the sync loop on m.room.encrypted events\n *\n * @param room - in which the event was received\n * @param event - encryption event to be processed\n */\n public async onCryptoEvent(room: Room, event: MatrixEvent): Promise<void> {\n const config = event.getContent();\n\n const existingEncryptor = this.roomEncryptors[room.roomId];\n if (existingEncryptor) {\n existingEncryptor.onCryptoEvent(config);\n } else {\n this.roomEncryptors[room.roomId] = new RoomEncryptor(\n this.olmMachine,\n this.keyClaimManager,\n this.outgoingRequestProcessor,\n room,\n config,\n );\n }\n\n // start tracking devices for any users already known to be in this room.\n const members = await room.getEncryptionTargetMembers();\n logger.debug(\n `[${room.roomId} encryption] starting to track devices for: `,\n members.map((u) => `${u.userId} (${u.membership})`),\n );\n await this.olmMachine.updateTrackedUsers(members.map((u) => new RustSdkCryptoJs.UserId(u.userId)));\n }\n\n /** called by the sync loop after processing each sync.\n *\n * TODO: figure out something equivalent for sliding sync.\n *\n * @param syncState - information on the completed sync.\n */\n public onSyncCompleted(syncState: OnSyncCompletedData): void {\n // Processing the /sync may have produced new outgoing requests which need sending, so kick off the outgoing\n // request loop, if it's not already running.\n this.outgoingRequestLoop();\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Other public functions\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n /** called by the MatrixClient on a room membership event\n *\n * @param event - The matrix event which caused this event to fire.\n * @param member - The member whose RoomMember.membership changed.\n * @param oldMembership - The previous membership state. Null if it's a new member.\n */\n public onRoomMembership(event: MatrixEvent, member: RoomMember, oldMembership?: string): void {\n const enc = this.roomEncryptors[event.getRoomId()!];\n if (!enc) {\n // not encrypting in this room\n return;\n }\n enc.onRoomMembership(member);\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Outgoing requests\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n private async outgoingRequestLoop(): Promise<void> {\n if (this.outgoingRequestLoopRunning) {\n return;\n }\n this.outgoingRequestLoopRunning = true;\n try {\n while (!this.stopped) {\n const outgoingRequests: Object[] = await this.olmMachine.outgoingRequests();\n if (outgoingRequests.length == 0 || this.stopped) {\n // no more messages to send (or we have been told to stop): exit the loop\n return;\n }\n for (const msg of outgoingRequests) {\n await this.outgoingRequestProcessor.makeOutgoingRequest(msg as OutgoingRequest);\n }\n }\n } catch (e) {\n logger.error(\"Error processing outgoing-message requests from rust crypto-sdk\", e);\n } finally {\n this.outgoingRequestLoopRunning = false;\n }\n }\n}\n"],"mappings":";;;;;;;;AAgBA,IAAAA,eAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,yBAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OA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