ditto/src/crypto.ts

15 lines
505 B
TypeScript
Raw Normal View History

2023-08-26 23:03:59 +00:00
import { Conf } from '@/config.ts';
import { nip04 } from '@/deps.ts';
/** Encrypt a message as the Ditto server account. */
function encryptAdmin(targetPubkey: string, message: string): Promise<string> {
return nip04.encrypt(Conf.seckey, targetPubkey, message);
}
/** Decrypt a message as the Ditto server account. */
function decryptAdmin(targetPubkey: string, message: string): Promise<string> {
return nip04.decrypt(Conf.seckey, targetPubkey, message);
}
export { decryptAdmin, encryptAdmin };