NostrElixir.Nip44 (nostr_elixir v0.1.0)
View SourceNIP-44: Encrypted DMs v2 (ChaCha20, HKDF, HMAC, base64)
This module provides functions to encrypt and decrypt messages using NIP-44 (v2).
Examples
iex> alias NostrElixir.Nip44
iex> sk = "...hex secret key..."
iex> pk = "...hex public key..."
iex> ciphertext = Nip44.encrypt(sk, pk, "hello!")
iex> is_binary(ciphertext)
true
iex> Nip44.decrypt(sk, pk, ciphertext)
"hello!"
Summary
Functions
Decrypt a NIP-44 (v2) message.
Parameters
secret_key
- hex string of recipient's secret keypublic_key
- hex string of sender's public keypayload
- base64-encoded ciphertext
Returns
- plaintext message (string)
Encrypt a message using NIP-44 (v2).
Parameters
secret_key
- hex string of sender's secret keypublic_key
- hex string of recipient's public keycontent
- plaintext message
Returns
- base64-encoded ciphertext (string)