Add PowWorker to mine Nostr events off the main thread
This commit is contained in:
10
src/workers/pow.worker.ts
Normal file
10
src/workers/pow.worker.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import * as Comlink from 'comlink';
|
||||
import { nip13, type UnsignedEvent } from 'nostr-tools';
|
||||
|
||||
export const PowWorker = {
|
||||
mine<K extends number>(event: UnsignedEvent<K>, difficulty: number) {
|
||||
return nip13.minePow(event, difficulty);
|
||||
},
|
||||
};
|
||||
|
||||
Comlink.expose(PowWorker);
|
||||
Reference in New Issue
Block a user