Using the WebCrypto api in the service worker MV3

594 views
Skip to first unread message

Márton Lederer

unread,
Nov 19, 2022, 11:56:05 AM11/19/22
to Chromium Extensions
Hey,
Manifest v3 removed the window object / APIs from the background script (service worker). Reasonable, but how do I use APIs, such as window.crypto.subtle now (with the service worker). Tried a few things (polyfilling, etc.), none of them work.
Any tips?

Anteneh Bekele

unread,
Nov 19, 2022, 12:15:36 PM11/19/22
to Márton Lederer, Chromium Extensions
--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/e33721bb-690b-42c1-b820-8e0209ab3415n%40chromium.org.

Jackie Han

unread,
Nov 19, 2022, 12:28:12 PM11/19/22
to Márton Lederer, Chromium Extensions
Hi,

crypto.subtle is available in server worker. Just remove the "window." in your code before "crypto".

--

Márton Lederer

unread,
Nov 19, 2022, 2:25:02 PM11/19/22
to Chromium Extensions, Jackie Han, Chromium Extensions, Márton Lederer
Ahh you're right, thank you! One of the modules I was using didn't do that
Reply all
Reply to author
Forward
0 new messages