nip44

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: Unlicense Imports: 11 Imported by: 0

Documentation

Overview

Package nip44 implements NIP-44: Encrypted Payloads (Versioned), the current ChaCha20+HMAC-SHA256 (encrypt-then-MAC) scheme (v2) for direct-message and other private event content, superseding the legacy AES-CBC scheme in nip04.

Index

Constants

View Source
const (
	Version = 2
)

Variables

View Source
var (
	ErrInvalidVersion  = errors.New("unknown encryption version")
	ErrMessageTooShort = errors.New("message too short")
	ErrInvalidPadding  = errors.New("invalid padding")
	ErrInvalidMAC      = errors.New("invalid MAC")
)

Functions

func Decrypt

func Decrypt(payload string, conversationKey []byte) (string, error)

Decrypt decrypts NIP-44 v2 payload.

func Encrypt

func Encrypt(plaintext string, conversationKey []byte) (string, error)

Encrypt encrypts plaintext using NIP-44 v2.

func GenerateConversationKey

func GenerateConversationKey(privKey *btcec.PrivateKey, pubKey *btcec.PublicKey) ([]byte, error)

GenerateConversationKey computes the conversation key using HKDF-SHA256-Extract derived from the secp256k1 shared secret X coordinate.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL