nip04.decrypt

Method

async function nip04.decrypt(pubkey, message): string 

Params

  • pubkey — required string the publick key

  • message — required string a string to sign

Response

returns ciphertext and iv as specified in nip-04

Example

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

const message = "Data to be encrypted";
const encrypted = await provider.nip04.encrypt(pubkey, message);
const decrypted = await provider.nip04.decrypt(pubkey, encrypted); // Data to be encrypted

Demo

Last updated