summaryrefslogtreecommitdiff
path: root/includes/external/matrix/node_modules/matrix-js-sdk/lib/rust-crypto/index.js.map
blob: 22ee88806412bc8b550a492ffac06896e6f0f91c (plain)
1
{"version":3,"file":"index.js","names":["RustSdkCryptoJs","_interopRequireWildcard","require","_rustCrypto","_logger","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","initRustCrypto","http","userId","deviceId","initAsync","Tracing","LoggerLevel","Trace","turnOn","u","UserId","d","DeviceId","logger","info","olmMachine","OlmMachine","initialize","RUST_SDK_STORE_PREFIX","rustCrypto","RustCrypto"],"sources":["../../src/rust-crypto/index.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 { RustCrypto } from \"./rust-crypto\";\nimport { logger } from \"../logger\";\nimport { RUST_SDK_STORE_PREFIX } from \"./constants\";\nimport { IHttpOpts, MatrixHttpApi } from \"../http-api\";\n\nexport async function initRustCrypto(\n    http: MatrixHttpApi<IHttpOpts & { onlyData: true }>,\n    userId: string,\n    deviceId: string,\n): Promise<RustCrypto> {\n    // initialise the rust matrix-sdk-crypto-js, if it hasn't already been done\n    await RustSdkCryptoJs.initAsync();\n\n    // enable tracing in the rust-sdk\n    new RustSdkCryptoJs.Tracing(RustSdkCryptoJs.LoggerLevel.Trace).turnOn();\n\n    const u = new RustSdkCryptoJs.UserId(userId);\n    const d = new RustSdkCryptoJs.DeviceId(deviceId);\n    logger.info(\"Init OlmMachine\");\n\n    // TODO: use the pickle key for the passphrase\n    const olmMachine = await RustSdkCryptoJs.OlmMachine.initialize(u, d, RUST_SDK_STORE_PREFIX, \"test pass\");\n    const rustCrypto = new RustCrypto(olmMachine, http, userId, deviceId);\n\n    logger.info(\"Completed rust crypto-sdk setup\");\n    return rustCrypto;\n}\n"],"mappings":";;;;;;AAgBA,IAAAA,eAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAAoD,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAN,wBAAAU,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,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