sw

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: ISC Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MinPackedEncryptedSize = 24 + secretbox.Overhead

MinPackedEncryptedSize is the minimum size of an encrypted message packed with a nonce.

Variables

This section is empty.

Functions

func Open

func Open(box []byte, key *[32]byte) ([]byte, bool)

Open decrypts a message with the provided key. It uses the prefixed nonce and returns the decrypted message and true. If the message is corrupt or could not be decrypted it returns false.

func PackedEncryptedSize

func PackedEncryptedSize(msgSize int) int

PackedEncryptedSize returns the estimated size for an encrypted sw message with a prepended (packed) nonce, given the specified payload msg size.

func Seal

func Seal(message []byte, key *[32]byte) ([]byte, error)

Seal encrypts a message with the provided key. Behind the scenes it adds a random nonce and returns an encrypted blob that is prefixed by the nonce.

Types

This section is empty.

Jump to

Keyboard shortcuts

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