View Source Nostr.Crypto (Nostr Lib v0.1.1)

Crypto related stuff

Summary

Functions

Decrypt message with ECDH from seckey and pubkey (automatically extracts IV from message)

Encrypt message with ECDH from seckey and pubkey and append randomly generated IV

Get pubkey (hex encoded) from seckey (hex encoded)

Sign binary data (hex encoded) with seckey (hex encoded)

Functions

Link to this function

decrypt(message, seckey, pubkey)

View Source
@spec decrypt(binary(), binary(), binary()) :: String.t()

Decrypt message with ECDH from seckey and pubkey (automatically extracts IV from message)

Link to this function

encrypt(message, seckey, pubkey)

View Source
@spec encrypt(String.t(), binary(), binary()) :: binary()

Encrypt message with ECDH from seckey and pubkey and append randomly generated IV

@spec pubkey(seckey :: binary()) :: binary()

Get pubkey (hex encoded) from seckey (hex encoded)

Example:

iex> Nostr.Crypto.pubkey("1111111111111111111111111111111111111111111111111111111111111111")
"4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa"
@spec sign(data :: binary(), seckey :: binary()) :: binary()

Sign binary data (hex encoded) with seckey (hex encoded)