blob: b93779dc8b661169c441089f4073cf6cfb53ef4e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
import { finalizeEvent } from 'nostr-tools/pure';
import { getPrivateKey } from '$lib/nostr';
export const signEvent = async (event: object, user: object): object => {
if (await window.nostr.getPublicKey() === user.pubkey) {
return window.nostr.signEvent(event);
} else {
const sk = await getPrivateKey();
return finalizeEvent(event, sk);
}
}
|