Creating IdentityServiceClientWrapper inside of the shared worker.
Depends on D11273
Paths
| Differential D11274 Authored by michal on Mar 7 2024, 8:15 AM.
Details Summary Creating IdentityServiceClientWrapper inside of the shared worker. Depends on D11273 Test Plan
Creation code: await sharedWorker.schedule({ type: workerRequestMessageTypes.CREATE_IDENTITY_SERVICE_CLIENT, opaqueWasmPath: opaqueWasmPath(), platformDetails: getConfig().platformDetails, authLayer, });
Diff Detail
Event TimelineHerald added a subscriber: ashoat. · View Herald TranscriptMar 7 2024, 8:15 AM2024-03-07 08:15:21 (UTC-8)
Harbormaster completed remote builds in B27389: Diff 37932.Mar 7 2024, 8:30 AM2024-03-07 08:30:13 (UTC-8)
Comment Actions Response to the opaque URL comment: Below, I wrote some investigations that I did about the differences between opaque and other WASM files. But I guess if we want to treat opaque the exact same way as we treat the other WASM files it wouldn't be a problem:
The reason the differences exist in this revision of this diff is that I wanted to use the same opaqueURL for both tab-JS-context and webworker-JS-context. But the corresponding JS files for these context are hosted in different places and so have different default origins for network calls. In website-responders.js this is how we specify the URLs: olmFilename: '', commQueryExecutorFilename: '', opaqueURL: 'http://localhost:8080/opaque-ke.wasm', backupClientFilename: '', and for prod: olmFilename: manifest['olm.wasm'], commQueryExecutorFilename: webworkersManifest['comm_query_executor.wasm'], opaqueURL: `compiled/${manifest['comm_opaque2_wasm_bg.wasm']}`, backupClientFilename: webworkersManifest['backup-client-wasm_bg.wasm'], I started investigating it and I discovered some weird things with the opaque WASM file:
So it looks like webpack is automatically copying the wasm file for us but I'm not sure why. That still doesn't really explain why we use 'http://localhost:8080/opaque-ke.wasm'. Possibly just a mistake and it's not necessary? Additionally in prod version, opaqueURL has compiled/ prefix while e.g. olm doesn't. This might be a difference in how the initialization code is generated by wasm-pack and emscripten? Comment Actions Thanks @michal for this detailed research. Do we know who first introduced the opaque WASM? Was it me or @varun maybe? I think the best next step here is to create a new Linear issue with your observations as well as proposed changes to make it consistent, and then to assign to whoever introduced the opaque WASM first. If it's a former team member, then you can assign to me. Comment Actions
I think after migrating the Identity client to worker we will no longer need opaque on tab-JS-context, so it probably makes the most sense to now introduce a new CopyPlugin and match handling opaque wasm as other wasm files in our codebase, and after flipping the switch we can stop hosting this file for tab-JS-context?
Comment Actions Updated the diff to match the changes in previous diffs. Went with the approach suggested by @kamil for the WASM file -> new CopyPlugin in webpack config and added a new a webworkersOpaqueFilename global variable. @ashoat in this case I don't think we need to create a separate a task to make it consistent. If you agree I will just create a task to stop hosting the opaque WASM file for tab-JS-context (that we do in an inconsistent way).
Harbormaster completed remote builds in B27499: Diff 38056.Mar 14 2024, 4:38 AM2024-03-14 04:38:04 (UTC-7) Comment Actions Could you create a task, to after fully migrating Identitiy client to the worker to deprecate opaque on the main thread?
This revision is now accepted and ready to land.Mar 15 2024, 10:24 AM2024-03-15 10:24:15 (UTC-7) Harbormaster completed remote builds in B27549: Diff 38120.Mar 18 2024, 4:56 AM2024-03-18 04:56:10 (UTC-7) Closed by commit rCOMMbffa8bcab6d5: [web] Create identity client on shared worker (authored by Michal Gniadek <michal.gniadek@swmansion.com>). · Explain WhyMar 18 2024, 6:42 AM2024-03-18 06:42:00 (UTC-7) This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 38120 keyserver/src/responders/website-responders.js
web/shared-worker/utils/constants.js
web/shared-worker/worker/identity-client.js
web/shared-worker/worker/shared-worker.js
web/shared-worker/worker/worker-crypto.js
|