-
Notifications
You must be signed in to change notification settings - Fork 9
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
webapp: Encryption fails in Chrome #29
Comments
Hi. Same issue here in passphrase mode in Chrome. But (strangely) the page works in Firefox... |
I am now seeing the same exception in Firefox 107 on macOS 13.0.1 with 5de7b79:
|
I think the problem is that you're using native streams and polyfilled streams interchangeably. And unfortunately, Consider the following snippet: Lines 245 to 251 in 1a64717
One solution would be to manually convert all your native streams to polyfilled ones before usage. I made a small library to help with that. You add a bit of initialization code: import { createReadableStreamWrapper, createWritableStreamWrapper } from '@mattiasbuelens/web-streams-adapter';
const toPolyfillReadable = createReadableStreamWrapper(window.ReadableStream);
const toPolyfillWritable = createWritableStreamWrapper(window.WritableStream); and then you convert where necessary: encryptSingleFile() {
let fileStream = toPolyfillReadable(this.dropFiles[0].stream());
let downloadStream = toPolyfillWritable(this.downloadStream);
return fileStream.pipeTo(downloadStream).then(this.reset);
}, |
Aha, that makes a lot of sense in hindsight! I was definitely assuming that the polyfill was handling this for me (or that the interface was being duck-typed). It might be useful to mention the wrapper library in the polyfill library documentation (if it's not already there; I don't recall seeing it when I implemented this). I'll try this and see if it resolves the issue. |
I was trying to make that work for version 4.0 of the polyfill, but unfortunately I had to throw in the towel (see MattiasBuelens/web-streams-polyfill#122 (comment)). 😞
Yes, the documentation needs improvement. 😅 I'm also considering adding these conversion methods to |
Environment
What were you trying to do
I generated a new identity, and then tried to encrypt a file to it.
What happened
The text was updated successfully, but these errors were encountered: