async function nip04.encrypt(pubkey, plaintext): string
returns ciphertext and iv as specified in nip-04
pubkey
— requiredstring
the publick keymessage
— requiredstring
a string to sign
const provider = (window.$onekey && window.$onekey.nostr) || window.nostr;
const encrypted = async provider.nip04.encrypt(pubkey, "Data to be encrypted")
{% embed url="https://codepen.io/OneKeyHQ/pen/rNPZwaa" %}