Skip to content

Latest commit

 

History

History
27 lines (16 loc) · 566 Bytes

File metadata and controls

27 lines (16 loc) · 566 Bytes

nip04.encrypt

Method

async function nip04.encrypt(pubkey, plaintext): string 

Response

returns ciphertext and iv as specified in nip-04

Params

  • pubkeyrequired string the publick key
  • messagerequired string a string to sign

Example

const provider = (window.$onekey && window.$onekey.nostr) || window.nostr;

const encrypted = async provider.nip04.encrypt(pubkey, "Data to be encrypted")

Demo

{% embed url="https://codepen.io/OneKeyHQ/pen/rNPZwaa" %}