nip04

package
v0.30.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 9 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeSharedSecret

func ComputeSharedSecret(pub string, sk string) (sharedSecret []byte, err error)

ComputeSharedSecret returns a shared secret key used to encrypt messages. The private and public keys should be hex encoded. Uses the Diffie-Hellman key exchange (ECDH) (RFC 4753).

func Decrypt

func Decrypt(content string, key []byte) (string, error)

Decrypt decrypts a content string using the shared secret key. The inverse operation to message -> Encrypt(message, key).

func Encrypt

func Encrypt(message string, key []byte) (string, error)

Encrypt encrypts message with key using aes-256-cbc. key should be the shared secret generated by ComputeSharedSecret. Returns: base64(encrypted_bytes) + "?iv=" + base64(initialization_vector).

Types

This section is empty.

Jump to

Keyboard shortcuts

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