mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2024-11-23 01:45:50 +03:00
22 lines
567 B
TypeScript
22 lines
567 B
TypeScript
// Copyright © 2023 Aravinth Manivnanan <realaravinth@batsense.net>.
|
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
|
//
|
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
|
|
import log from "../logger";
|
|
|
|
import prove from "./prove";
|
|
import { PoWConfig, ServiceWorkerWork } from "./types";
|
|
|
|
log.log("worker registered");
|
|
onmessage = async (e) => {
|
|
console.debug("message received at worker");
|
|
const config: PoWConfig = e.data;
|
|
|
|
const work = await prove(config);
|
|
const res: ServiceWorkerWork = {
|
|
work,
|
|
};
|
|
|
|
postMessage(res);
|
|
};
|