Skip to content

Commit

Permalink
move changes to other PRs and rebase on main
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara committed Aug 5, 2022
1 parent 94e24ff commit 1013b63
Show file tree
Hide file tree
Showing 3 changed files with 400 additions and 397 deletions.
15 changes: 12 additions & 3 deletions src/mono/wasm/runtime/crypto-worker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

import { Module } from "./imports";
import { Module, runtimeHelpers } from "./imports";
import { mono_assert } from "./types";

class OperationFailedError extends Error { }
Expand Down Expand Up @@ -112,11 +112,13 @@ export function init_crypto(): void {
channel: chan,
worker: worker,
};
worker.postMessage({
const messageData: InitCryptoMessageData = {
config: JSON.stringify(runtimeHelpers.config),
comm_buf: chan.get_comm_buffer(),
msg_buf: chan.get_msg_buffer(),
msg_char_len: chan.get_msg_len()
});
};
worker.postMessage(messageData);
worker.onerror = event => {
console.warn(`MONO_WASM: Error in Crypto WebWorker. Cryptography digest calls will fallback to managed implementation. Error: ${event.message}`);
mono_wasm_crypto = null;
Expand Down Expand Up @@ -386,3 +388,10 @@ class LibraryChannel {
return new LibraryChannel(msg_char_len);
}
}

export type InitCryptoMessageData = {
config: string,// serialized to avoid passing non-clonable objects
comm_buf: SharedArrayBuffer,
msg_buf: SharedArrayBuffer,
msg_char_len: number
}
Loading

0 comments on commit 1013b63

Please sign in to comment.