// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>\r
// SPDX-License-Identifier: GPL-3.0-or-later\r
-//@ts-nocheck\r
+\r
'use strict'\r
\r
import { Blake2b } from './blake2b.js'\r
d.publicKey = convert(d.privateKey)\r
}\r
const buf = new TextEncoder().encode(JSON.stringify(data)).buffer\r
+ //@ts-expect-error\r
postMessage(buf, [buf])\r
})\r
\r
// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
// SPDX-License-Identifier: GPL-3.0-or-later
-//@ts-nocheck
-import { Blake2b } from './blake2b.js'
const p = () => {
const SEND_THRESHOLD = '0xfffffff8'
/**
* Listens for messages from a calling function.
*/
- addEventListener('message', (message) => {
+ addEventListener('message', message => {
const data = JSON.parse(new TextDecoder().decode(message.data ?? message))
for (const d of data) {
if (d === 'stop') {
return out
}
- function calculate (hashHex, callback, progressCallback, threshold = '0xFFFFFFF8') {
+ function calculate (hashHex: string, callback: (nonce: string) => any, progressCallback: (frames: number) => any, threshold: number | string = '0xFFFFFFF8'): void {
if (typeof threshold === 'number') threshold = '0x' + threshold.toString(16)
const canvas = new OffscreenCanvas(webglWidth, webglHeight)