Documentation
¶
Index ¶
- Constants
- Variables
- func ComputeSharedSecret(pkh, skh string) (sharedSecret []byte, err error)
- func Decrypt(b64ciphertextWrapped string, conversationKey []byte) (plaintext string, err error)
- func DecryptNip4(content string, key []byte) (msg []byte, err error)deprecated
- func Encrypt(plaintext string, conversationKey []byte, applyOptions ...func(opts *Opts)) (cipherString string, err error)
- func EncryptNip4(msg string, key []byte) (ct []byte, err error)deprecated
- func GenerateConversationKey(pkh, skh string) (ck []byte, err error)
- func WithCustomNonce(salt []byte) func(opts *Opts)
- type Opts
Constants ¶
View Source
const ( MinPlaintextSize = 0x0001 // 1b msg => padded to 32b MaxPlaintextSize = 0xffff // 65535 (64kb-1) => padded to 64kb )
Variables ¶
View Source
var WithCustomSalt = WithCustomNonce
Deprecated: use WithCustomNonce instead of WithCustomSalt, so the naming is less confusing
Functions ¶
func ComputeSharedSecret ¶
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 DecryptNip4
deprecated
func EncryptNip4
deprecated
EncryptNip4 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).
Deprecated: upgrade to using Decrypt with the NIP-44 algorithm.
func GenerateConversationKey ¶
func WithCustomNonce ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.