Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] Ensure subtleCrypto is usable from Blazor app #72810

Closed
7 of 10 tasks
lewing opened this issue Jul 25, 2022 · 13 comments
Closed
7 of 10 tasks

[wasm] Ensure subtleCrypto is usable from Blazor app #72810

lewing opened this issue Jul 25, 2022 · 13 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono
Milestone

Comments

@lewing
Copy link
Member

lewing commented Jul 25, 2022

There are potentially several things blocking it from working

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jul 25, 2022
@lewing lewing added this to the 7.0.0 milestone Jul 25, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jul 25, 2022
@lewing lewing added arch-wasm WebAssembly architecture untriaged New issue has not been triaged by the area owner and removed untriaged New issue has not been triaged by the area owner labels Jul 25, 2022
@ghost
Copy link

ghost commented Jul 25, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

There are potentially several things blocking it from working

Author: lewing
Assignees: -
Labels:

arch-wasm, untriaged, area-VM-meta-mono

Milestone: 7.0.0

@lewing
Copy link
Member Author

lewing commented Jul 25, 2022

also related to #69741

@pavelsavara
Copy link
Member

After this arrives to Blazor via SDK, we will attempt to load the dotnet-crypto-worker.js

image

We need to add dotnet-crypto-worker.js into SDK and into list of files hosted by Blazor.

@pavelsavara
Copy link
Member

pavelsavara commented Aug 1, 2022

The current runtime code is using new Worker("dotnet-crypto-worker.js") which means that the file is relative to baseURL is that what we want for Blazor? That is / in the sample app. Not /_framework/ where all the other files are.

@pavelsavara
Copy link
Member

It seems we also need Cross-Origin-Embedder-Policy: require-corp for it.
image

@pavelsavara
Copy link
Member

Also, the file as is doesn't have any hash or cache policy.

@javiercn
Copy link
Member

javiercn commented Aug 1, 2022

@pavelsavara @radical and I talked about this.

It would be ideal if the runtime does not hardcode any path and receives this data as part of the initialization process. We likely want to add a version hash to the file in the same way we do for dotnet.js, and in general, we want control over anything that loads over a fetch request. (In other words, the runtime should not hardcode the logic related to how things work, as we might want to change it in the future or needs to be tweaked depending on the scenario.

@pavelsavara
Copy link
Member

Yes, but your custom startup sequence is already nightmare for us. So it would be better if we don't make it worse by handling modules of the runtime in separate way as well.

My draft dotnet/aspnetcore#42770 doesn't deal with JS assets, but passing us the list of assets with hashes is the right way how to do it.

@javiercn
Copy link
Member

javiercn commented Aug 1, 2022

@pavelsavara cool, that's very much inline with what @radical and myself discussed.

We mostly care about what @SteveSandersonMS commented on the relevant issue. As long as we maintain the current functionality, we should be good, for example, we wouldn't want to start imposing a concrete file layout on the deployed apps.

@pavelsavara
Copy link
Member

image

@radical
Copy link
Member

radical commented Aug 5, 2022

JFYI, this will need a test in Wasm.Build.Tests. It can use playwright to click on some button to trigger a crypto call. An existing blazor test - https://github.com/dotnet/runtime/blob/main/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmTemplateTests.cs#L250-L278 :

await using var runner = new BrowserRunner();
var page = await runner.RunAsync(runCommand, $"run -c {config} --no-build");
await page.Locator("text=Counter").ClickAsync();
var txt = await page.Locator("p[role='status']").InnerHTMLAsync();
Assert.Equal("Current count: 0", txt);
await page.Locator("text=\"Click me\"").ClickAsync();
txt = await page.Locator("p[role='status']").InnerHTMLAsync();
Assert.Equal("Current count: 1", txt);

@eerhardt
Copy link
Member

eerhardt commented Aug 9, 2022

cc @jeffhandley - FYI

@radical
Copy link
Member

radical commented Aug 17, 2022

Closing in favor of #73858 . Please re-open if needed for some reason.

@radical radical closed this as completed Aug 17, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono
Projects
None yet
Development

No branches or pull requests

5 participants