summaryrefslogtreecommitdiff
path: root/bot/node_modules/matrix-js-sdk/lib/crypto/device-converter.js.map
blob: 6d415297d52d16f81cfe4524e3332fa5e785d5f8 (plain)
1
{"version":3,"file":"device-converter.js","names":["_device","require","deviceInfoToDevice","deviceInfo","userId","keys","Map","Object","entries","displayName","getDisplayName","undefined","signatures","set","Device","deviceId","algorithms","verified"],"sources":["../../src/crypto/device-converter.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 { Device } from \"../models/device\";\nimport { DeviceInfo } from \"./deviceinfo\";\n\n/**\n * Convert a {@link DeviceInfo} to a {@link Device}.\n * @param deviceInfo - deviceInfo to convert\n * @param userId - id of the user that owns the device.\n */\nexport function deviceInfoToDevice(deviceInfo: DeviceInfo, userId: string): Device {\n    const keys = new Map<string, string>(Object.entries(deviceInfo.keys));\n    const displayName = deviceInfo.getDisplayName() || undefined;\n\n    const signatures = new Map<string, Map<string, string>>();\n    if (deviceInfo.signatures) {\n        for (const userId in deviceInfo.signatures) {\n            signatures.set(userId, new Map(Object.entries(deviceInfo.signatures[userId])));\n        }\n    }\n\n    return new Device({\n        deviceId: deviceInfo.deviceId,\n        userId: userId,\n        keys,\n        algorithms: deviceInfo.algorithms,\n        verified: deviceInfo.verified,\n        signatures,\n        displayName,\n    });\n}\n"],"mappings":";;;;;;AAgBA,IAAAA,OAAA,GAAAC,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACC,UAAsB,EAAEC,MAAc,EAAU;EAC/E,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAiBC,MAAM,CAACC,OAAO,CAACL,UAAU,CAACE,IAAI,CAAC,CAAC;EACrE,MAAMI,WAAW,GAAGN,UAAU,CAACO,cAAc,CAAC,CAAC,IAAIC,SAAS;EAE5D,MAAMC,UAAU,GAAG,IAAIN,GAAG,CAA8B,CAAC;EACzD,IAAIH,UAAU,CAACS,UAAU,EAAE;IACvB,KAAK,MAAMR,MAAM,IAAID,UAAU,CAACS,UAAU,EAAE;MACxCA,UAAU,CAACC,GAAG,CAACT,MAAM,EAAE,IAAIE,GAAG,CAACC,MAAM,CAACC,OAAO,CAACL,UAAU,CAACS,UAAU,CAACR,MAAM,CAAC,CAAC,CAAC,CAAC;IAClF;EACJ;EAEA,OAAO,IAAIU,cAAM,CAAC;IACdC,QAAQ,EAAEZ,UAAU,CAACY,QAAQ;IAC7BX,MAAM,EAAEA,MAAM;IACdC,IAAI;IACJW,UAAU,EAAEb,UAAU,CAACa,UAAU;IACjCC,QAAQ,EAAEd,UAAU,CAACc,QAAQ;IAC7BL,UAAU;IACVH;EACJ,CAAC,CAAC;AACN"}